Trubble with drawing a hole..

Started by
10 comments, last by Jumpman 19 years, 10 months ago
Jumpman,

I don''t like the alphamap method at all. What if at a later date you decide to allow users to add decals or animated textures (eg something that glows) to your table?

Why wouldn''t you be able to use the stencil buffer for shadows later?

(main rendering)
* Clear your stencil buffer.
* Render the ''top'' of your holes into the stencil buffer
* Enable stencil buffer masking
* Render your main surface
* Disable stencil buffer masking
* render your ''hole'' models
* render the rest of your models.
(shadows)
* clear stencil buffer
* setup stencil mode for front faces
* render front volumes
* setup stencil mode for back faces
* render back volumes
* set stencil test function
* render full screen dark quad over your table.

Maybe I''ve missed something here, but that seems pretty easy?

do unto others... and then run like hell.
Advertisement
thanks frey.. I was beginning to think that the stencil buffer would be the only way..

i was thinking of just rendering the objects as I do normal but when I come to rendering the hole object..

turn on stencil buffer
enable write to stencil
write mask to stencil
enable read from stencil
render 3d model
turn off stencil.

that way I wouldn''t need to worry different height surfaces which can contain sunken objects.

I''ve not even looked at any shadow type techniques yet so I am unsure what you mean by the stencil front and back faces but thats sounds ok..

tommorow I should get chance to do all of this so hopefully it will work ok..

This topic is closed to new replies.

Advertisement