NokiMo
pucklovesgames
pucklovesgames

patreon


2d Raymarched Smoke FILES

Hi everybody,

I've been using UV offset by light direction in shaders for a while (most notably in the volumetric clouds shader), but I realised I never put together a simple raymarched smoke shader before, so here's one that you can play with and take apart.

It uses 2 shadow passes and 2 light passes, and blends between them based on the View dot Light Direction. VdotL outputs a gradient between -1 and 1, with -1 being when the light is perfectly behind the  smoke, 1 being when it's perfectly in front, and 0 when it's on the side. Combined with the tangent offset shading, this gives a decent idea of properly lit particles. This also blends in a SSS rimlighting when the light passes behind the smoke.

You can drop this down to only 1 pass of shadows and 1 of light if you want to optimise it a bit more, although depending on the texture you use it's not quite as soft. You can even drop the light pass altogether if you need to, and just add in a clamped VdotL to illuminate the front of the smoke.

This can also be combined with using layered noise (blending scaled copies of noise against itself and panning in different directions and speeds) to give more movement to the smoke, but I don't think it's necessary for the look I was going for here.

 The texture uses the A channel for smoke density (or opacity) and the B channel for some internal shading. You could probably do this all on one channel with the right texture. Something I'd like to add to it is to make use of the other two channels (R and G) for a cool dissipation effect, perhaps a swirl or inner fade as the smoke disappears.

Let me know if you have any questions! As always, thank you so much for your support.

2d Raymarched Smoke FILES

Related Creators