-
shading program the fiddles with Z values
Hi all,
i'm looking for an example of a shader program that changes the depth values, and also would appreciate a short explanation what kind of effects this can produce.
thank you!
-
Re: shading program the fiddles with Z values
void main() { gl_FragColor = vec4(1,1,1,1); gl_FragDepth = 1; }
This function sets the color to white and the depth to 1. Not terribly interesting but I hope you'll get the idea.
-
Re: shading program the fiddles with Z values
ok 10x but i need i was hoping for something more meaningful -
and also I meant some program the utilizes the incoming fragment's Z value and not setting the output FragDepth.
-
Advanced Member
Frequent Contributor
Re: shading program the fiddles with Z values
gl_FragDepth is read and write variable in fragment shader. How is going to use it is limited by your imagination.
-
Member
Regular Contributor
Re: shading program the fiddles with Z values
Keep in mind that setting gl_FragDepth may have some performance implications, because early-z and other optimizations can no longer predict the z value (in the same way that happens with alpha-testing).
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