Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Depth Test and Early ray termination


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 happymonkey   Members   -  Reputation: 108

Like
0Likes
Like

Posted 05 September 2012 - 02:41 PM

I am in the process of implementing early ray termination using multipple interation. My colde is like this:

glClearDepth(1.0); //Set all the depth to the maximum
glBindFramebuffer(GL_FRAMEBUFFER, _framebuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex_dst, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, _vol_buffer_tex_mult_depth, 0);
glClear(GL_DEPTH_BUFFER_BIT);
glDepthMask(GL_TRUE);
glDepthFunc(GL_ALWAYS);
///////////////////////Shader to change the depth, draw a quad
glBindFramebuffer(GL_FRAMEBUFFER, 0);

///////////////////////////////////////////////////
glBindFramebuffer(GL_FRAMEBUFFER, _framebuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex_dst, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, _vol_buffer_tex_mult_depth, 0);
glDepthMask(GL_FALSE); //Do not change the depth value
glDepthFunc(GL_LEQUAL);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

/////////////////////Shader to change the color, draw a quad
glBindFramebuffer(GL_FRAMEBUFFER, 0);


I use: glClearDepth(1.0); glDepthFunc(GL_ALWAYS) to make the shader update the depth buffer.
It works right. The problem I met is when I change glClearDepth(1.0) to glClearDepth(0.0), there is no display anymore. It seems
that, at this case, the first part will fail in the depth test, why? I already used glDepthFunc(GL_ALWAYS) which should pass the test
at anytime. Thanks for any hint.

Sponsor:

#2 Lauris Kaplinski   Members   -  Reputation: 841

Like
0Likes
Like

Posted 07 September 2012 - 07:44 AM

Are you sure it is not driver problem?
I have encountered various kinds of erratic driver behaviour related to z-tests. I suspect these were mostly caused by overoptimizing early z-culling.

Edited by Lauris Kaplinski, 07 September 2012 - 07:45 AM.

Lauris Kaplinski

First technology demo of my game Shinya is out: http://lauris.kaplinski.com/shinya
Khayyam 3D - a freeware poser and scene builder application: http://khayyam.kaplinski.com/




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS