|
![](/i/fill.gif) |
scott wrote:
> 1. Set render target to temporary one
> 2. Render scene without ghost normally, but set stencil writes to always 0
> 3. Render ghost geometry without writes to RGBA, but stencil write of
> always 1
> 4. Switch the render target to the actual back buffer
> 5. Render a full-screen quad to simply copy over the entire temp buffer
> RGBA contents
> 5. Set your special effect pixel shader
> 6. Set stencil pass function to equal 1
> 7. Render a full-screen quad at the depth of the ghost (this will avoid
> affecting anything infront of the ghost)
> 8. Render the ghost normally
I was following you up until 7. First, since the ghost is a model, I'm not
sure what the single "depth" would be. But OK, assuming I'm not actually
intersecting geometries with the ghost, I can work with that. However,
doesn't step 5 destroy the original depth information? That was the step I
couldn't figure out how to get around. If I've turned the 3D models and such
into a flat quad, I've lost the original depth information there.
Secondly, I'm not sure what 7 is for at all. Maybe you're thinking something
different for "render ghost" than I am? Does step 8 mean "render the parts
of the ghost you can't see through" or something? Do you mean that 7 will
combine the stencil buffer with the depth buffer somehow? Wouldn't the
stencil buffer already be 0 where there's something occluding the ghost?
> Sure, if you write depth on purpose to a special render target, what is
> not normally available is the "internal" depth/stencil buffer that the
> GPU uses to do depth and stencil tests during normal rendering. So
> you're usually having to duplicate the depth buffer if you want to use
> it in a non-standard way.
True. I think keeping two copies of the depth buffer is less overhead than
rendering all the geometry twice, tho. That's really the bit I'm trying to
avoid.
--
Darren New, San Diego CA, USA (PST)
Serving Suggestion:
"Don't serve this any more. It's awful."
Post a reply to this message
|
![](/i/fill.gif) |