Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Non-volumetric smoke effect in pixel shader


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Meltac   Members   -  Reputation: 440

Like
0Likes
Like

Posted 30 July 2012 - 02:30 AM

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.

Sponsor:

#2 french_hustler   Members   -  Reputation: 384

Like
0Likes
Like

Posted 30 July 2012 - 03:18 PM

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.

#3 jefferytitan   Crossbones+   -  Reputation: 2246

Like
0Likes
Like

Posted 30 July 2012 - 04:48 PM

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.

#4 Meltac   Members   -  Reputation: 440

Like
0Likes
Like

Posted 31 July 2012 - 12:45 AM

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.

Edited by Meltac, 31 July 2012 - 12:47 AM.


#5 Hodgman   Moderators   -  Reputation: 31926

Like
0Likes
Like

Posted 31 July 2012 - 01:00 AM

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!

#6 Meltac   Members   -  Reputation: 440

Like
0Likes
Like

Posted 31 July 2012 - 07:07 AM

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.

#7 Hodgman   Moderators   -  Reputation: 31926

Like
0Likes
Like

Posted 31 July 2012 - 07:19 AM

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?

#8 Meltac   Members   -  Reputation: 440

Like
0Likes
Like

Posted 31 July 2012 - 08:44 AM

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.

Edited by Meltac, 31 July 2012 - 08:45 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS