Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (VoroneTZ, AndrewAMD), 833 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 1 of 5 1 2 3 4 5
New beta's "material mtl_envcube" reflection shade #19372
11/05/03 12:06
11/05/03 12:06
Joined: Jan 2002
Posts: 1,276
trapped in a paper bag
Drew Offline OP
Serious User
Drew  Offline OP
Serious User

Joined: Jan 2002
Posts: 1,276
trapped in a paper bag
New 6.12.7 beta's "material mtl_envcube" reflection shade Looks really nice! I'm also able to use flags like transparancy...
Question, how can I get about 50% of the shader to show, showing the other 50% of the models texture...
I've noticed most of the shaders are on or off, I'm looking to vary the amount of a shader...
thanks!


Drew Medina
Game Developer (Artist)
Personal & professional website
Deviant Art
My Blogspot
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 Offline
Senior Expert
ventilator  Offline
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 Offline OP
Serious User
Drew  Offline 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;
}







Drew Medina
Game Developer (Artist)
Personal & professional website
Deviant Art
My Blogspot
Re: New beta's "material mtl_envcube" reflection shade [Re: Drew] #19375
11/05/03 17:55
11/05/03 17:55
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
Code:
effect=

"
texture texSkin1;
texture mtlSkin1;
matrix matMtl;
technique cubic_environment
{
pass p0
{
Texture[0]=<texSkin1>;
Texture[1]=<mtlSkin1>;

zWriteEnable=true;
AlphaBlendEnable=false;

ColorArg1[0]=Texture;
ColorOp[0]=Modulate2x;
ColorArg2[0]=Diffuse;

ColorArg1[1]=Texture;
ColorOp[1]=BlendCurrentAlpha;

AddressU[1]=Clamp;
AddressV[1]=Clamp;
TexCoordIndex[1]=CameraSpaceReflectionVector;
TextureTransformFlags[1]=Count3;
TextureTransform[1]=<matMtl>;
}
}
";

you could use this effect. the alphachannel of the model texture specifies how reflective the texture is.

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 Offline OP
Serious User
Drew  Offline 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.

Drew Medina
Game Developer (Artist)
Personal & professional website
Deviant Art
My Blogspot
Re: New beta's "material mtl_envcube" reflection shade [Re: Drew] #19377
11/06/03 10:12
11/06/03 10:12
Joined: Jan 2002
Posts: 1,276
trapped in a paper bag
Drew Offline OP
Serious User
Drew  Offline OP
Serious User

Joined: Jan 2002
Posts: 1,276
trapped in a paper bag
Its nice that now I can have selective areas on my model reflect only, like the metal armor, all you need is a mask in your alpha channel. Nice too that it still uses the Bmap assigned for the reflection.
Is there a way to get a bumpmapping on skin2? as either a bump or a bumpdot3 map...
awesome work!


Drew Medina
Game Developer (Artist)
Personal & professional website
Deviant Art
My Blogspot
Re: New beta's "material mtl_envcube" reflection shade [Re: Drew] #19378
11/06/03 10:25
11/06/03 10:25
Joined: Jul 2002
Posts: 2,813
U.S.
Nadester Offline

Expert
Nadester  Offline

Expert

Joined: Jul 2002
Posts: 2,813
U.S.
Havn't downloaded the update yet... takes oodles of time on my 56k But I'm just gonna try the code with the new key.zip. I just want to know, what should my enviromap.tga be? I need to make one since I dont have it.


--Eric
Re: New beta's "material mtl_envcube" reflection shade [Re: Nadester] #19379
11/06/03 10:38
11/06/03 10:38
Joined: Jan 2002
Posts: 1,276
trapped in a paper bag
Drew Offline OP
Serious User
Drew  Offline OP
Serious User

Joined: Jan 2002
Posts: 1,276
trapped in a paper bag
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.

If you want selective reflections on your model, add a alphachannel in photoshop to your model's texture.
its greyscale, so white would be completely reflective (showing enviromap) grey would be sort of reflective, and black none.
Save it as 32bit .TGA and apply it to your model as skin1.
Hope that helps


Drew Medina
Game Developer (Artist)
Personal & professional website
Deviant Art
My Blogspot
Re: New beta's "material mtl_envcube" reflection shade [Re: Drew] #19380
11/06/03 10:43
11/06/03 10:43
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
you could add bumpmapping too. but the fixed-pipeline bumpmapping doesn't look good. i think for best results you would have to do the entire effect with a vertex/pixelshader but i don't know how to do correct cubic environment mapping with a shader.

you have to use the same cubic environments you would use for a sky -> look in the readbeta.txt for sky.cube!


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 Offline
Senior Expert
ventilator  Offline
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!)


Page 1 of 5 1 2 3 4 5

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1