Quake 3-Like Material Definitions
Posted: Sat Mar 08, 2008 9:43 pm
To easily extend effects and make things more dynamic, I suggest adding a material definition language (kinda like Quake 3 shaders). It should work like this:
* Material name should match the texture name that the world uses without the extension. Eg For "block.bmp" the material name would be "block". This way when the world renders, it checks for the existence of a material. If one exists, it uses the material definition instead of the single texture. If one does not exist, it should use standard Genesis texturing.
* A material defintion would look something like this:
Of course there is room for expansion such as attaching a Simkin script to do animation or collision sounds, flags for shadowing, or even adding physics values such as friction and mass to a poly. All 4 fields are not necessary. It should only deal with the fields that exist. For example, if bumpmap is missing, the engine should be smart enough to use standard texturing instead of bumpmapping.
I have a lexical analyzer and a parser that I wrote that can assist you.
* Material name should match the texture name that the world uses without the extension. Eg For "block.bmp" the material name would be "block". This way when the world renders, it checks for the existence of a material. If one exists, it uses the material definition instead of the single texture. If one does not exist, it should use standard Genesis texturing.
* A material defintion would look something like this:
Code: Select all
material blocks.bmp
{
texture blocks.bmp
alphamap blocks_a.bmp
specularmap blocks_s.bmp
bumpmap blocks_b.bmp
// This is a comment
mass 1.0
friction 0.1
receiveshadows true
}
I have a lexical analyzer and a parser that I wrote that can assist you.