Orient PMREM sampling for Z-up world
This commit is contained in:
parent
8974a0b91e
commit
444c4fc75f
3 changed files with 9 additions and 3 deletions
|
|
@ -417,11 +417,16 @@ bool traceGridSurfaceDirect(float3 origin, float3 direction, float intervalStart
|
|||
return false;
|
||||
}
|
||||
|
||||
float3 studioPmremDirection(float3 worldDirection)
|
||||
{
|
||||
return normalize(float3(worldDirection.x, worldDirection.z, worldDirection.y));
|
||||
}
|
||||
|
||||
float3 gridMirrorRadiance(float3 p, float3 direction, out float3 normal)
|
||||
{
|
||||
normal = terrainNormal(p);
|
||||
float3 reflectionDirection = reflect(direction, normal);
|
||||
return studioPmremTexture.SampleLevel(gridSampler, reflectionDirection, 0.0).rgb;
|
||||
return studioPmremTexture.SampleLevel(gridSampler, studioPmremDirection(reflectionDirection), 0.0).rgb;
|
||||
}
|
||||
|
||||
RayMarchResult traverseRay(float2 uv, float2 screenUv, float3 origin, float3 direction)
|
||||
|
|
@ -570,7 +575,7 @@ float3 studioPmremSpecularRadiance(float3 p, float3 normal, float roughness, flo
|
|||
float ndv = saturate(dot(normal, viewDirection));
|
||||
float3 reflectionDirection = reflect(-viewDirection, normal);
|
||||
float lod = saturate(roughness) * STUDIO_PMREM_MAX_LOD;
|
||||
float3 radiance = studioPmremTexture.SampleLevel(gridSampler, reflectionDirection, lod).rgb;
|
||||
float3 radiance = studioPmremTexture.SampleLevel(gridSampler, studioPmremDirection(reflectionDirection), lod).rgb;
|
||||
float3 fresnel = fresnelSchlickRoughness(ndv, f0, roughness);
|
||||
return radiance * fresnel * STUDIO_PMREM_SPECULAR_INTENSITY;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,3 +7,4 @@
|
|||
{"timestamp":"2026-05-11T06:18:00+01:00","topic":"pmrem-cubemap-bake","lesson":"Studio HDR reflection lighting is baked as a PMREM DDS cubemap: roughness selects higher mips, and the bake samples the source latlong by output direction so cubemap faces are generated from one continuous domain instead of filtered as isolated square images.","files":["scripts/bake-pmrem-cubemap.py","src/Aquarium.Engine/Assets/Textures/studio3_pmrem.dds","state/map.yaml","state/memory.json"],"source":"E:\\Projects\\EpiphanyAquarium\\public\\textures\\studio3.hdr"}
|
||||
{"timestamp":"2026-05-11T06:28:00+01:00","topic":"pmrem-scene-binding","lesson":"The Studio3 PMREM asset is live in the scene as a D3D12 TextureCube bound at t22. The renderer owns a narrow RGBA16F DX10 DDS cubemap loader, keeps upload resources alive until the copy fence completes, and the scene shader uses roughness-scaled SampleLevel for specular material reflections only.","files":["src/Aquarium.Engine/Render/D3D12CubeTexture.cs","src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","state/map.yaml","state/memory.json"]}
|
||||
{"timestamp":"2026-05-11T06:42:00+01:00","topic":"grid-mirror-surface","lesson":"Grid linework was replaced with a terminating perfect mirror surface. Grid hits now write the primary scene packet with FIELD_ID_GRID, terrain normal, full coverage, and Studio3 PMREM mip 0 reflection instead of using the transparent event lane.","files":["src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","state/map.yaml","state/memory.json"]}
|
||||
{"timestamp":"2026-05-11T06:50:00+01:00","topic":"pmrem-world-basis","lesson":"Aquarium world space is Z-up while the baked Studio3 PMREM cubemap is sampled as Y-up. Every PMREM lookup must convert world directions with (x, z, y) before TextureCube sampling, or the HDRI appears sideways.","files":["src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","state/memory.json"]}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
"Heavy/specialized SDF evaluators should not live inside generic packed-id helpers when those helpers are called repeatedly; avoid shader compiler path cloning.",
|
||||
"Lighting is diegetic. Self is the initial emitter; later other Selves should emit through an explicit body light lane, not generic field instances or ambient convenience fill.",
|
||||
"Keep bundled blue-noise texture assets available for future dithering/noise work even when no current pass samples them.",
|
||||
"Specular IBL uses the Studio3 PMREM cubemap: bake HDR latlong radiance into roughness-indexed cubemap mips, load it as a D3D12 TextureCube, and sample it by reflection direction plus roughness LOD. Grid mirror reflection samples mip 0 directly; body material reflections use roughness LOD. Keep this as material reflection response, not a replacement for diegetic body light authority.",
|
||||
"Specular IBL uses the Studio3 PMREM cubemap: bake HDR latlong radiance into roughness-indexed cubemap mips, load it as a D3D12 TextureCube, and sample it by reflection direction plus roughness LOD. Convert Aquarium's Z-up world directions to cubemap Y-up directions before sampling: (x, z, y). Grid mirror reflection samples mip 0 directly; body material reflections use roughness LOD. Keep this as material reflection response, not a replacement for diegetic body light authority.",
|
||||
"HDR/PBR presentation follows research/rendering/hdr-pbr-presentation.md: scene-linear lighting, explicit exposure, pre-tonemap bloom/veil, then display transform.",
|
||||
"Current temporal diagnostics are for inspection. With projection jitter disabled, final presentation should not blindly trust temporal color history until a real temporal contract earns authority."
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in a new issue