Non-volumetric smoke effect in pixel shader

Started by
6 comments, last by Meltac 11 years, 8 months ago
Hello again

I'm looking for a simple way to create a half-decent smoke effect purely in a pixel shader, some kind of 2D post-process fake effect. Nothing volumetric or particle-based, but something that can be implemented in HLSL only within a single pass pixel shader.

I know that this is perfectly possible because I have seen it on the web a while ago but unfortunately didn't find the source again.

Could anybody provide either some working example code or link(s) to website(s) elaborating an approach for such an effect?

Thanks in advance.
Advertisement
I'm not too familiar with these techniques, but if you do not want to use volumetric or particle based techniques, would a billboard work?
If you have a texture atlas for each frames of the smoke effect, you could loop it on a billboard.

By billboard, I mean a textured quad that always faces the camera. It won't look as good as the other techniques (and it's probably as expensive), but it will be achievable in a single pass.
I'm pretty sure I have seen volumetric fog/smoke done in a single pass shader. But if that's not your thing.... billboarding's a possibility, but it looks the same from all angles. I'd suggest a 3D-aware technique that doesn't get too crazy, e.g. no raycasting etc. I have seen techniques (I forget the terminology) which interpolate between x billboards depending upon angle.

This link gives an approach of creating clouds with a feeling of volume using a collection of billboards and a light absorption model:
http://rafaeltorchelsen.files.wordpress.com/2010/10/sbgames_2005_simulacao_em_tempo-real_de_nuvens_utilizando_billboards.pdf

The frame-rates sound low, but are for hundreds of clouds.
Thanks guys. Unfortunately billboarding is not an option in my case because I don't have access to any additional textures from that particular shader. Nor is any 3D / voluminous technique, because I need to do this in a pure 2D pixel shader.

Let me explain what I'm after. I'm rendering sun shafts as a post process onto the final picture in the shader that is responsible for the post processing part. The sun shafts are purely 2D, I'm using this GPU Gems approach (Part 13.4 The Post-Process Pixel Shader): http://http.develope...gems3_ch13.html

Now inside of buildings I wanna add some animated smoke/fog/dust effect to the sun shafts, like the well-known effect of dispersed dust particles being lit by the shafts' light. I've got everything ready to do it except the computation for generating that smoke/dust effect. I've tried some plasma computation that I found instead but it doesn't look good.
I don't have access to any additional textures from that particular shader
That's going to make it very hard/computationally-expensive then... Usually you want to get an artist to paint some smoke/dust textures in advance, or run an expensive volumetric simulation in advance and render it to textures.

If you can't use a smoke texture, then you've got to try and procedurally generate one in your pixel shader, using random numbers and/or noise functions... However, most RNG/noise functions are too expensive to implement in a pixel shader without loading some pre-computed values out of a texture!
Actually I was thinking of some noise-function-thing (Perlin or whatever) already when opening this topic. As it seems I didn't make myself clear enough. I was hoping somebody could point me to a more or less ready-to-use sample, instead of just repeatedly telling me what I already know - that you "normally" would do this by some volumetric or particle-wise approach and that it won't be easy without.

But thanks anyway for trying to help.

instead of just repeatedly telling me what I already know - that you "normally" would do this by some volumetric or particle-wise approach and that it won't be easy without
I wasn't saying that it will be hard without volumetrics or particles -- but that it will be hard without textures.
Where does this restriction come from? Are you modding an existing game or something?

Where does this restriction come from? Are you modding an existing game or something?


Yes, exactly. S.T.A.L.K.E.R. Shadow of Chernobyl, built on X-Ray 1.0 Engine. Awesome game, but very cumbersome engine. I have only access to some specific vertex and pixel shaders, but not all. I can't make new shaders or change the setup (e.g. texture assignment) of the existing ones, nor can I do any DirectX API function call (D3D...), only pure HLSL with the existing assigned textures etc.

This topic is closed to new replies.

Advertisement