Game Development Community

How do I make procedural shaders?

by Andrew Fiorello · in Torque Game Engine Advanced · 06/02/2008 (3:54 pm) · 5 replies

Hello, I've been playing around with TGEA 1.7 for a while now and in the documentation and demos it talks about procedural shaders and how they can be used with TGEA. However there is no real information on how procedural shaders are created and the tutorial on importing shaders from RenderMonkey and FX Composer doesn't cover it.

Does anyone know where I can find a tutorial or other information on how this is done?

Thanks in advanced.

#1
06/02/2008 (4:52 pm)
In TGEA, the shaders are procedurally generated from the material definitions. You can also write your own shaders.

Read these articles, in this order:

http://tdn.garagegames.com/wiki/TSE/Materials/Overview
http://tdn.garagegames.com/wiki/TSE/Shaders
http://tdn.garagegames.com/wiki/Torque/Rendering/General_Shader_FAQ/HLSL_FAQ
#2
06/06/2008 (6:09 pm)
Thanks a lot! That was great help to me. But now I have another problem. I'm playing around with different material options, and I have noticed that staging does not seem to work.

This code:

new Material(DirtyWood)
{
// Rendering Stage 0

    baseTex[0] = "./DirtyWood";

    pixelSpecular[0] = true;
    specular[0]      = "1.0 1.0 1.0 0.5";
    specularPower[0] = 512.0;
    glow[0] = true;


	
};

Produces this result:

img379.imageshack.us/img379/940/notsteppedti2.png
While this code:

new Material(DirtyWood)
{
// Rendering Stage 0

    baseTex[0] = "./DirtyWood";

    pixelSpecular[1] = true;
    specular[1]      = "1.0 1.0 1.0 0.5";
    specularPower[1] = 512.0;
    glow[1] = true;


	
};

Produces this result:

img379.imageshack.us/img379/4084/steppedhf6.png

Any idea why this is?
#3
06/13/2008 (1:48 pm)
Looks like the specular is doubled up and that made it become so bright you cant see the texture anymore.
#4
06/14/2008 (9:55 am)
It looks like that when I put everything pertaining to the specular into step 1 instead of step 0. I don't know why it behaves that way since even in the documentation it describes a different effect, that being that the specular highlights would glow and not the whole model.