PDA

View Full Version : Shaders!


cruppstahl
01-24-2004, 06:13 AM
Hi gurus!


i want my engine to support shaders. it is the first time that i get in touch with shaders, and i am not sure what kind of features i will support... how do your shader systems work? can you guys post examples of your shaders?

Here's mine:


# this is just a pseudo-grammar-language...
# comments start with '#' :)

depthvalue ="never"|("none"|"always")|"less"|"lequal"|"equal"|"gequal"|
"greater"|"notequal"

alphavalue ="never"|("none"|"always")|"less" ref |"lequal" ref|
"equal" ref|"gequal" ref| "greater" ref|"notequal" ref

"shader" name
{
"cull" = "front"|"back"|"none" # default=front
"fog" = bool # default=0
"type" = "sky"|"water"|"none" # default=none

"layer" level { # level ranges from 0..7
"depthfunc" = depthvalue # default=always
"depthwrite" = bool
"alphafunc" = alphavalue # default=always
"blendfunc" = blendvalue

"texturemap" = name
"shininess" = 0..128
"specular" = 0..255 0..255 0..255 0..255 # default 0 0 0 255
"emissive" = 0..255 0..255 0..255 0..255

"type" = "decal"|"detail"|"none"|"bumpmap"|"envmap" # default=none
}
}


a shader can have several layers of textures, each layer with his own material, depth- alpha- and blend-function. it is based on the tutorials at http://www.racer.nl/reference/shadereng.htm.

that's it, comments are welcome!

Chris

bladder
01-24-2004, 04:48 PM
you know at first glance I though you were talking about vertex and pixel shaders, you know the programmable pipeline stuff that's all the craze these days...

anubis
01-25-2004, 10:38 AM
shouldn't your gf4 support shaders that run directly on the hardware ?

cruppstahl
01-26-2004, 12:25 PM
ok, sorry :blush: i meant... err... shaders! Well, Quake3-shaders, or just look at the link in my first post to find out what i mean. i DONT mean vertex or pixel shaders =)

anubis
01-26-2004, 03:18 PM
come to think of it the nebula device from www.radonlabs.de used such a shader system. maybe you should have a look at their implementation. i think it supported about the same featureset as yours

anubis
01-26-2004, 03:23 PM
how would you be realizing things like bumbmapping ???
i think i would start out with a much more restricted featureset and expand it from there on. i suppose you will have to solve a few inital problems regarding things like multi-pass situations, etc. after you have built a solid base more effects will become easier to implement

cruppstahl
01-27-2004, 10:53 AM
yes, i'll definitely start with the basic features, and then go on to more advanced stuff. i have no idea how to implement bump mapping, but it looks cool, so i added it :)

However, the multipass thing nearly works...

i will have a look at nebula.

anubis
01-27-2004, 11:03 AM
nebula was one of the refferences for me for learning for learning engine architecture