Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, 7th_zorro, TedMar), 1,243 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
code for envmapping? #32752
09/03/04 11:59
09/03/04 11:59
Joined: Jul 2004
Posts: 31
Rendering on a Pipeline
Buluen Offline OP
Newbie
Buluen  Offline OP
Newbie

Joined: Jul 2004
Posts: 31
Rendering on a Pipeline
anyone got a working code of enviroment mapping? if so can you post it plz

Re: code for envmapping? [Re: Buluen] #32753
09/03/04 19:40
09/03/04 19:40
Joined: Jan 2002
Posts: 750
Deutschland/Baden-Würtemberg
Stefan Offline
User
Stefan  Offline
User

Joined: Jan 2002
Posts: 750
Deutschland/Baden-Würtemberg
Code:
 

bmap bmp_envcube = <blood_gsmall+6.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.skin4);
// bmap_to_uv(bmap_for_entity(my,2));
mtl.event = mtl_env_view;
mtl.enable_view = on;
}

material mtl_envcube // environment cube
{
skin4 = bmp_envcube;
event = mtl_env_init;

effect = "
texture mtlSkin4;
// texture entSkin2;
matrix matMtl;

technique envcube
{
pass p0
{
/* BumpEnvMat00[0] = 0.5f;
BumpEnvMat01[0] = 0.0f;
BumpEnvMat10[0] = 0.0f;
BumpEnvMat11[0] = 0.5f;

Texture[0] = <entSkin2>;
ColorArg1[0] = Texture;
ColorArg2[0] = Diffuse;
ColorOp[0] = BumpEnvMap;
*/
TextureFactor = 0xFFFF0000;
ColorArg1[0] = Tfactor;
ColorOp[0] = SelectArg1;

AddressU[1] = Clamp; // don't wrap around edges
AddressV[1] = Clamp;

TexCoordIndex[1] = CameraSpaceReflectionVector;
TextureTransformFlags[1] = Count3;
TextureTransform[1] = <matMtl>; // transform camera space back to world space

Texture[1] = <mtlSkin4>;
ColorArg1[1] = Texture;
ColorArg2[1] = Current;
ColorOp[1] = Add;

}
}

technique fallback { pass p0 { } } // empty fallback causes normal rendering without effect
";
}

action envcube {
my.material = mtl_envcube;
//while(1) { my.pan += time; wait(1); }
}




Re: code for envmapping? [Re: Stefan] #32754
09/03/04 21:01
09/03/04 21:01
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
What kind of envmap??
For surfaces or models??
And you want Faked Env Cube map (for shperes and curved surfaces)
Or flat Mirror cube???


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