Repository navigation
Conversation
[Medium impact] The PR appears safe to merge, with a non-blocking filtering issue remaining for small inserts. Findings
SummaryAdds an opt-in Traced mode to
|
| float3 vbInside = refract(-vb, float3(0.0, 1.0, 0.0), rcp(eta)); | ||
| float2 slide = (vbInside.xz / max(-vbInside.y, 0.25) - tracedInside.xz / max(-tracedInside.y, 0.25)) | ||
| * (_TracedGeometry.z * 0.001 / max(_TracedFrame.w, 1e-4)); | ||
| float light = dot(SAMPLE_TEXTURE2D_LOD(_TracedLight, sampler_TracedLight, InsertTracedUv(card) + slide, 0), weights); |
There was a problem hiding this comment.
The baked light and room maps always read mip level zero. When an insert is small on screen, this skips the averaged texture levels and can make fine baked edges shimmer as the camera moves.
Use screen-size-aware filtering for _TracedLight and filtering that keeps the four _TracedEnv tiles separate. Document that both maps need mipmaps.
There was a problem hiding this comment.
Fixed in 65ed17a. _TracedLight is sampled with the gradients of its UV (SAMPLE_TEXTURE2D_GRAD). _TracedEnv picks its mip level from the UV derivatives in slice texels, capped at 4, and keeps half a texel of that level in from each slice edge. A slice is a 512 power-of-two block, so its mip texels never span two slices. The docs page now says to import all three maps with mipmaps. The test bakes have none yet, so on them this is a no-op until they're re-imported.
With the _INSERT_TRACED keyword on, the body glow comes from an offline path-traced render of the insert (four view elevations, one per channel) instead of the optical response map. The bulb image and the facet glints are drawn live through a facet map from the same render, and an optional lamp-off render of the insert under the room replaces the live unlit body. With the keyword off, the material is unchanged. The controls and their tooltips live once in InsertTracedFields, for both pipelines' inspectors. The lamp-off brightness is the global _InsertTracedOffEv (stops), set by the table when it loads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fe6ec31 to
65ed17a
Compare
What
An opt-in Traced mode for
Pinball/Insert Hybrid, behind the material keyword_INSERT_TRACED. With it on, the body's glow comes from an offline path-traced render of the insert instead of the optical response map. The bulb image and the facet glints are still drawn live, through a facet map from the same render. An optional second render of the insert under the room, with the lamp off, replaces the live unlit body. With the keyword off the material is unchanged: both new custom-function nodes pass their inputs straight through.InsertTraced.hlsl(new) and two custom-function nodes in the graph: one beforeInsertOptics(scales the live glow and bulb by the mix controls) and one after it (adds the traced light, glints and lamp-off layer).InsertOptics.hlslis not touched.multi_compile_local, fragment stage only, because player tables build their materials at runtime and ashader_featurewould be stripped. That doubles the fragment variants of the Insert Hybrid: say if you'd rather haveshader_featureplus a variant collection.InsertTracedFields(editor): the controls and their tooltips in one place, so the HDRP and URP inspectors show the same sections with the same words (companion PRs below).InsertMaterialPreset.IsStyle). They belong to the insert type and its bake (where the render sits, its elevations), not to a look shared between inserts.InsertPresetTestsasserts it.traced-mode.md, text only; no images committed).The lamp-off brightness is a global,
_InsertTracedOffEv(stops), which the table sets when it loads.Why
The live optics fake the glow from the response map. A path-traced render of the actual plastic (faceted floor, starburst, skirt, a bulb in the pocket) gives the depth and the bright facet edges a real insert has. The glints and the bulb's parallax stay live because a render can't know where the eye is. @dcbenji tuned it by eye on T2's rectangles, circles and triangles, lit and unlit, and prefers it to the live look on those inserts.
Not in this PR
bake_insert.py, Cycles by default and LuxCore when installed._InsertTracedOffEvwould follow it (room stops plus a per-table offset). We have a sketch (a per-table setting next to Insert Brightness) if that helps, as a separate PR.Testing
InsertPresetTestswith its new Traced assertions.BuildInsertShader, called directly: the toggle's value restores the keyword (on and off). HDRP's resolver does the same thing but wasn't exercised..vperound trip into the Player. The translator ships the Traced maps as linear, uncompressed data, but HDR (EXR) source maps through the texture cook are unverified.Companion PRs: VisualPinball/VisualPinball.Unity.Hdrp#37 (inspector section,
.vpekeyword restore, linear Traced maps) and VisualPinball/VisualPinball.Unity.Urp#33 (inspector foldout, keyword restore). Both need this one.🤖 Generated with Claude Code