Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (VoroneTZ, monk12, Quad), 829 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 4
Page 12 of 14 1 2 10 11 12 13 14
Re: Bump Mapping Shader [Re: Grimber] #22250
04/07/05 04:44
04/07/05 04:44
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
Thats strange. Maybe put a "wait" after each instance of loading the effect?? If that does not work, then try changing the <vector>'s to <float4>'s??

Let me know what fixes it if you can so that I can update the code. Thanks.

Eric

Re: Bump Mapping Shader [Re: Steempipe] #22251
04/07/05 07:50
04/07/05 07:50
Joined: Sep 2003
Posts: 4,959
US
G
Grimber Offline
Expert
Grimber  Offline
Expert
G

Joined: Sep 2003
Posts: 4,959
US
well found the prolem after looking into the .fx file the: vector vecLight; was missing, script gremlins actualy when i pasted it in a text file, the declaration ended up nested behind the comment line above it

runs every time, but its all dark ( sun set at 80 elevation 110 on R G and B then lowered sun elevation to 45 still dark ) and both textures turning out pitch black ( REALY close I can see the bump mapping which looks REALY good) what do i adjust to lighten it up? does it need a dynamic light(s) besides teh sunlight?

can at last tell its running frame rate facing the chursh is 30 ish. look away jumps to around 80 ( normal frame rate i usualy get)

Re: Bump Mapping Shader [Re: Captain_Kiyaku] #22252
06/24/05 04:00
06/24/05 04:00
Joined: Sep 2004
Posts: 1,214
Austin, Texas
Josh_Arldt Offline
Senior Developer
Josh_Arldt  Offline
Senior Developer

Joined: Sep 2004
Posts: 1,214
Austin, Texas
I got bored and decided to try and update this old shader to dx9.
There's one problem though... I don't know how to do the swizzle.
I would be very gratefull if someone shows me how to do it... and shows me how to figure out what the swizzle would be in the first place.

here is the code:

material bumpmap
{
effect ="

matrix matWorldViewProj;
matrix matWorld;

texture entSkin1;
texture entSkin2;

vector vecLight;

technique dot3map
{
pass p0
{
Texture[0] = <entSkin2>;//2te Skin im Model ist die Normal Map
Texture[1] = <entSkin1>;//1te Skin im Model ist die Textur

COLOROP[0] = dotproduct3;
COLORARG1[0] = texture;
COLORARG2[0] = diffuse;

COLOROP[1] = modulate2x;
COLORARG1[1] = texture;
COLORARG2[1] = current;

VertexShaderConstant[0]=<matWorldViewProj>;
VertexShaderConstant[4]=<matWorld>;
VertexShaderConstant[18]={1.0f,1.0f,1.0f,1.0f};
VertexShaderConstant[19]={0.5f,0.5f,0.5f,0.5f};
VertexShaderConstant[20]= <vecLight>;
VertexShaderConstant[30]={0.0f,1.0f,0.0f,0.0f};
VertexShaderConstant[31]={1.0f,0.0f,0.0f,0.0f};
VertexShaderConstant[32]={0.0f,0.0f,1.0f,0.0f};
VertexShaderConstant[90]={1.0f,0.0f,0.0f,0.0f}; //damit oFog gefüllt ist

VertexShader = asm
{
vs.1.1
dcl_position v0; //Position
dcl_normal v3; //Normal
dcl_texcoord0 v7; //Textur Koordinaten 0
m4x4 oPos, v0, c0
m4x4 r10,v0,c4
m4x4 r8,v3,c4
mov oT0, v7
mov oT1, v7
mov oT2, v7
mov oT3, v7

//calculate texture space matrix from normal and up
mul r0,c31,v3.zxyw //-1,0,0
mul r1,c32,v3.yzxw //0,0,-1
sub r0,r1,r0

dp3 r0.w,r0,r0
rsq r0.w,r0.w
mul r0,r0,r0.w //normalized right vector

mov r1, c30 //0,-1,0
mov r2.w,r8

sub r9,c20,r10

dp3 r9.w,r9,r9
rsq r9.w,r9.w
mul r9,r9,r9.w //normalized light vector

m3x3 r3,r9,r0
mov r3.w,c30.w //transform light to texture space

add r3,r3,c18 //bias
mul r3,r3,c19//scale
mov oD0,r3
mov oFog,c90
};
}
}";
}

Re: Bump Mapping Shader [Re: Josh_Arldt] #22253
06/24/05 06:53
06/24/05 06:53
Joined: Jan 2003
Posts: 1,142
California
Daedelus Offline
Senior Developer
Daedelus  Offline
Senior Developer

Joined: Jan 2003
Posts: 1,142
California
Maybe this link will offer clues for somebody about the "swizzle".
Can't say I fully understand this yet. Maybe I'll look for it on the MSDN pages later.

http://www.gamedev.net/columns/hardcore/dxshader3/page4.asp


Formula Games - A place to buy and sell Indie games.
Re: Bump Mapping Shader [Re: Daedelus] #22254
06/24/05 19:13
06/24/05 19:13
Joined: Sep 2004
Posts: 1,214
Austin, Texas
Josh_Arldt Offline
Senior Developer
Josh_Arldt  Offline
Senior Developer

Joined: Sep 2004
Posts: 1,214
Austin, Texas
I have stopped the "read of unititialized components in r2" by placing r2.xyzw.
I still get an error though:

Error in effect:
bumpmap(74): error X5430: When writing to scalar output register, mov instruction must use replicate swizzle on source parameter(s), in order to select single component. i.e. .x|.y|.z|.w|(or rgba equivalent)


matrix matWorldViewProj;
matrix matWorld;

texture entSkin1;
texture entSkin2;

vector vecLight;

technique dot3map
{
pass p0
{
Texture[0] = <entSkin2>;//2te Skin im Model ist die Normal Map
Texture[1] = <entSkin1>;//1te Skin im Model ist die Textur

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[18]={1.0f,1.0f,1.0f,1.0f};
VertexShaderConstant[19]={0.5f,0.5f,0.5f,0.5f};
VertexShaderConstant[20]= <vecLight>;
VertexShaderConstant[30]={0.0f,1.0f,0.0f,0.0f};
VertexShaderConstant[31]={1.0f,0.0f,0.0f,0.0f};
VertexShaderConstant[32]={0.0f,0.0f,1.0f,0.0f};
VertexShaderConstant[90]={1.0f,0.0f,0.0f,0.0f}; //damit oFog gefüllt ist

VertexShader = asm
{
vs.1.1
dcl_position v0; //Position
dcl_normal v3; //Normal
dcl_texcoord0 v7; //Textur Koordinaten 0

m4x4 oPos, v0, c0
m4x4 r10,v0,c4
m4x4 r8,v3,c4
mov oT0, v7
mov oT1, v7
mov oT2, v7
mov oT3, v7

//calculate texture space matrix from normal and up
mul r0,c31,v3.zxyw //-1,0,0
mul r1,c32,v3.yzxw //0,0,-1
sub r0,r1,r0

dp3 r0.w,r0,r0
rsq r0.w,r0.w
mul r0,r0,r0.w //normalized right vector

mov r1, c30 //0,-1,0
mov r2.xyzw, r8

sub r9,c20,r10

dp3 r9.w,r9,r9
rsq r9.w,r9.w
mul r9,r9,r9.w //normalized light vector

m3x3 r3,r9,r0
mov r3.w,c30.w //transform light to texture space

add r3,r3,c18 //bias
mul r3,r3,c19//scale
mov oD0,r3.w
mov oFog,c90
};
}
}

Re: Bump Mapping Shader [Re: Josh_Arldt] #22255
06/25/05 05:31
06/25/05 05:31
Joined: Sep 2004
Posts: 1,214
Austin, Texas
Josh_Arldt Offline
Senior Developer
Josh_Arldt  Offline
Senior Developer

Joined: Sep 2004
Posts: 1,214
Austin, Texas
I am still having no luck with this...

Re: Bump Mapping Shader [Re: Stansmedia] #22256
06/27/05 11:22
06/27/05 11:22
Joined: Mar 2003
Posts: 1,524
Canada
Stansmedia Offline
Serious User
Stansmedia  Offline
Serious User

Joined: Mar 2003
Posts: 1,524
Canada
Quote:

I tried that bump mapping code. But it gave me an error message when I looked at it: BUMP MAPPING: NOT SUPPORTED BY HARDWARE...
Not supported my ass, ive got a geforce 4 128 mb of vram. Like, my max has bump mapping and stuff, so why is 3dgs complaining? Can somebody help? I want shaders

(im a total shader noob btw... so, help is good )




Holy crap i was an idiot.


Decessus - 80% done. 100% abandoned.
GET MY ANDROID GAME! https://play.google.com/store/apps/details?id=com.lasertrain.zspinballfree&hl=en
Re: Bump Mapping Shader [Re: Josh_Arldt] #22257
06/27/05 12:57
06/27/05 12:57
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
Quote:

I have stopped the "read of unititialized components in r2" by placing r2.xyzw.
I still get an error though:

Error in effect:
bumpmap(74): error X5430: When writing to scalar output register, mov instruction must use replicate swizzle on source parameter(s), in order to select single component. i.e. .x|.y|.z|.w|(or rgba equivalent)


matrix matWorldViewProj;
matrix matWorld;

texture entSkin1;
texture entSkin2;

vector vecLight;

technique dot3map
{
pass p0
{
Texture[0] = <entSkin2>;//2te Skin im Model ist die Normal Map
Texture[1] = <entSkin1>;//1te Skin im Model ist die Textur

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[18]={1.0f,1.0f,1.0f,1.0f};
VertexShaderConstant[19]={0.5f,0.5f,0.5f,0.5f};
VertexShaderConstant[20]= <vecLight>;
VertexShaderConstant[30]={0.0f,1.0f,0.0f,0.0f};
VertexShaderConstant[31]={1.0f,0.0f,0.0f,0.0f};
VertexShaderConstant[32]={0.0f,0.0f,1.0f,0.0f};
VertexShaderConstant[90]={1.0f,0.0f,0.0f,0.0f}; //damit oFog gefüllt ist

VertexShader = asm
{
vs.1.1
dcl_position v0; //Position
dcl_normal v3; //Normal
dcl_texcoord0 v7; //Textur Koordinaten 0

m4x4 oPos, v0, c0
m4x4 r10,v0,c4
m4x4 r8,v3,c4
mov oT0, v7
mov oT1, v7
mov oT2, v7
mov oT3, v7

//calculate texture space matrix from normal and up
mul r0,c31,v3.zxyw //-1,0,0
mul r1,c32,v3.yzxw //0,0,-1
sub r0,r1,r0

dp3 r0.w,r0,r0
rsq r0.w,r0.w
mul r0,r0,r0.w //normalized right vector

mov r1, c30 //0,-1,0
mov r2.xyzw, r8

sub r9,c20,r10

dp3 r9.w,r9,r9
rsq r9.w,r9.w
mul r9,r9,r9.w //normalized light vector

m3x3 r3,r9,r0
mov r3.w,c30.w //transform light to texture space

add r3,r3,c18 //bias
mul r3,r3,c19//scale
mov oD0,r3.w
mov oFog,c90
};
}
}




place mov oFog,c90.x


www.earthcontrol.de
quoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
Re: Bump Mapping Shader [Re: ello] #22258
06/27/05 19:26
06/27/05 19:26
Joined: Sep 2004
Posts: 1,214
Austin, Texas
Josh_Arldt Offline
Senior Developer
Josh_Arldt  Offline
Senior Developer

Joined: Sep 2004
Posts: 1,214
Austin, Texas
Thanks so much ello.
I think I am starting to understand this swizzle thing a little better...

Now the colorOp and colorArgs are giving me trouble...
They belong in the pass though right?

Re: Bump Mapping Shader [Re: Josh_Arldt] #22259
06/27/05 23:14
06/27/05 23:14
Joined: Sep 2004
Posts: 1,214
Austin, Texas
Josh_Arldt Offline
Senior Developer
Josh_Arldt  Offline
Senior Developer

Joined: Sep 2004
Posts: 1,214
Austin, Texas
Okay... it actually runs now...

the colorOps and colorArgs had to go after the vertexShaderConstants.


but it shows up as just black...
Maybe it's just my card... it's been acting up...

Please test it and post your results.



MATERIAL bumpmap
{
effect
"
matrix matWorldViewProj;
matrix matWorld;

texture entSkin1;
texture entSkin2;

vector vecLight;

technique dot3map
{
pass p0
{
Texture[0] = <entSkin2>;//2te Skin im Model ist die Normal Map
Texture[1] = <entSkin1>;//1te Skin im Model ist die Textur

VertexShaderConstant[0]=<matWorldViewProj>;
VertexShaderConstant[4]=<matWorld>;
VertexShaderConstant[18]={1.0f,1.0f,1.0f,1.0f};
VertexShaderConstant[19]={0.5f,0.5f,0.5f,0.5f};
VertexShaderConstant[20]= <vecLight>;
VertexShaderConstant[30]={0.0f,1.0f,0.0f,0.0f};
VertexShaderConstant[31]={1.0f,0.0f,0.0f,0.0f};
VertexShaderConstant[32]={0.0f,0.0f,1.0f,0.0f};
VertexShaderConstant[90]={1.0f,0.0f,0.0f,0.0f}; //damit oFog gefüllt ist

colorOp[0] = DotProduct3;
colorArg1[0] = Texture;
colorArg2[0] = Diffuse;
colorOp[1] = Modulate;
colorArg1[1] = Texture;
colorArg2[1] = Current;

VertexShader = asm
{
vs.1.1
dcl_position v0; //Position
dcl_normal v3; //Normal
dcl_texcoord0 v7; //Textur Koordinaten 0

m4x4 oPos, v0, c0
m4x4 r10,v0,c4
m4x4 r8,v3,c4
mov oT0, v7
mov oT1, v7
mov oT2, v7
mov oT3, v7

//calculate texture space matrix from normal and up
mul r0,c31,v3.zxyw //-1,0,0
mul r1,c32,v3.yzxw //0,0,-1
sub r0,r1,r0

dp3 r0.w,r0,r0
rsq r0.w,r0.w
mul r0,r0,r0.w //normalized right vector

mov r1, c30 //0,-1,0
mov r2.xyzw, r8

sub r9,c20,r10

dp3 r9.w,r9,r9
rsq r9.w,r9.w
mul r9,r9,r9.w //normalized light vector

m3x3 r3,r9,r0
mov r3.w,c30.w //transform light to texture space

add r3,r3,c18 //bias
mul r3,r3,c19//scale
mov oD0,r3.w
mov oFog,c90.x
};
}
}
";
}


action normalMap_ent
{
my.material = bumpmap;
}

Page 12 of 14 1 2 10 11 12 13 14

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