-
Junior Member
Regular Contributor
Linearized depth for shadowmap
Hello,
for improving precision of my shadow maps I would like to use linear depth distribution of the z-buffer. I have tried to modify the projection matrix like this, also playing around with different signs:
mp[10] = 1 / (far - near)
mp[14] = -n / (far - near)
Additionally I am premultiplying the transformed z with w in the vertex shader but it doesn't seem to work. Has anyone done this before?
Thanks a lot!
-
Junior Member
Regular Contributor
Re: Linearized depth for shadowmap
I think you shouldn't modify the projection matrix at all as the outcome of multiplying the vertices with this matrix will be used for proper clipping. Changing it will only get you into trouble later on. Instead compute the linear depth value in the vertex shader based on camera and vertex position and store this into a floating point render target. I think with proper scaling into the [0, 1) range it would also be possible to use an RGBA8 target with some packing and unpacking.
[ www.trenki.net | vector_math (3d math library) | software renderer ]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules