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
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
5 registered members (Kingware, AndrewAMD, AemStones, RealSerious3D, degenerate_762), 837 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Need Help! #66120
03/11/06 23:06
03/11/06 23:06
Joined: Jan 2004
Posts: 620
Germany
TimeOut Offline OP
User
TimeOut  Offline OP
User

Joined: Jan 2004
Posts: 620
Germany
I use this code:

Code:
 

material mat_bumpmap
{

flags=tangent;

effect="

matrix matWorldViewProj;
matrix matWorld;

texture entSkin1; //Colormap
texture entSkin2; //Normalmap

vector vecLight;
vector vecFog;
vector vecSunDir;

technique dot3mapping
{
pass p0
{

AlphaBlendEnable = False;
AlphaTestEnable = False;
Lighting = True;
DitherEnable = True;

Texture[0] = <entSkin2>;
Texture[1] = <entSkin1>;

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

ColorOp[1] = Modulate;
ColorArg1[1] = Texture;
ColorArg2[1] = Current;

VertexShaderConstant[0]=<matWorldViewProj>;
VertexShaderConstant[4]=<matWorld>;

vertexShaderConstant[9]= <vecFog>;
vertexShaderConstant[10]=<vecSunDir>;
vertexShaderConstant[11]=<vecLight>;
VertexShaderConstant[12]={0.5f, 0.5f, 0.0f, 0.0f};

VertexShader =
asm
{

vs_1_1

// Declarations
dcl_position v0
dcl_normal v3
dcl_texcoord0 v7
dcl_texcoord1 v8

// Transform position to clip space
m4x4 oPos, v0, c0

// Tranform normal and tangent to world space
m3x3 r3, v8, c4
m3x3 r5, v3, c4

// Compute binormal
mul r0, r3.zxy, r5.yzx
mad r4, r3.yzx, r5.zxy, -r0

// Transform (Sun)light vector to tangent space
dp3 r0.x, r3.xyz, -c10
dp3 r0.y, r4.xyz, -c10
dp3 r0.z, r5.xyz, -c10

// Normalize transformed light vector
dp3 r0.w, r0, r0
rsq r0.w, r0.w
mul r0, r0, r0.w

// Put light vector in range from 0 to 1
mad r0, r0, c12.x, c12.x
// Adjust the intensity
mul r0, r0, c12.y
// Add environment light then send it down the diffuse pipe
add oD0.xyz,r0,c11

// Fog calculations
mov r1.w,c9.w
dp4 r0,v0,c6 // distance to camera position
add r0,r0,-c9.x // distance-fog_start
mad r0.x,-r0.x,c9.z,r1.w // 1-(distance-fog_start)*(1/(fog_end-fog_start))
max oFog,r0.x,c12.w // clamp with custom max value

// Pass the texture coordinates through
mov oT0, v7
mov oT1, v7
};
}
}
";
}



action fx_bumpmaping
{
my.polygon = on;
my.material = mat_bumpmap;
}






What must i change when i have i modell with 2 or 3 color textures, and 2 or 3 normalmas ?


Athlon 64 3700+ 2048 MB DDR PC400 Dual Corsair XFX Geforce 7800 GT A6 Commercial 6.4
Re: Need Help! [Re: TimeOut] #66121
03/12/06 11:08
03/12/06 11:08
Joined: Jun 2005
Posts: 4,875
broozar Offline
Expert
broozar  Offline
Expert

Joined: Jun 2005
Posts: 4,875
i am just interested: what would 2 or 3 normal maps be good for?

first texture (entSkin2) is your normal map texture 1, entSkin1 the diffuse texture. if you want to add more maps, a) define further textures under this:

"texture entSkin1; //Colormap
texture entSkin2; //Normalmap"

b) just change the numbers there (e.g. if your diffuse map is channel 4 and the normal map your channel 7, just set
"Texture[0] = <entSkin7>;
Texture[1] = <entSkin4>;"
c) add more passes if you want to apply another effect

..or just define your question a lil bit more precise


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