by date
customMaterial function, with specular and normal map
customMaterial function, with specular and normal map
| Name: | Itla Itla | |
|---|---|---|
| Date Posted: | Aug 08, 2008 | |
| Rating: | 4.0 out of 5 | |
| Public: | YES | |
| Comments: | YES | |
| RSS Feed: | or Subscribe with . | |
| Profile Page: | View profile page for Itla Itla |
Blog post
This is the function of a custom material, if you have many textures you use this function:
function custMate( %name)
{
%mate = "new customMaterial("@%name@") {"@
"mapTo = \"" @ %name @ ".jpg\";" @
"texture[0] = \"" @ %name @ "\";" @
"texture[1] = \"" @ %name @ "_NRM\";" @
"texture[2] = \"" @ %name @ "_SPEC\";" @
"version = 2.0;"@
"shader = SpecMap;"@
"};";
eval(%mate);
}
this is with a shader that i found here, anyway, you only have to include the function in any .cs, and in the properly materials.cs, you say
custMate("examplename");
aaah, in mapTo, the .jpg is because i use maya, and it has to use in that way, also, _NRM is the normal map, i mean,
custMate("examplename");
its like
new customMaterial(examplename)
{
mapTo = "examplename.jpg";
texture[0] = "examplename"; //the diffuse file is examplename.jpg
texture[1] = "examplename_NRM"; //the normal map is examplename_NRM.jpg
texture[2] = "examplename_SPEC"; //the specular map is examplename_SPEC.jpg
version = 2.0;
shader = SpecMap;
};
function custMate( %name)
{
%mate = "new customMaterial("@%name@") {"@
"mapTo = \"" @ %name @ ".jpg\";" @
"texture[0] = \"" @ %name @ "\";" @
"texture[1] = \"" @ %name @ "_NRM\";" @
"texture[2] = \"" @ %name @ "_SPEC\";" @
"version = 2.0;"@
"shader = SpecMap;"@
"};";
eval(%mate);
}
this is with a shader that i found here, anyway, you only have to include the function in any .cs, and in the properly materials.cs, you say
custMate("examplename");
aaah, in mapTo, the .jpg is because i use maya, and it has to use in that way, also, _NRM is the normal map, i mean,
custMate("examplename");
its like
new customMaterial(examplename)
{
mapTo = "examplename.jpg";
texture[0] = "examplename"; //the diffuse file is examplename.jpg
texture[1] = "examplename_NRM"; //the normal map is examplename_NRM.jpg
texture[2] = "examplename_SPEC"; //the specular map is examplename_SPEC.jpg
version = 2.0;
shader = SpecMap;
};
Submit your own resources!| Erik Madison (Aug 08, 2008 at 17:06 GMT) |
function createMaterial( %name )
{
%com = "new Material(MAT_"@%name@"){"@
"baseTex[0]= " @%name@ ";";
if (isFile(%name@ "_nrm"))
%com = %com @ "bumpTex[0]= " @%name@ "_nrm;";
%com = %com @ "mapTo =" @ %name @";" @
"};";
eval(%com);
}
function createShinyMaterial( %name )
{
%com = "new Material(MAT_"@%name@"){"@
"baseTex[0]= " @%name@ ";";
if (isFile(%name@ "_nrm"))
%com = %com @ "bumpTex[0]= " @%name@ "_nrm;";
%com = %com @ "pixelSpecular[0] = true;"@
"specular[0] =\"0.6 0.6 0.6 0.6\";" @
"specularPower[0]= 32.0;"@
"mapTo =" @ %name @";" @
"};";
eval(%com);
}
function createTransMaterial(%name)
{
%com = "new Material(MAT_"@%name@"){"@
"baseTex[0]= " @%name@ ";"@
"specular =\"0.60.6 0.6 0.6\";" @
"specularPower= 16.0;"@
"Translucent =true;" @
"translucentBlendOp = LerpAlpha;" @
"emmisive[0] =true;" @
"translucentZWrite =true;" @
"alphaRef =128;"@
"mapTo =" @ %name @";" @
"};";
eval(%com);
}
| Ben Acord (Aug 11, 2008 at 01:14 GMT) Resource Rating: 5 |
You must be a member and be logged in to either append comments or rate this resource.


4.0 out of 5


