Game Development Community

Material shader

by Michael Taylor · in Torque 3D Beginner · 04/28/2012 (2:38 pm) · 6 replies

Can anyone direct me to an example of a simple shader/custom material that just renders a texture on a mesh, and works in T3D?
Anyone at all, GG associates?
Any help would be greatly appreciated!
Thanks

#1
04/28/2012 (5:07 pm)
http://www.garagegames.com/community/resources/authorID/154909
#2
04/28/2012 (10:31 pm)
Alfio,
That's a very nice tutorial, I've gone thru that one before. So I just tried it again just as it's written and got the same results.
Gideon's head has the right textures but it also acts like it's using a cubemap for reflection. Panning the cam scrolls a black image of the environment across his head. It also generates errors -can't load the Norm and Spec maps.
Any ideas what might be wrong?
#3
04/29/2012 (4:32 am)
Check the alpha value for the output in the pixel shader
Check on the console if the shader generate errors
Check if the forwardlit is enabled for the custommaterial
#4
04/29/2012 (10:53 am)
As I said above, it generates errors- cannot load the Normal and Specular maps. Forwardlit is enabled in the CustomMaterial but I don't know how to check the alpha value. Please explain how to do it.
Thanks
#5
04/29/2012 (4:25 pm)
For the textures issue, set the entire path of the file. For example:
sampler["DiffSampler"] = "art/shapes/others/suit_05";

For the alpha u must set to 1 the .a value of the float4 output:
// MERGE ALL ON THE FINAL RESULT  
   float4 OutColor = 0;  
   
   .... 

   OutColor.a = 1.0f;

   return hdrEncode(OutColor);
#6
04/30/2012 (1:31 am)
Got it. I thought the NRM and SPEC suffixes on the filenames were required.
Changed from
head_d_NRM
head_d_SPEC
to
head_n
head_s

Thanks Alfio