reze-engine 0.69.7 → 0.69.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -355,7 +355,7 @@ export function compileGraph(graph: ShaderGraph, opts: CompileOptions = {}): Com
355
355
  // Lit is the SURFACE only when it is the graph's output: then it shades the
356
356
  // lamps' diffuse by its own albedo, as URP does. Mixed in as a layer (a
357
357
  // toon look's gloss), the lamps stay the epilogue's, on the whole material.
358
- if (node.type === "lit" && node.id !== out.node) return spec(node).emit!(raw).replace(/, true\)$/, ", false)")
358
+ if (node.type === "lit" && node.id !== out.node) return spec(node).emit!(raw).replace(/input\.worldPos, true\)/, "input.worldPos, false)")
359
359
  return spec(node).emit!(raw)
360
360
  }
361
361
 
@@ -392,6 +392,15 @@ export const NODE_REGISTRY: Record<string, NodeSpec> = {
392
392
  outputs: { value: "float" },
393
393
  contextOutputs: { value: "material.shininess" },
394
394
  },
395
+ // The PMX ambient colour, live: a host rewrites it per frame with
396
+ // setMaterialUniforms({ ambient }), so a graph that multiplies by it has a
397
+ // per-material dial on the clock (a game stage's scene tint, which its show
398
+ // moves with the music).
399
+ material_ambient: {
400
+ inputs: {},
401
+ outputs: { color: "color" },
402
+ contextOutputs: { color: "material.ambient" },
403
+ },
395
404
 
396
405
  material_diffuse: {
397
406
  inputs: {},
@@ -738,12 +747,20 @@ export const NODE_REGISTRY: Record<string, NodeSpec> = {
738
747
  * (Schlick), as Blender's Principled; 0 is URP's fixed reflectance. */
739
748
  fresnel: F(0),
740
749
  normal: { type: "vector", contextDefault: "n" },
750
+ /** Its whole result scaled — lamps, reflections and glow alike, as a game
751
+ * stage's last multiply (SimSceneTint) scales it. Inside the node rather
752
+ * than after it, because Lit is the SURFACE only as the graph's output
753
+ * (it then shades the lamps itself; see compile.ts emitExpr). */
754
+ tint: C([1, 1, 1]),
741
755
  },
742
756
  outputs: { color: "color", alpha: "float" },
743
757
  outputSelect: { color: ".rgb", alpha: ".a" },
744
- emit: (a) =>
745
- `urp_lit(${a.base_color}, ${a.metallic}, ${a.smoothness}, ${a.specular}, ${a.occlusion}, ${a.emission}, ${a.alpha}, ${a.fresnel}, ` +
746
- `${a.normal}, l, v, sun, amb, shadow, input.worldPos, true)`,
758
+ emit: (a) => {
759
+ const call =
760
+ `urp_lit(${a.base_color}, ${a.metallic}, ${a.smoothness}, ${a.specular}, ${a.occlusion}, ${a.emission}, ${a.alpha}, ${a.fresnel}, ` +
761
+ `${a.normal}, l, v, sun, amb, shadow, input.worldPos, true)`
762
+ return a.tint === "vec3f(1.0)" ? call : `(${call} * vec4f(${a.tint}, 1.0))`
763
+ },
747
764
  takesLight: true,
748
765
  },
749
766