2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
car environment reflection
#349969
12/12/10 20:30
12/12/10 20:30
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
Does anyone know about a shader for a car surface which uses skycube to reflect?
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: car environment reflection
[Re: 3run]
#350370
12/15/10 18:01
12/15/10 18:01
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
you mean the shader code?
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: car environment reflection
[Re: 3run]
#350408
12/15/10 21:13
12/15/10 21:13
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
OP
Serious User
|
OP
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
It isn't neccesary to upload it, I can copy it here:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Include this script in your project. Make sure to use the same name for your sky cube bitmap and for the bmp_envcube
// definition from below. Place any model in your level and attach it the action named "cubic_map". That's all.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BMAP* bmp_envcube = "t_sunrise_sky+6.tga";
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function mtl_envmirror_view()
{
mat_set(mtl.matrix, matViewInv);
mtl.matrix41 = 0;
mtl.matrix42 = 0;
mtl.matrix43 = 0;
mat_scale(mtl.matrix, 1, -1, 1);
}
function mtl_envmirror_init()
{
bmap_to_cubemap(mtl.skin1);
mtl.event = mtl_envmirror_view;
/*mtl.flags=*/set(mtl,ENABLE_VIEW);
}
MATERIAL* mtl_envmirror = // environment cube
{
skin1 = bmp_envcube;
event = mtl_envmirror_init;
effect = "
texture mtlSkin1;
texture entSkin1;
matrix matMtl;
technique envcube
{
pass p0
{
AddressU[0] = Clamp; // don't wrap around edges
AddressV[0] = Clamp;
TexCoordIndex[0] = CameraSpaceReflectionVector;
TextureTransformFlags[0] = Count3;
TextureTransform[0] = <matMtl>; // transform camera space back to world space
Texture[0] = <mtlSkin1>;
ColorArg1[0] = Texture;
ColorArg2[0] = Diffuse;
ColorOp[0] = Modulate2x;
Texture[1] = <entSkin1>;
TextureFactor = 0xC0FFFFFF;
ColorArg1[1] = Texture;
ColorArg2[1] = Current;
ColorOp[1] = BlendFactorAlpha; // blend by 75% (= oxC0)
}
}
//technique fallback { pass p0 { } } // empty fallback causes normal rendering without effect
";
}
action cubic_map()
{
my.material = mtl_envmirror;
}
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
|