Drop of water NV30 shader
Version 1.0 (updated 08/10/2002)
The new improved version of this shader is fully explained in the ShaderX2 - Tips and tricks book.
This page only contains information on the very first version of the shader that was created for the shader contest on www.cgshaders.org.
What is it ?
This is my first shader for the NVidia NV30 GPU (that has not been releasedyet ...). It was developped using the NV30 emulation driver. The ideawas to create a "drops of water" effect.The effect is divided into the following parts:
- a fragment program that renders drops and material:
- the first part of the fragment program that uses indirection grids to draw drops at the right position and is also able to scale and rotate drops,
- the second part of the fragment program that renders the surface using a texture of wet areas (created using a pbuffer - see below) to modulate diffuse and specular,
- the third part of the fragment program that renders drops with specular and refraction.
- a PBuffer used to create a texture that represents wet areas (the darker areas).
Why is it interesting ?
- the only thing that is rendered is one quad !
- the drop shape is stored in a texture. Drops are reallyinstanciated by the fragment program using indirection gridscomputed by the program. The cost in terms of memory is very low. Iinsist on the fact that drop rendering is not done in thepbuffer. The pbuffer is only here for the rendering of wet areas. Soeach drop is scaled and rotated but keeps a high resolution (given bythe size of the drop texture - not by the resolution of the materialtexture).
- drops are rendered with specular and with a refraction approximation (magnification effect).
- the "texture" created on the fly by the fragment program is tilable !
- drops can be inserted at an arbitrary position with an arbitrary scaling and rotation. For now position, rotation and scaling are updated in a way to obtain drop of water behavior.
Anything to download ?
You can download binaries and source code on www.cgshaders.org. Please apologize for the lack of explanations in the source code, but this shader wascoded for the second CG contest and I "discovered" the NV30 three daysbefore the dead-line. I hope that I will find some time to create atutorial fully explaning this effect ... if someone is
;))
just a precision: I did not win, so feel free to send me a NV30 graphicboard :))
Here are some movies of the shader rendered using the NV30 emulationdriver. All movies are encoded using DivX 5.0.2. Little movies are better with a 200% zoom factor.
return to main page ...