Shaders!

Aceada8b6ecf98e52d68cb313fc7648a
0
cruppstahl 101 Jan 24, 2004 at 13:13

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

7 Replies

Please log in or register to post a reply.

22b3033832c5c699c856814b0cf80cb1
0
bladder 101 Jan 24, 2004 at 23:48

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…

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jan 25, 2004 at 17:38

shouldn’t your gf4 support shaders that run directly on the hardware ?

Aceada8b6ecf98e52d68cb313fc7648a
0
cruppstahl 101 Jan 26, 2004 at 19:25

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 =)

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jan 26, 2004 at 22:18

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

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jan 26, 2004 at 22:23

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

Aceada8b6ecf98e52d68cb313fc7648a
0
cruppstahl 101 Jan 27, 2004 at 17:53

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.

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jan 27, 2004 at 18:03

nebula was one of the refferences for me for learning for learning engine architecture