question about deferred rendering

Started by
11 comments, last by Yours3!f 12 years, 6 months ago
OMG finally after 3 days I seem to be solving it, I just didn't need to set the glTexParameteri(...); stuff before rendering (see updated code above), but i did need it at texture creation. My lighting still sucks though :) But I guess I can solve it now.

EDIT: don't forget that you have to pass the inverse of the projection matrix which you use at rendering the scene (the perspective), not the one (the orthographic) that you use when doing lighting
Advertisement
Hey[color="#1c2837"] Yours3!f,

Could you post a picture of what your 'depth' view looks like? Mine is a white screen :( and I want the grey scale kinda scene, and I noticed that you display the depth like this:

[color="#1c2837"]v4_color = vec4(vec3(depth), 1.0);

[color="#1C2837"]I do this:

depth.rgb = saturate(depth);
depth.a = 1.0f;



[color="#1C2837"]I'm not at the computer at the moment, so can't try it your way, but yeah do you get a 'grey scale' view, indicating 'white = far away' and 'black = near'? Which is what I'm after instead of plain white :(
@Daniel_RT

see this topic of mine:
http://www.gamedev.net/topic/609271-depth-reconstruction-not-working/

(it includes the source code)

To answer your question, depth can look like a grayscale image with black = near and white = far, and it can look all black except getting dark at the end of the frustrum.

The first one (grayscale image) indicates that you are storing non-linearized depth so values will range from 0.0 ... far clip distance, so from black to white.

The second one indicates that you are storing values that range from 0.0 ... 1.0, which means that it will be black near you and it will only be brighter from very far from you (in my case 10000 units from me). you achieve this by dividing the depth value with the far clip plane's distance. This way of storing depth is called storing normalized depth.

I recommend this tutorial on the theoretical basis of this topic:
http://mynameismjp.wordpress.com/2010/09/05/position-from-depth-3/

for the GLSL implementation take a look at my topic (the last but one post). I have to add that the source there is not the best because it doesn't do depth testing, which means that your scene will look ankward, but after the initial implementation of depth reconstruction you can easily implement depth testing by using method 3 from MJP's tutorial (+ this adds some optimization).

oh and dont resurrect old topics :)

This topic is closed to new replies.

Advertisement