Horde3D

Next-Generation Graphics Engine
It is currently 22.11.2024, 13:31

All times are UTC + 1 hour




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: 15.07.2008, 10:37 
Offline

Joined: 09.05.2008, 19:02
Posts: 18
I want to be able to write to the depth buffer and have it act as if I where rendering a normal object. However I wish for it not to look at the depth buffer when actually rendering the objects.

I want to do this so as I can render particles and use deferred shading, I know that it would be possible to do this using two pass's of my particle system. One with the depth testing on and one with it off, but I feel that this is very wasteful and hope there is a method which could allow me to do it in a single pass.

If there is a better method of rendering particles and other translucent objects with deferred shading I would like to know.

Thank you


Top
 Profile  
Reply with quote  
PostPosted: 15.07.2008, 14:42 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
lachlanmcdowall wrote:
I want to be able to write to the depth buffer and have it act as if I where rendering a normal object. However I wish for it not to look at the depth buffer when actually rendering the objects.
I don't quite understand your question there - you want to write to the depth buffer, but turn off depth testing? That isn't hard, but it doesn't sound quite like what you are asking. Also beware that particles will appear that should be behind other objects.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 15.07.2008, 14:54 
Offline

Joined: 22.05.2008, 18:30
Posts: 37
From what I understand of what he's upto at the moment... basically he wants to use it like a temporary buffer and write information to it, but only read it from another buffer, rather than the screen.

Not sure if that makes it sound much clearer, hehe


Top
 Profile  
Reply with quote  
PostPosted: 15.07.2008, 16:01 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
stuckie wrote:
From what I understand of what he's upto at the moment... basically he wants to use it like a temporary buffer and write information to it, but only read it from another buffer, rather than the screen.
You can attach a depth buffer to a render target, and then bind it as a texture during another pipeline stage, certainly - I do this for atmosphere rendering.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 15.07.2008, 20:46 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
As swiftcoder already states it's no problem to use a depth buffer as render target. I have already done this for an ssao test some months ago.


Top
 Profile  
Reply with quote  
PostPosted: 16.07.2008, 09:34 
Offline

Joined: 09.05.2008, 19:02
Posts: 18
Yes I have the same render target being used, it is just that it takes two pass's for both the graphical data and depth data to be used as when you set writeDepth="true" this also results in it using the depth buffering when rendering.
Code:
<Stage id="Translucent">
   <SwitchTarget target="PARTICLES" />
   <ClearTarget depthBuf="true" colBuf0="true" />
   <DrawGeometry context="TRANSLUCENT" class="Translucent" />
   <DrawGeometry context="TRANSLUCENT_DEPTH" class="Translucent" />
</Stage>


is what my pipeline looks like at present, the TRANSLUCENT context is the same as from the examples and the TRANSLUCENT_DEPTH simply does nothing in the fragment shader but has writeDepth="true". This render context then gets combined with the screen buffer using a fragment shader to test its depth values against the GBUFFER. This works but seems wasteful having to 'render' all the particles twice


Top
 Profile  
Reply with quote  
PostPosted: 16.07.2008, 11:13 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
lachlanmcdowall wrote:
Code:
<Stage id="Translucent">
   <SwitchTarget target="PARTICLES" />
   <ClearTarget depthBuf="true" colBuf0="true" />
   <DrawGeometry context="TRANSLUCENT" class="Translucent" />
   <DrawGeometry context="TRANSLUCENT_DEPTH" class="Translucent" />
</Stage>
I am pretty sure that that gives no advantage over rendering once, with depth writes on. Why exactly do you not want depth testing enabled when rendering the particles? That said, there should be a way to turn off just the depth test, but I don't know a horde option for it offhand.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 16.07.2008, 15:33 
Offline

Joined: 09.05.2008, 19:02
Posts: 18
swiftcoder wrote:
I am pretty sure that that gives no advantage over rendering once, with depth writes on. Why exactly do you not want depth testing enabled when rendering the particles? That said, there should be a way to turn off just the depth test, but I don't know a horde option for it offhand.


I want depth testing turned on when rendering them over the rest of the scene so as the particles behind walls, floors etc will not be rendered but those in front will but will also take into account alpha blending


Top
 Profile  
Reply with quote  
PostPosted: 16.07.2008, 18:00 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
lachlanmcdowall wrote:
I want depth testing turned on when rendering them over the rest of the scene so as the particles behind walls, floors etc will not be rendered but those in front will but will also take into account alpha blending
So you want to turn depth writes off when rendering the blend? Is it really necessary? If you leave depth writes on, you have the depth buffer filled out for your next pass. You may have a few artifacts due to incorrect ordering, but it is probably worth taking a look to see how obvious they are.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
PostPosted: 16.07.2008, 21:21 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Lachlan, I still don't quite understand what eactly you want to do. But one thing I'm aware of that is still missing is a shader param to configure the depth test (not mask).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group