#The normals in the GBuffer appear wrong, but the debugger shows they are correct. Why is that?

1 messages · Page 1 of 1 (latest)

left coral
#
  • custom pass (C#)

rayTracingShader.SetTexture("_CameraNormalTexture", ctx.cameraNormalBuffer);

  • shader part

uint2 normalPixel = uint2(pixel.x, resolution.y - 1 - pixel.y);
float4 encodedNormal = _CameraNormalTexture.Load(int4(normalPixel, 0, 0));
RenderTarget[pixel] = encodedNormal;

lavish mural
#

This seems like a very weird way to sample scene normals... 🤔

Mind to explain the reasoning behind that calculation?

left coral
lavish mural
#

How do you calculate the pixel value?

left coral
lavish mural
#

And the resolution?

left coral
lavish mural
left coral
#

I've been sitting with chat gpt and grok for over 5 hours now trying to figure out how to properly sample the gbuffer from a tracing shader. I've completely lost all understanding at this point.

lavish mural
#

I can only assume that using pixel as an indexer I to the render target might be incorrect. They do it differently in the docs I think.

left coral
wind river
left coral
#

after 8 hours

#

i want to cry....

#

@wind river you are my hero

left coral
#

@wind river

I'm trying to get the world position of a pixel using a depth map. I'm comparing the result with ray tracing output and getting position discrepancies when rotating the camera. is the depth map guaranteed to be rendered in the same frame?

wind river
left coral