Finally nailed how to capture and render the depth buffer

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Finally nailed how to capture and render the depth buffer

Post by revelator »

Took quite some work but we have it down now :)
With some help from SteveL at the darkmod forums we finally nailed how to access and render to the depthbuffer in vanilla,
as a result a whole slew of new options turned up, not only related to SSAO but also soft particles, and fixing corruption on water reflections.
The thread covering this over at the darkmods forum are literally buzzing with activity :) and SteveL has allready made several demos to show of the new effects.

For a walkthrough on how to get the depthbuffer code in vanilla look at my revelation test thread in the general forums (somewhere close to the end of the thread).
Ill post a cleaned up tutorial soon when i get some free time :)
Productivity is a state of mind.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Finally nailed how to capture and render the depth buffe

Post by Baker »

Now that is some interesting stuff :D
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Finally nailed how to capture and render the depth buffe

Post by revelator »

:) many sleepless but productive nights.
Next step FBO's and getting rid of the old opengl 1.4 calls.
Productivity is a state of mind.
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Finally nailed how to capture and render the depth buffe

Post by revelator »

Still at it though steve is not home atm, he still posts new ideas on how to use the new functionality :)
Also looking at other options atm. Parralax occlusion mapping / splitting up the interactions / programmable ambient lighting.
Problem with splitting up the interactions might break compatibility with vanilla though so we have to supply new shaders in case we want to keep compatibility :)
vanilla will look very much improved as a result though.

We kinda stepped back from GLSL atm as ARB2 works just fine with the current options, its still planned sometime though.
Might have to learn how to write material shaders so i can test out stuff :S damn i hope im not to old to learn new stuff heh.
Productivity is a state of mind.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Finally nailed how to capture and render the depth buffe

Post by Baker »

Code: Select all

!!ARBvp1.0
OPTION ARB_position_invariant;
MOV result.texcoord, vertex.texcoord;
END

!!ARBfp1.0
PARAM clipPlanes = { 0.4, 350.0 };
TEMP dpth, col, rng;
TEX dpth, fragment.texcoord, texture[0], 2D;
ADD rng.x, clipPlanes.y, -clipPlanes.x;
MUL col.x, dpth.x, rng.x;
ADD col.x, -col.x, clipPlanes.x;
ADD col.x, col.x, clipPlanes.y;
RCP rng.x, col.x;
MUL col.x, rng.x, clipPlanes.x;
MUL col.x, col.x, 2.0;
MOV result.color.r, col.x;
MOV result.color.g, col.x;
MOV result.color.b, col.x;
MOV result.color.a, 1.0;
END
Any screenshots of what this looks like, say in gray-scale?
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Finally nailed how to capture and render the depth buffe

Post by revelator »

Productivity is a state of mind.
jitspoe
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: Finally nailed how to capture and render the depth buffe

Post by jitspoe »

revelator wrote:http://www.youtube.com/watch?feature=pl ... vdzFWCGpKA

steves demo :) look at the tablet ;)
That's pretty awesome!
Tr3B
Posts: 15
Joined: Tue May 13, 2014 2:24 pm

Re: Finally nailed how to capture and render the depth buffe

Post by Tr3B »

Couldn't you just rip the _currentDepth code from the BFG renderer?
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: Finally nailed how to capture and render the depth buffe

Post by revelator »

i actually based parts of my code on the bfg version allthough i had to hunt down where things would fit in the old vanilla render, some parts are rather different in BFG.
Latest code seems to work quite nicely allthough i really need someone who can rewrite sikkpins SSAO shader to make use of the new functionality.
But atleast my work is now part of the darkmod engine :) so i might get lucky.
Productivity is a state of mind.
Post Reply