Game Development Community

Material & Custom Material

by elvince · in Torque 3D Professional · 01/13/2010 (3:25 am) · 2 replies

Hi,

I'm trying to understand the difference between Material & Custom Material.

From what I read, the custom material is used to apply a shader to a material and link it to your mesh with map_to.

Does that mean we can't apply a shader on a material? I mean that the "basic" material have a lot of thing like bump, specular & so, and if I want to apply a shader on a diffuse map and keep the bump, specular I will have to code them in my shader? did I miss something?

If there any quick material copy function, that we can call during game processing?

#1
04/17/2010 (9:26 pm)
In essence, there is no difference between a material and a custom material. Basic materials have their shaders generated procedurally by the engine at run time. Custom materials exist to allow you to apply your own shaders and bypass the engines procedural system. All custom materials have the same parameters available to them that the basic material has (diffuse, normal, specular, detail and so on) plus the ability to read any custom hlsl files that you create on your own.

unfortunately, as far as I know shaders are global to the material (anyone correct me if I'm wrong) so in any ONE material, any texture calls made will have the shader effect applied to it. you can use multiple materials on a single object however, and get around that system in that way.
#2
04/17/2010 (11:46 pm)
Quote:
Does that mean we can't apply a shader on a material?

materials will use shaders according to what parameters are set. so if you provide a bump map, engine will know to create a shader which uses it.

you would need to create your own .hlsl file for a custom material.