Archive for May 12th, 2008

12
May

Desaxismundi’s Velvet Shader

Desaxismundi was kind enough to let me see the code to his HLSL velvet surface shader. After a bit of fiddling around this morning, I was able to get it working in QC. Here is the result, applied to some imported 3D meshes, created with the Paul Bourke’s excellent supershape explorer application.



I’ve modified the code slightly, so it runs as two discrete functions, one in the Vertex Shader, and one in the Fragment Shader. You just have to call these functions from the main loop in the two shader programs. The VS function takes the normal as input and outputs the correct varyings to send to the FS, and the function in the Fragment Shader takes as input the various lighting parameters, and a texture input and returns the final lit colour of the fragment.

This should make it nice and easy to integrate into other shader code.




 

May 2008
M T W T F S S
« Apr   Jun »
 1234
567891011
12131415161718
19202122232425
262728293031  

Categories

Links

Blog Stats

  • 24,716 hits