There is probably some mistake as I didn´t test it, but this should basicly do it:
Code:
bmap bcube=<cube2+6.tga>;

function material_envmap_2_view()
{
	mat_set(mtl.matrix,matViewInv);
 	mtl.matrix41=0;
 	mtl.matrix42=0;
 	mtl.matrix43=0;
}

function material_envmap_2_init()
{
 	bmap_to_cubemap(mtl.skin1);
 	mtl.event=material_envmap_2_view;
 	mtl.enable_view=on;
}

material material_envmap_2
{
 	skin1=bcube;
 	event=material_envmap_2_init;
	
 	effect=
	"
		texture entSkin1;
		texture entSkin2;
		texture mtlSkin1;
		matrix matMtl;
		technique envmap
		{
			pass p0
			{
				texture[0] = <entSkin1>;
				texture[1] = <mtlSkin1>;
				texture[2] = <entSkin2>;
				
				zWriteEnable = true;
				alphaBlendEnable = false; 
				
				colorArg1[0] = Texture;
				colorOp[0] = Modulate2x;
				colorArg2[0] = Diffuse;
				
				colorArg1[1] = Texture;
				
				colorOp[1] = AddSmooth;	// Additive blending.
				
				addressU[1] = Clamp;
				addressV[1] = Clamp;
				texCoordIndex[1] = cameraSpaceNormal;
				textureTransformFlags[1] = Count3;
				textureTransform[1] = <matMtl>;
	
				texcoordindex[2] = 0;
				texturetransformflags[2] = count2;
				texturetransform[2] =
				{
					8.0,0.0,0.0,0.0, // detail map u scale
					0.0,8.0,0.0,0.0, // detail map v scale
					0.0,0.0,0.0,0.0,
					0.0,0.0,0.0,0.0
				};
	
				colorArg1[2] = Texture;
				colorOp[2] = Modulate;
				colorArg2[2] = Current;
			}
		}
 	";
}


Last edited by Slin; 05/06/09 08:30.