Fog

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
AReichl
Posts: 270
Joined: Wed Jul 13, 2011 2:34 pm

Fog

Post by AReichl »

Hi,
is it possible to create fog that gets denser in one direction?
I fear the answer - "write a shader".
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Fog

Post by CuteAlien »

Ah - can't answer - it would scare you.
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
AReichl
Posts: 270
Joined: Wed Jul 13, 2011 2:34 pm

Re: Fog

Post by AReichl »

Ahh - so scare me.
Is there a solution already?
I would need it for a space scene.
Think of flying into a nebula or the outer region of a giant sun.
Could it be solved with something like "volumetric lighting"?
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Fog

Post by mongoose7 »

You could simply use parallel transparent planes.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Fog

Post by CuteAlien »

Hm, yeah - a few planes with half-transparent textures could fake it maybe. Thought that would be slow. And for real fog that get's denser with depth and is not regular distributed I think shaders are just the easiest solution. Because I don't think there is a fast way from the fixed function pipeline to access and use the z-buffer in a fast way.
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
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Fog

Post by mongoose7 »

What's wrong with world coordinates?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Fog

Post by CuteAlien »

As said - it might work. Would have to experiment how it looks to be sure. But large half-transparent polygons are rather expensive, so I usually try to avoid getting those. And I think a shader for this is just easier. No node handling, no aligning to camera etc... just changing the pixel-color based on the depth of the z-buffer at that point.
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
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: Fog

Post by REDDemon »

there's a way to do that in fixed opengl pipeline, but that's a useless functionality since shaders can do more and better (gl fog coord: used to make fog with static geometries like valleys, swamps, mountains.). so no way in irrlicht (no sane engine support gl fog coord). And learn to write shaders it is worth it.
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Post Reply