TGC Codebase Backup



BumpReflectHLSL shader in DBPro by Neophyte

1st Apr 2004 14:12
Summary

This is the BumpReflectHLSL shader with the DBPro source to run it. You'll need to get the required media from FX Composer. http://developer.nvidia.com/object/fx_composer_home.html



Description

This is the source to the shader tutorial entitled THE FX FILE FORMAT - PART ONE - BUMPREFLECTHLSL SHADER IN DBPRO. It contains the shader along with some DBPro source to run it.

You can just unzip the file and open up the source and hit F5. If you card is capable of running the effect you should see a well lit sphere rotating on the screen.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    load effect "BumpReflectHLSL.fx",1,1
make object sphere 1,10,100,100
set object effect 1,1
PERFORM CHECKLIST FOR EFFECT VALUES 1

null = make matrix4(1)
null = make matrix4(2)

world matrix4 1
view matrix4 2

multiply matrix4 1, 1, 2
null# = inverse matrix4(1,1)

null# = inverse matrix4(2,2)



set effect constant float 1, "bumpHeight", 0.5
set effect constant matrix 1,"viewInverseMatrix", 2
set effect constant matrix 1,"worldViewMatrixI",1

do

remstart
  FOR C=1 TO CHECKLIST QUANTITY()
   PRINT "Name:";CHECKLIST STRING$(C);"  Vartype:";CHECKLIST VALUE A(C);"  Hook:";CHECKLIST VALUE B(C)
  NEXT C
remend
   `Spin our object around to get a good look at it.
   yrotate object 1, object angle y(1) + 0.1

loop