Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Akow, TipmyPip, tomaslolo), 788 guests, and 11 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to add detail texture support for reflection shader? #264338
05/05/09 17:52
05/05/09 17:52
Joined: Aug 2002
Posts: 681
Massachusetts, USA
Ichiro Offline OP
User
Ichiro  Offline OP
User

Joined: Aug 2002
Posts: 681
Massachusetts, USA


Howdy. I have this shader, taken from the wiki, and modified a bit...
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 mtlSkin1;
 		matrix matMtl;
 		technique envmap
 		{
 			pass p0
 			{
 				texture[0]=<entSkin1>;
 				texture[1]=<mtlSkin1>;  

 				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>;
 			}
 		}
 	";
}

I'm applying this to terrain, but wanted to include a skin2 detail texture. Can anyone point me in that direction?

Thanks much!


Dejobaan Games - Bringing you quality video games for over 75 years.
Re: How to add detail texture support for reflection shader? [Re: Ichiro] #264419
05/06/09 08:30
05/06/09 08:30
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
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.
Re: How to add detail texture support for reflection shader? [Re: Slin] #264505
05/06/09 14:34
05/06/09 14:34
Joined: Aug 2002
Posts: 681
Massachusetts, USA
Ichiro Offline OP
User
Ichiro  Offline OP
User

Joined: Aug 2002
Posts: 681
Massachusetts, USA
Awesome; thank you very much.


Dejobaan Games - Bringing you quality video games for over 75 years.

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