How to assign materials to level geometry in A6

Posted By: rayp

How to assign materials to level geometry in A6 - 09/24/08 19:45

Again a shader-noob-question:

How can i add a material to my level geometry (a6) ?
Give the material a level-texture-name ?

I want to add this dot3 shader to my level blocks:

Code:
material mat_bumpmap{
flags=tangent;
effect="  
matrix matWorldViewProj; 
 matrix matWorld; 
 texture entSkin1; 
    //Colormap  
texture entSkin2;     
//Normalmap   
vector vecLight; 
 vector vecFog; 
 vector vecSunDir;  
  technique dot3mapping  {  
  pass p0    {     
 AlphaBlendEnable = False;    
  AlphaTestEnable = False;    
  Lighting = True;   
   DitherEnable = True; 
           Texture[0] = <entSkin2>;
      Texture[1] = <entSkin1>; 
     ColorOp[0] = Dotproduct3; 
     ColorArg1[0] = Texture;  
    ColorArg2[0] = Diffuse;  
    ColorOp[1] = Modulate; 
     ColorArg1[1] = Texture; 
     ColorArg2[1] = Current; 
     VertexShaderConstant[0]=<matWorldViewProj>;
      VertexShaderConstant[4]=<matWorld>;  
          vertexShaderConstant[9]= <vecFog>;
      vertexShaderConstant[10]=<vecSunDir>;
      vertexShaderConstant[11]=<vecLight>; 
     VertexShaderConstant[12]={0.5f, 0.5f, 0.0f, 0.0f}; 
           VertexShader =        asm	{
				vs_1_1	// Declarations	
dcl_position v0 	
dcl_normal v3	
dcl_texcoord0 v7	
dcl_texcoord1 v8 	
// Transform position to clip space	
m4x4 oPos, v0, c0	
// Tranform normal and tangent to world space	
m3x3 r3, v8, c4	
m3x3 r5, v3, c4	// Compute binormal 	
mul r0, r3.zxy, r5.yzx	
mad r4, r3.yzx, r5.zxy, -r0	
// Transform (Sun)light vector to tangent space	
dp3 r0.x, r3.xyz, -c10	
dp3 r0.y, r4.xyz, -c10	
dp3 r0.z, r5.xyz, -c10	
// Normalize transformed light vector	
dp3 r0.w, r0, r0	
rsq r0.w, r0.w	
mul r0, r0, r0.w	
// Put light vector in range from 0 to 1	
mad r0, r0, c12.x, c12.x	
// Adjust the intensity 	
mul r0, r0, c12.y	
// Add environment light then send it down the diffuse pipe
	add oD0.xyz,r0,c11	        
	// Fog calculations	
mov r1.w,c9.w				
dp4 r0,v0,c6			
// distance to camera position	
add r0,r0,-c9.x		       
 // distance-fog_start	
mad r0.x,-r0.x,c9.z,r1.w	
// 1-(distance-fog_start)*(1/(fog_end-fog_start))	
max oFog,r0.x,c12.w		
// clamp with custom max value	
// Pass the texture coordinates through
	mov oT0, v7	
mov oT1, v7	
};   
 }  
}
";
}

Posted By: nightshade

Re: How to assign materials to level geometry in A6 - 09/28/08 17:21

Hi, yes the material-name must be the same as the texture-name (without .bmp,etc).
Posted By: rayp

Re: How to assign materials to level geometry in A6 - 09/28/08 18:43

Ok but this dot3 shader fex needs the normalmap file in the
second skin (normally assigned to models).
WALLTEX1 (assigned in Wed on a wall)
MATERIAL WALLTEX1{...} (written in script)
But how can i assign the normalmap (fex WALLTEX1.TGA) to
the material/wall ?


Please help again guys!
Posted By: lostclimate

Re: How to assign materials to level geometry in A6 - 09/28/08 19:39

rtfm
Posted By: rayp

Re: How to assign materials to level geometry in A6 - 09/29/08 15:28

Wow very helpfull!

lmaa
Posted By: lostclimate

Re: How to assign materials to level geometry in A6 - 09/29/08 15:44

your welcome laugh
no but it is in the manual, and if you can't find it in there, then you don't fully understand how the manual is laid out, which means you need practice using the manual, and if you need practice, this would be a perfect thing to use.
Posted By: rayp

Re: How to assign materials to level geometry in A6 - 09/29/08 16:21

My question is, how to use the dot3 shader (above) with the level geo. I can
attach materials to walls....but not this shader. This is my question.
If i hadnt tryed it for weeks i wouldnt write such questions in a forum.
So, thanx for nothing.

Any people there who "want" to help ?
Posted By: lostclimate

Re: How to assign materials to level geometry in A6 - 09/29/08 16:29

you attach the shader to the materials...
Posted By: rayp

Re: How to assign materials to level geometry in A6 - 09/29/08 17:01

"But how can i assign the normalmap (fex WALLTEX1.TGA) to
the material/wall ?"

this dot3 shader needs to skins (colormap, normalmap). Colormap = Levelwall..ok
But how can i say the material to use a file like WALLTEXNORMAL.TGA instead
of EntSkin2 and WALLTEX.TGA instead of EntSkin1 ?!?

Tryed things like
bmap Normal_Map_Test...
ENTSKIN1 = Normal_Map_Test
...wont work...
Posted By: lostclimate

Re: How to assign materials to level geometry in A6 - 09/29/08 18:41

that has more to do with how materials work than it does with it being geometry, look up mtlSkin1-4
Posted By: rayp

Re: How to assign materials to level geometry in A6 - 10/08/08 05:11

Oops...found the solution on http://au.conitec.net/ smile
© 2024 lite-C Forums