Game Development Community

Trees problem - Not Rendering

by Deception Games · in Torque Game Engine Advanced · 06/13/2007 (9:09 pm) · 3 replies

Thinking something somewhere is turned off, can someone point me to right button please

http://www.rage-of-fire.com/downloads/TreeLeafs/tree.jpg

#1
06/14/2007 (12:49 am)
Your datablock is not setup correctly. you set it to TGE settings which will not work anymore.

you will need to add the alpha part in the datablock as well (search for lerp or tree leafs, this should give you some threads where the needed branch setup is in. note: you need to have seperate branch and leaf, otherwise it will not work)
#2
06/17/2007 (6:56 am)
Below is an example of how to set up your alpha (translucent) textures in the
material file.

Quote:
new Material(pine_tex) //unique name tag for texture file
{
baseTex[0] = "Main_SP_Texmap"; //actual name of texture,omitting the .png/.jpg etc
translucent = true; //whether the texture has a mask/alpha channel
translucentBlendOp = LerpAlpha; //smoothing of the blend
//translucentZWrite = true; //whether to write to the z buffer
alphaTest = true; // default value would be true
alphaRef = 20; // anything below this number is not visible and is not written to zbuffer
//emissive[0] = true; //this is for lights/lamps/shiny stuff etc
};
Notice i have commented out the "translucentZWrite = true;" with "//" this is because
the tree foliage will have artifacts if it is uncommented,experiment with or without to
see the results.The alpha ref = 0 (black/absolute transparency) - 255 (white/full colour block)
so depending on the shades of grey which allows partial rendering,
you can experiment to get your texture correct.Usually 20 is fine allowing for all blends.

Below is the code with "Normal" (bump) mapping for the foliage texture.

Quote:
new Material(pine_tex)
{
baseTex[0] = "Main_SP_Texmap"; //as above
bumpTex[0] = "Main_SP_Texmap_bump"; //my normal bump texture
pixelSpecular[0] = true; //whether the pixels shine from the sun or light
specular[0] = "1.0 1.0 1.0 0.1"; //I think this refers to direction of light reflection?
specularPower[0] = 4.0; //how much shine,2/4/8/16 or 32
translucent = true; // as above
translucentBlendOp = LerpAlpha; //as above
//translucentZWrite = true; //as above
alphaTest = true; // default value would be true
alphaRef = 0; // anything below this number is not visible and is not written to zbuffer
//emissive[0] = true;
};

Here are some examples from the TGEA engine,I have turned off the sunlight on the trees
at the back for a nice effect.

Front
www.ukgangsters.com/images/matt1.jpgSide
ukgangsters.com/images/matt2.jpgBump detail
ukgangsters.com/images/matt3.jpg
#3
09/27/2007 (6:57 pm)
I finally got it. There was a bit of a mystery in the system. The path in baseTex[0], along with the image it calls, is the reference that helps to identify which tree (or object) that the settings apply too.

I was trying to match up the Material name to the DTS when I should have been matching up the filename to what the DTS is calling. With that bit of understanding, I found my paths wrong and it finally started to come together.

Thanks Jojimbo for the excellent examples and for leading me down the path to discovery! These little bits of missing information can be a pain in the ....