2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: New beta's "material mtl_envcube" reflection shade
[Re: Drew]
#19373
11/05/03 12:47
11/05/03 12:47
|
Joined: May 2002
Posts: 7,441
ventilator
Senior Expert
|
Senior Expert
Joined: May 2002
Posts: 7,441
|
you could try something like this:
Code:
effect=
"
texture mtlSkin1;
texture texSkin1;
matrix matMtl;
technique cubic_environment
{
pass p0
{
Texture[0]=<texSkin1>;
Texture[1]=<mtlSkin1>;
ColorArg1[0]=Texture;
ColorOp[0]=Modulate2x;
ColorArg2[0]=Diffuse;
ColorArg1[1]=Texture;
ColorOp[1]=AddSigned;
ColorArg2[1]=Current;
AddressU[1]=Clamp;
AddressV[1]=Clamp;
TexCoordIndex[1]=CameraSpaceReflectionVector;
TextureTransformFlags[1]=Count3;
TextureTransform[1]=<matMtl>;
}
}
";
i had no time to use the new beta yet so i haven't tested this... instead of ColorOp[1]=AddSigned; you could also try ColorOp[1]=Modulate; or something like that. i think it would also be possible to control the amount of reflection with an alphachannel somehow...
|
|
|
Re: New beta's "material mtl_envcube" reflection shade
[Re: ventilator]
#19374
11/05/03 13:14
11/05/03 13:14
|
Joined: Jan 2002
Posts: 1,276 trapped in a paper bag
Drew
OP
Serious User
|
OP
Serious User
Joined: Jan 2002
Posts: 1,276
trapped in a paper bag
|
very cool, thats exactly what i meant, thank you!
It works nicely... is there a parameter that controls the amount in this code? how could I get subtle changes?
This would work VERY well on high poly cars...
Here is my working code:
Code:
bmap bmp_envcube2 = <enviromap.tga>;
// generate a matrix that transforms camera space back to world space
function mtl_env_view()
{
mat_set(mtl.matrix,matViewInv);
// reset the translation part of the matrix
mtl.matrix41 = 0;
mtl.matrix42 = 0;
mtl.matrix43 = 0;
}
function mtl_env_init()
{
bmap_to_cubemap(mtl.skin1);
mtl.event = mtl_env_view;
mtl.enable_view = on;
}
material mtl_envcube2 // environment cube
{
skin1 = bmp_envcube2;
event = mtl_env_init;
effect=
"
texture mtlSkin1;
texture texSkin1;
matrix matMtl;
technique cubic_environment
{
pass p0
{
Texture[0]=<texSkin1>;
Texture[1]=<mtlSkin1>;
ColorArg1[0]=Texture;
ColorOp[0]=Modulate2x;
ColorArg2[0]=Diffuse;
ColorArg1[1]=Texture;
ColorOp[1]=AddSigned;
ColorArg2[1]=Current;
AddressU[1]=Clamp;
AddressV[1]=Clamp;
TexCoordIndex[1]=CameraSpaceReflectionVector;
TextureTransformFlags[1]=Count3;
TextureTransform[1]=<matMtl>;
}
}
";
}
action shaders_A6_envcube2
{
my.material = mtl_envcube2;
}
|
|
|
Re: New beta's "material mtl_envcube" reflection shade
[Re: ventilator]
#19376
11/06/03 09:42
11/06/03 09:42
|
Joined: Jan 2002
Posts: 1,276 trapped in a paper bag
Drew
OP
Serious User
|
OP
Serious User
Joined: Jan 2002
Posts: 1,276
trapped in a paper bag
|
very Nice! Added an alpha channel to the models texture (32bit TGA) and it works nicely!
thanks!!!
Last edited by Drew__Dr_Jelly; 11/06/03 09:47.
|
|
|
Re: New beta's "material mtl_envcube" reflection shade
[Re: ventilator]
#19381
11/06/03 10:50
11/06/03 10:50
|
Joined: May 2002
Posts: 7,441
ventilator
Senior Expert
|
Senior Expert
Joined: May 2002
Posts: 7,441
|
Quote:
the enviromap.tga...
an easy way is to take a screenshot (F6) during gameplay(1st person view, no gun),its called "Shot_0" or something in your work folder...
Make the screenshot 256x256, make it tileable.
this way it seems like its reflecting your environment.
i think this won't result in a "correct" reflection. you have to use a 6-frames sky cube sprite!
you would have to do it this way:
- set up a view which is 256x256 and has a view.arc of 90
- make 6 screenshots from the same position -> west, north, east, south, down, up
- copy them into a 1536x256 tga and name it cube+6.tga
the +6 is important because only then it will get recognized as cube by the engine!
(maybe i'll write a script which does this automatically!)
|
|
|
|