How do I exclude skydomes from stencil buffer drawing?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
dart_theg
Posts: 77
Joined: Sun Dec 29, 2024 3:13 am

How do I exclude skydomes from stencil buffer drawing?

Post by dart_theg »

Title. I haven't found a solution online for this...
CuteAlien
Admin
Posts: 9988
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How do I exclude skydomes from stencil buffer drawing?

Post by CuteAlien »

Easiest is probably remove that node from the scene and just call render on the node afterwards directly.
But may depend a bit on what this is about exactly. Generally nothing should draw to the stencilbuffer in Irrlicht except if it has a shadownode attached.
And rendering last comes with a downside that it will conflict with anything transparent in front of it. So if you have transparent stuff it needs another solution. For example splitting scene into several scenemanagers for rendering so you can do solid - skydome - transparent and flip stencil drawing in between. Or maybe use the lightmanager to flip that or something. There's a reason shadows have their own render-stage.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Noiecity
Posts: 372
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

Re: How do I exclude skydomes from stencil buffer drawing?

Post by Noiecity »

CuteAlien wrote: Thu Mar 19, 2026 12:02 pm Easiest is probably remove that node from the scene and just call render on the node afterwards directly.
But may depend a bit on what this is about exactly. Generally nothing should draw to the stencilbuffer in Irrlicht except if it has a shadownode attached.
And rendering last comes with a downside that it will conflict with anything transparent in front of it. So if you have transparent stuff it needs another solution. For example splitting scene into several scenemanagers for rendering so you can do solid - skydome - transparent and flip stencil drawing in between. Or maybe use the lightmanager to flip that or something. There's a reason shadows have their own render-stage.
For lightmaps you need 2 uvmaps, right? (it can be the same duplicate), I think b3d has the ability to export up to 8 uvmaps
Irrlicht is love, Irrlicht is life, long live to Irrlicht
CuteAlien
Admin
Posts: 9988
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How do I exclude skydomes from stencil buffer drawing?

Post by CuteAlien »

Not sure why you are suddenly asking about lightmaps (thread is about stencil buffers and skydomes)? Or did you misread lightmanager? Anyway to answer - with default Irrlicht materials you need 2 textures. I don't remember if they need different uv's or not - would have to experiment.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Noiecity
Posts: 372
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

Re: How do I exclude skydomes from stencil buffer drawing?

Post by Noiecity »

CuteAlien wrote: Thu Mar 19, 2026 6:51 pm Not sure why you are suddenly asking about lightmaps (thread is about stencil buffers and skydomes)? Or did you misread lightmanager? Anyway to answer - with default Irrlicht materials you need 2 textures. I don't remember if they need different uv's or not - would have to experiment.
Oh damn, I read wrong, I swore I read lightmaps, what's wrong with me, anyway, thanks for the response, I leave ashamed and humiliated lmao
Irrlicht is love, Irrlicht is life, long live to Irrlicht
CuteAlien
Admin
Posts: 9988
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How do I exclude skydomes from stencil buffer drawing?

Post by CuteAlien »

No worries :-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
dart_theg
Posts: 77
Joined: Sun Dec 29, 2024 3:13 am

Re: How do I exclude skydomes from stencil buffer drawing?

Post by dart_theg »

Sorry! I realized that adding a shadow to a mesh seemingly made my quad that I’m rendering my output to also darken. Seems like the quad/everything gets a shadow until a light is placed? Not sure.
CuteAlien
Admin
Posts: 9988
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How do I exclude skydomes from stencil buffer drawing?

Post by CuteAlien »

Shadows should affect everything inside the shadow volume. I guess with infinity for shadows set to a value around or larger than the camera far-plane the skydome will also get a shadow maybe (the skydome is slightly less than the far-plane). I haven't really had that situation yet, but it would make sense. Sound actually tricky to avoid as skyboxes are rendered first. Do you have an example for this by any chance?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply