DOT3 BumpMapping

From GameStudio Wiki

Jump to: navigation, search
texture entSkin1; // the entity skin
texture entSkin2; // the bump map
float4 vecLight; // the light vector (assign it in action)

technique bump_dot3
{
	pass P0
	{
		// set texture stage states
		Texture[0] = <entSkin2>;
		Texture[1] = <entSkin1>;
		TextureFactor = <vecLight>;

		ColorArg1[0] = Texture; // stage 0 = bumpmap
		ColorOp[0] = DotProduct3;
		ColorArg2[0] = TFactor;

		ColorArg1[1] = Texture; // stage 1 - skin texture
		ColorOp[1] = AddSigned;
		ColorArg2[1] = Current;

		ColorArg1[2] = Diffuse; // stage 2 - lighting
		ColorOp[2] = Modulate2x;
		ColorArg2[2] = Current;
	}
}
Personal tools