reze-engine 0.55.16 → 0.56.1

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.
@@ -84,6 +84,12 @@ type SceneRenderClass =
84
84
  | "ground"
85
85
  /** Backface-expanded hulls. Also a material blend — it is geometry. */
86
86
  | "outline"
87
+ /** A mirror surface: opaque geometry carrying a projective sample of the
88
+ * reflection target. Blends like a material because it IS one, and is out of
89
+ * WRITES_ID because what it shows is a picture of the cast rather than the
90
+ * cast — a reflection that claimed her object id would seed the distance
91
+ * field twice and put every silhouette effect's border around the glass. */
92
+ | "mirror"
87
93
  /** Particles and ribbons in their default, non-additive mode. */
88
94
  | "particle"
89
95
  /** Particles declaring `#blend additive` — LIGHT rather than matter, so
@@ -158,12 +164,20 @@ const ADD_PREMULTIPLIED: GPUBlendState = {
158
164
  * consequence. Outline hulls, particles and ribbons are OUT: they are not
159
165
  * things you would ever address by id, and a hull would overwrite the id of the
160
166
  * body it traces.
167
+ *
168
+ * So is the mirror — see the class's own note.
161
169
  */
162
170
  const WRITES_ID = new Set<SceneRenderClass>(["material", "ground"])
163
171
 
164
172
  /** The blends each class writes its two attachments with. */
165
173
  const BLENDS: Record<Exclude<SceneRenderClass, "depth-prepass">, [GPUBlendState, GPUBlendState]> = {
166
174
  material: [ALPHA_OVER, ALPHA_OVER],
175
+ // PREMULTIPLIED, like the ground and for the same reason: what a mirror
176
+ // writes is a sample of the HDR target, and that target already holds colour
177
+ // premultiplied by its own alpha. Handed to the src-alpha blend it would be
178
+ // weighted a second time, and a reflection at coverage 0.5 would arrive at a
179
+ // quarter strength.
180
+ mirror: [PREMULTIPLIED_OVER, ALPHA_OVER],
167
181
  // PREMULTIPLIED colour, alone among the classes — see the blend's own note.
168
182
  // The aux is ordinary alpha-over: the ground writes its mask unweighted, like
169
183
  // everything else, and coverage is what the blend applies.