Env Cube

Posted By: MMike

Env Cube - 08/01/04 02:29

Is possible to invert the "bmap_to_cubemap(mtl.skin1); " so it can be possible to apply the environment shader to a floor, or plan terrain??
Posted By: MMike

Re: Env Cube - 08/27/04 18:03

Please help me, is it possible to assign a shader effect To a Non Curved Surface??
Like those Shader of environmental Cube, don't work too fine on plane terrain...
Posted By: Nadester

Re: Env Cube - 08/27/04 22:43

You cannot map a cube map on a non-curved surface, but you can add a regular enviromental map (ie just clouds, or the ceiling texture of your level). It still looks pretty good.
Posted By: MMike

Re: Env Cube - 08/28/04 00:56

Really? How?? but does the texture move when my cam moves?? cause what i need to to is like reflexions, but that are on a image , like you look into ice plane, you can see the coulds, and that ..(I guess that is not ...)
Maybe, like you have a road , wet, and I want to Assign a reçlexion texture to the ground but just where the road has water, so i can see the a texture eg sky...
Take a look at those screen shots:


You can see the sky reflexions and some light, But all that is not real reflections, they are Textures that are scrolled when the camera view moves... and they use a alpha channel, so only some points are reflected.. Is this possible????
PLease.!
Posted By: Nadester

Re: Env Cube - 08/28/04 01:31

Of course its possible. Just map it with the regular envmap effect, and instead of using cube+6 as the map name use cube. Thats basically how that effect is done. You'll have a single texture that scrolls with the camera on there, instead of a cube mapped. And, of course, that single texture can be clouds.
Posted By: MMike

Re: Env Cube - 08/28/04 01:43

cube?? not the flag?ehhe
You mean just a normal texture ..?right?? thx

i did , and i got this:


My env shader is:



//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);
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;
TextureTransformFlags[1]=Count3;
TextureTransform[1]=<matMtl>;
}
}
";

}



action shaders_A6_envcube2
{
my.material = mtl_envcube2;
}
Posted By: doc123

Re: Env Cube - 08/28/04 16:38

Hmm I have maybe a litte trick for you... you take a first map with a water shader like this:

bmap waterbump2 = <waterbump.bmp>;
bmap envspec2 = <sky1.tga>; // <skycube+6.tga>;
bmap base2 = <gradient.bmp>;

function mtl_ffpwater2_1()
{

///////////////////////////////////////////////
// Lets make it scroll in some direction
//

mtl.skill1 += time;
mtl.matrix41 = floatd(mtl.skill1,4000);


}

function mtl_ffpwater2_init()
{

mtl.matrix11 = float(1.6);
mtl.matrix22 = float(0.8);

bmap_to_mipmap(mtl.skin1);
bmap_to_mipmap(mtl.skin2);
bmap_to_mipmap(mtl.skin3);

bmap_to_normals(mtl.skin1,0.5);

//bmap_to_cubemap(mtl.Skin2);

mtl.event = mtl_ffpwater2_1;

mtl.enable_view = on;

}


material mtl_ffpwater2
{
skin1=waterbump2;
skin2=envspec2;
skin3=base2;

event = mtl_ffpwater2_init;

effect = "

matrix matMtl;

texture mtlSkin1;
texture mtlSkin2;
texture mtlSkin3;

technique makewater2
{

pass p0
{

Texture[0] = <mtlSkin3>;

magFilter[0]=linear;
minFilter[0]=linear;
mipFilter[0]=linear;

AddressU[0]=Clamp;
AddressV[0]=Clamp;

ColorArg1[0] = Texture;
ColorOp[0] = modulate;
ColorArg2[0] = diffuse;

alphaop[0]=selectarg1;
alphaarg1[0]=texture;

texcoordindex[0]=1;


Texture[1] = <mtlSkin1>;

magFilter[1]=linear;
minFilter[1]=linear;
mipFilter[1]=linear;

ColorArg1[1] = Texture;
ColorOp[1] = bumpenvmap;
ColorArg2[1] = current;

TextureTransformFlags[1] = Count2;
TextureTransform[1] = <matMtl>;
Texcoordindex[1]=1;


Texture[2] = <mtlSkin2>;

magFilter[2]=linear;
minFilter[2]=linear;
mipFilter[2]=linear;

AddressU[2]=Clamp;
AddressV[2]=Clamp;

ColorArg1[2] = Texture;
ColorOp[2] = Add;
ColorArg2[2] = Current;


TextureTransformFlags[2] =count3 | projected;

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

}

}

technique fallback { pass p0 { } }

";
}



action ffp_water2 {

my.material = mtl_ffpwater2;
}

than... you take a 2nd map (model not textur or skin) over that an on all zone you want show the water reflection you must paint the skin black ... than you make this 2nd model as "overlay" in WED an that its can look like this...

with a street 2nd map its looks better...

an sry for my english ^^
Posted By: MMike

Re: Env Cube - 08/29/04 22:19

Thx for the tips, but i dind't underdtand the (model not texture) thing...
can you explain it a bit more?..
And the ski1.tga is a 2d texture?
Posted By: doc123

Re: Env Cube - 08/29/04 22:57

okay .. you take copy at first the skript from me... than you need some texture maybe like this:
gradient.bmp
sky1.tga
waterbump.bmp
and this put you in the where you have your gamedir... than you include the skript in the game/level and than you make two terrainmodel one with the street texture and one with what do you want or leave it black on this black model you do the skript.
The streetmodel you must prepare for overlay effekt you do a blackarea for all you want so see the env effekt...
finally you go in the WED and put the two terain models in it. the Streetmodel over the black terrain. than you activate overlay by the steet model and the action ffp_water2 by the black model ... than build the level an if you make it good this maybe look like my picture or better ^^.... I hope now you understand it..
Posted By: MMike

Re: Env Cube - 08/30/04 01:15

I see.. but That is a bit.. desnecessary don't you think?
I guess my card doesn't support it.. GEFORCE FX 5600 MB.. weird..
I can play all kind of shaders, ... its a shame A6 can't produce software shaders..

And what about this image??


Does anyone knows.. why it get like that??? When on non shperical surfaces?
Posted By: Steempipe

Re: Env Cube - 08/30/04 09:21

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
Posted By: MMike

Re: Env Cube - 08/31/04 00:43

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)
///
Posted By: Thomas_Nitschke

Re: Env Cube - 09/01/04 22:25

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!
Posted By: MMike

Re: Env Cube - 09/02/04 21:24

lolll.. The +6thing is for test! you can see the that line is commented! Thx anyway. eheh
Posted By: Thomas_Nitschke

Re: Env Cube - 09/03/04 01:22

o_Oooops! Sorry man just overread that one
Posted By: MMike

Re: Env Cube - 09/03/04 03:16

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




© 2023 lite-C Forums