Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to achieve something similar to nVidia's rain demo using only shader model 3.0 capabilities? If yes, could you point out a few documents/web resources that are suitable candidates and do not require a heavy programming load (e.g. not more than two hard weeks of programming for one single person)?

It would be nice if the answer could also contain a pro/con phrase for the proposed idea (e.g. postprocessing rain shader vs. a particle based effect).

share|improve this question
up vote 6 down vote accepted

The document just describes a particle system. Particle systems are nothing new, the difference with the demo is just that it uses the geometry shader to generate the geometry needed for the single partices. You can do the same on the CPU, the only drawback is that it is slower. Everything else can be done on SM 3.0 in a similar way as described in the document.

share|improve this answer
Yep, thanks, that's exactly what the article proposes. Let me rephrase it, is there any way to move the heavy stuff on the GPU, and not burden the CPU with context switches and individual updates? – teodron Sep 6 '12 at 6:55
I don't think that is possible. However there are other ways to improve the rendering performance, for example instead of having a texture of one drop have one with many drops and halfway align it to the camera. There are also quite a few tutorials how to write efficient particle system in DX9. – API-Beast Sep 6 '12 at 14:35
Yep, did the trick with groups of drops falling. It was 10% faster as compared to the post-processing filter (I think ShaderX has something on how to implement rainfall with a pixel shader post-processing step). Any idea whether alpha blending and alpha testing will also contribute in a speed-up if I renounce blending? – teodron Sep 6 '12 at 15:24
I'm going to analyse a third option anyway: moving textures on cone-like objects that wrap the camera and see whether alpha-testing works. Implementing the nVidia rain algorithm in DirectX9 is a big performance killer, unfortunately, hence my initial question. I guess one has to settle with the two approaches: pixel shader processor or particle system. – teodron Sep 7 '12 at 13:37

The basic answer is that once you have programmable shaders, everything is possible. It's not really valid to speak of DX9 or 11 "capabilities" in these terms as they can both achieve the same end result; the difference exists in the code that you need to write to get there. So what on DX9 may be a complex multipass algorithm which is heavy on draw calls and state changes could be expressed on 11 with a much simpler, cleaner and faster setup.

share|improve this answer
That's clear, however, is there an open door for optimizations here? I have extensively tried and benchmarked particle systems (on the CPU) and posprocessing using direct X9, the capability I'm talking about is the one to generate sprites on the fly and update the particle positions in a more parallel fashion, via the vertex shader, as done in that article. That should result in a sensible speed up. – teodron Sep 6 '12 at 6:54

Yes you can achieve this effect, however like I said to someone else, it isn't always better:

I suggest reading that, it is an interesting solution to a problem that he was having and may suit your game better

share|improve this answer
Its about rain drops on the screen, not rain. – Notabene Sep 5 '12 at 22:47
yeah, but you can possibly get away with not drawing them at all – CobaltHex Sep 6 '12 at 3:31
"Note how falling rain is not part of this list, so we never actually bothered to implement that." - unfortunately, I cannot get away with not tackling this central issue. Even more ironically, the people that want the effect are not focused on seeing "wetness" in that high detail for now (they have a wet surface already, fog and that's good enough for them). – teodron Sep 6 '12 at 6:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.