Point sprites are awesome. I love them. Simple, fast, efficient and beautifully.
The main thing that first got me hooked on DirectX, since OpenGL was taking forever to come with a point sprite extension.
Anyway,
Lighthouse 3D's tutorial on billboards,CodeSampler's tutorial on ARB Point Sprites and an explanation of the ARB extensions should come in handy for anyone trying to implement a particle system.
Some use of alpha blending will obviously help too. (See this description of OpenGL Blending modes). I'm not a fan of the OpenGL blending modes either (DirectX gives far more control), so using pixel shaders is probably for the best.
Ofcourse, that will look dated (unless you push into the millions of particles, which you easily can with the wonderfully fast point sprite extensions). So to make them look good and blend soft particles will really help. The nVidia website has some examples, and there is a presentation from Petter Börjesson and Mattias Thell Chalmers Advanced Computer Graphics course on Soft Particles. Volumetric particles will take it up another notch, but requires non-trivial effort.. (well, actually you just raytrace a sphere which is pretty easy, but does take a bit to set up)
Of course to do that you need access to the Z buffer, which is actually quite straight forward in OpenGL using the ARB_depth_texture extension:
glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
zSize, zSize, 0,
GL_DEPTH_COMPONENT,
GL_UNSIGNED_BYTE, NULL);
Then just copy the buffer to your zbuffer texture:
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, zSize, zSize);
(Disable color writes and shading for speed: glShadeModel(GL_FLAT); glColorMask(0, 0, 0, 0);)
See this tutorial on shadow mapping with the zbuffer.
Here are some resources on implementing rain effects, an amazingly wonderfully convenient database of rain streaks, and some rain code to go with it.
Enjoy your particle effects!
Nanoscale Imaging and Control of Altermagnetism in MnTe
57 minutes ago
No comments:
Post a Comment