0
\$\begingroup\$

So, i am doing this for the first time. I have a lodded terrain that i would like shade deferred. I have built the g-buffer with positions/normals/albedo/depth and render vertices like I did before with forward rendering. World positions are calculated in the vertex shader from offsetting and scaling nodes (CDLOD after P. Strugar). I pass on world positions multiplied with view-projection-matrix and after rednring the position texture looks like this:

position texture - view space

For reference, the normals are like this: normal texture

All textures are RGB 16bit floats. The normals look all right. In positions, just like one would expect the quadrants move with the camera movement, the cross staying in the center. I have not yet started with the lighting pass, so my question is: does this look right ? I expected smoother transitions and not really white. Or should i use world positions (then everything is white in the position texture) and divide by world size to stay in clamped 0..1 land ?

Again, I haven't changed the vertex shader from forward rendering, and the fragment is trivially rendering to the g-buffer.

\$\endgroup\$
2
  • \$\begingroup\$ Usually we don't write positions into the g-buffer, since they're easy to reconstruct from depth alone when we need it, freeing up 2 channels. The space you choose to do your rendering in is up to you. \$\endgroup\$
    – DMGregory
    Nov 28 '20 at 23:33
  • \$\begingroup\$ @DMGregory: ok, thanks, I searched and found out about reconstruction of world pos from depth. \$\endgroup\$
    – user144188
    Nov 29 '20 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy