|
![](/i/fill.gif) |
>> 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.
If you wanted everything behind the ghost in the scene to be affected, then
I would set the "depth" to the furthest away point of the model (but maybe
experiemtn, I don't know how much of an effect it would have with
intersecting geometry).
> 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?
No, you should be able to control the RGBA render target and the
depth/stencil target separately. In DirectX you call
SetDepthStencilSurface. For my algorithm I assumed a single Depth/Stencil
surface would be persistent throughout the whole process,
> Secondly, I'm not sure what 7 is for at all.
It applies the shader as you requested here: "Basically, I want to apply a
screen-space shader but only to parts of the
scene occluded by a model which is in turn partially occluded by other parts
of the scene."
> Does step 8 mean "render the parts of the ghost you can't see through" or
> something?
I assume your actual ghost model has varying levels of transparency,
otherwise there would be no point in applying some shader to the scene
behind it. Step 8 means render the ghost as normal - of course the
background will already be distorted somehow due to Step 7.
Post a reply to this message
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
scott wrote:
> No, you should be able to control the RGBA render target and the
> depth/stencil target separately.
Oh, I see. OK.
> I assume your actual ghost model has varying levels of transparency,
In my imagination, it was totally transparent. Hence the subject line. But
OK, I see what you're saying here.
Again, thanks for the help! Seems what I was missing was the stencil buffer.
--
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) |