Here is the code for Environmentmapping with the Fixed Function Pipeline:
Code:
// Environmentmap
bmap EnvMap = <EnvMap+6.tga> // Bitmap with the environment Map
// Material
material matFFPEnvMapping
{
// Skin zuweisen
skin1 = EnvMap;
// Effectcode
effect = "
// Textures
texture mtlSkin1;
// Technique
technique EnvMapping01
{
pass pass01
{
// Setup textures
Texture[0] = <mtlSkin1>;
// Setup Texture Addressing
AddressU[0] = Clamp;
AddressV[0] = Clamp;
// Setup Textureblending
ColorArg1[0] = Texture;
ColorOp[0] = SelectArg1;
// How to use Texture coordinates
TexCoordIndex[0] = CameraSpaceReflectionVector;
TextureTransformFlags[0] = Count3;
}
}
technique fallback {
pass p0
{
}
}
";
}
// Material
material matFFPEnvMappingWS
{
// Skin zuweisen
skin1 = EnvMap;
// Effectcode
effect = "
// Textures
texture mtlSkin1;
texture entSkin1;
// Technique
technique EnvMapping01
{
pass pass01
{
// Setup textures
Texture[0] = <mtlSkin1>;
Texture[1] = <entSkin1>;
// Setup Texture Addressing
AddressU[0] = Clamp;
AddressV[0] = Clamp;
// Setup Textureblending
ColorArg1[0] = Texture;
ColorOp[0] = SelectArg1;
ColorOp[1] = Modulate;
ColorArg1[1] = Current;
ColorArg2[1] = Texture;
// How to use Texture coordinates
TexCoordIndex[0] = CameraSpaceReflectionVector;
TextureTransformFlags[0] = Count3;
}
}
technique fallback {
pass p0
{
}
}
";
}
starter ConvertEnvMapToCubeMap
{
bmap_to_cubemap(matFFPEnvMapping.skin1);
}
starter ConvertEnvMapToCubeMapWS
{
bmap_to_cubemap(matFFPEnvMappingWS.skin1);
}
I've posted two materials:
The first one only uses the Environmentmap as Texture.
The second one uses the Environmentmap and the Entityskin as Texture ( Multitexturing ) so you can see both on the entity.
Have fun

XeXeS
