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
1 registered members (TipmyPip), 18,586 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 3
Page 2 of 2 1 2
Re: DX9 Multitexturing [Re: Steempipe] #35075
10/21/04 08:13
10/21/04 08:13
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
Quote:

I´ve got this error:

Malfunction W1550

Error in Effect:
mat_terrain_multitexture(78):error X3000:syntax error:unexpected integer constant

The debug syntax check found no error, can anybody help??






After you do all the above corrections.... then for this one;
Try correction in this line: (get rid of the last zero)
vertexShaderConstant[65]={20.0f,15.0f,0.0f, 0.0f0 };

if you still get the error, try changing this line:
vertexShaderConstant[64]=<vecSkill41>;

to something like:
vertexShaderConstant[64]={20.0f,15.0f,0.0f,0.0f};

If it goes away, then you know where to focus attention.

Re: DX9 Multitexturing [Re: Steempipe] #35076
10/21/04 13:01
10/21/04 13:01
Joined: May 2004
Posts: 36
L
lekboon Offline
Newbie
lekboon  Offline
Newbie
L

Joined: May 2004
Posts: 36
hi,i modify the multitexture shader from wiki and follow the advise from Steempipe. The shader finishly work in DX9 version.
here is the code:



material mtl_multitexture
{
effect=
"
texture entSkin1;
texture entSkin2;
texture entSkin3;
texture entSkin4;
matrix matWorldViewProj;
matrix matWorld;
matrix matWorldView;
vector vecSunDir;
vector vecFog;
technique multitexture
{
pass p0
{
Texture[0]=<entSkin1>; // colormap1
Texture[1]=<entSkin3>; // colormap2
Texture[2]=<entSkin2>; // colormap3
Texture[3]=<entSkin4>; // macromap
magFilter[2]=linear;
minFilter[2]=linear;
mipFilter[2]=linear;
magFilter[3]=linear;
minFilter[3]=linear;
mipFilter[3]=linear;
zWriteEnable=true;
vertexShaderConstant[0]=<matWorldViewProj>;
vertexShaderConstant[4]=<matWorld>;
vertexShaderConstant[8]=<matWorldView>;
vertexShaderConstant[16]=<vecSunDir>;
vertexShaderConstant[20]=<vecFog>;
vertexShaderConstant[64]={10.0f,10.0f,16.0f,16.0f};
vertexShaderConstant[65]={8.0f,8.0f,0.0f,0.0f}; // u_scale3,v_scale3
vertexShaderConstant[95]={0.5f,1.0f,2.0f,0.0f};
vertexShader=
asm
{
vs_1_1
dcl_position v0
dcl_normal v3
dcl_texcoord0 v7

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

m3x3 r0,v3,c4 // transform normal to world space
dp3 r0.w,r0,r0 // renormalize it
rsq r0.w,r0.w
mul r0,r0,r0.w

dp3 oD0,r0,-c16 // normal.light -> lighting constant

mov r1.w,c20.w // r1.w=1
dp4 r0,v0,c10 // distance to camera position
add r0,r0,-c20.x // distance-fog_start
mad r0.x,-r0.x,c20.z,r1.w // 1-(distance-fog_start)*(1/(fog_end-fog_start))
max oFog,r0.x,c95.w // clamp with custom max value

mul oT0.xy,v7.xy,c64.xy // output scaled uvs - colormap1
mul oT1.xy,v7.xy,c64.zw // output scaled uvs - colormap2
mul oT2.xy,v7.xy,c65.xy // output scaled uvs - colormap3
mov oT3.xy,v7.xy // output uvs - macromap
};

pixelShader=
asm
{
ps.1.1
def c0,1,1,1,1
tex t0 // sample colormap1
tex t1 // sample colormap2
tex t2 // sample colormap3
tex t3 // sample macromap

mov r1,t1
lrp r0.rgb,t3.a,t0,r1 // blend t0 with t1 depending on t3 alpha
+mov r0.a,c0

mov r1.a,t3.b
lrp r0.rgb,r1.a,r0,t2 // blend the result with t2 depending on t3 blue
+mov r0.a,c0

mul r0.rgb,r0,v0 // modulate with diffuse vertex lighting
};


}
}
technique fallback { pass p0 { } }
";
}

action terrain
{
my.skill41=float(10);
my.skill42=float(20);
my.skill43=float(5);
my.skill44=float(10);

my.flare=off;
my.transparent=off;
my.material=mtl_multitexture;
}

Re: DX9 Multitexturing [Re: lekboon] #35077
10/21/04 17:47
10/21/04 17:47
Joined: Aug 2003
Posts: 169
Tennessee, US
Ahriman Offline
Member
Ahriman  Offline
Member

Joined: Aug 2003
Posts: 169
Tennessee, US
lekboon: Tested this code it works great thanks to all contributors, a couple questions or request rather please. Dynamic lighting is not working on the terrain, also would it be possible to add 1 or 2 more textures to the blending?

Re: DX9 Multitexturing [Re: Ahriman] #35078
10/22/04 16:56
10/22/04 16:56
Joined: Aug 2003
Posts: 511
Hilden in Germany
RobH Offline
User
RobH  Offline
User

Joined: Aug 2003
Posts: 511
Hilden in Germany
I have no only one texture, no multitexturing. I have an macromap and three textures. What made I wrong or have i forget??

Last edited by RobNic; 10/22/04 17:17.
Re: DX9 Multitexturing [Re: lekboon] #35079
11/01/04 21:13
11/01/04 21:13
Joined: Dec 2003
Posts: 266
Celle
task1 Offline
Member
task1  Offline
Member

Joined: Dec 2003
Posts: 266
Celle
yeah lekboon you rocks!

thanks alot to everybody!

project page

Last edited by task1; 11/02/04 01:13.

visit my pages: www.xiron.de ICQ: 335016379 Messenger: lalimited@hotmail.com
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