Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 14,141 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Env Cube [Re: MMike] #31548
08/30/04 09:21
08/30/04 09:21
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
Go here and you will probably understand the problems behind texture mapping to objects other than a sphere. Or, maybe you will see some way to achieve it for all of us!!!

web page

Also, for your card you may need to use: <bmap_to_uv> instead of <bmap_to__normals>. And you *might* not be able to pull off the projected tex in <TextureTransformFlags[2] =count3 | projected;>.


Eric

Re: Env Cube [Re: Steempipe] #31549
08/31/04 00:43
08/31/04 00:43
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
Okay now i can map a cube but something is wropng with the texture...
see the script... the texture used is a simple texture:





//bmap bmp_envcube2 = <skycubesun+6.tga>; //cube image
bmap bmp_envcube2 = <water_shader.tga>; //a normal texture 2d

// 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);

//bmap_to_uv(mtl.skin1);

mtl.event = mtl_env_view;
mtl.enable_view = on;
}

material mtl_envcube2 // environment cube
{
skin1 = bmp_envcube2;
event = mtl_env_init;
//skin1 = reptile; // set a reptile skin
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;
//TexCoordIndex[2]=cameraspaceposition | 1;


//TextureTransformFlags[1] =count3 | projected;
TextureTransformFlags[1]=Count3;
TextureTransform[1]=<matMtl>;


}
}
";

}



action shaders_A6_envcube2
{
my.material = mtl_envcube2;
}


Paste the script , and apply it to the terrain model (came with 3dgs)
///

Last edited by Unknot; 08/31/04 17:32.
Re: Env Cube [Re: MMike] #31550
09/01/04 22:25
09/01/04 22:25
Joined: Jun 2003
Posts: 1,017
Germany
T
Thomas_Nitschke Offline
Senior Developer
Thomas_Nitschke  Offline
Senior Developer
T

Joined: Jun 2003
Posts: 1,017
Germany
I guess you have to remove the "+6" from the filename of your cube image because that makes the engine think it was a cube!


Formerly known as The Matrix - ICQ 170408644 I've been here for much longer than most people think. So where's my "Expert" status?
Re: Env Cube [Re: Thomas_Nitschke] #31551
09/02/04 21:24
09/02/04 21:24
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
lolll.. The +6thing is for test! you can see the that line is commented! Thx anyway. eheh

Re: Env Cube [Re: MMike] #31552
09/03/04 01:22
09/03/04 01:22
Joined: Jun 2003
Posts: 1,017
Germany
T
Thomas_Nitschke Offline
Senior Developer
Thomas_Nitschke  Offline
Senior Developer
T

Joined: Jun 2003
Posts: 1,017
Germany
o_Oooops! Sorry man just overread that one


Formerly known as The Matrix - ICQ 170408644 I've been here for much longer than most people think. So where's my "Expert" status?
Re: Env Cube [Re: MMike] #31553
09/03/04 03:16
09/03/04 03:16
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
OKay I finish the shader script! finaly..
This shader use a environemnt cube, as skin1 mtl
and the rest is a terrain.. is just works well for plane surfaces...

Can be use for ice ground..or wet envirnoment (alpha selection)




/////
//// A6 Shader , Developed By Unknot
/// For ice floor, or Wet paviments
/// Use a terrain with skin1 base map with alpha map
bmap bmp_envplane = <skycube5+6.tga>; //cube image


function mtl_envplane()
{
mat_set(mtl.matrix,matViewInv);
mtl.matrix41=0;
mtl.matrix42=0;
mtl.matrix43=0;
}

function mtl_envplane_ini()
{
//...maybe you should copy the mat_model properties here...
bmap_to_cubemap(mtl.skin1);
mtl.event=mtl_envplane;
mtl.enable_view=on;
}
material mtl_envcube2plane // environment cube
{
skin1 = bmp_envplane; //cube plane
event = mtl_envplane_ini;

effect=
"
texture mtlSkin1;
texture entSkin1;
matrix matMtl;
technique cubic_environment
{
pass p0
{

Texture[1]=<mtlSkin1>;











zWriteEnable=true;
alphaBlendEnable=false;



//colorArg1[1]=diffuse;
//colorArg1[1]=texture;


colorOp[1]=blendCurrentAlpha;
addressU[1]=Clamp;
addressV[1]=Clamp;





TextureTransformFlags[1] =count3 ;
texcoordindex[1]= cameraspaceposition ; // For cubemap use: cameraspacereflectionvector
//texcoordindex[1]= cameraspacereflectionvector | 1; // For cubemap use: cameraspacereflectionvector

TextureTransform[1]=<matMtl>;


}
}
";

}


action shaders_plane
{
my.material = mtl_envcube2plane;
}





Page 2 of 2 1 2

Moderated by  Blink, Hummel, Superku 

Gamestudio download | 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