Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
4 registered members (AndrewAMD, Quad, soulman3, Ayumi), 675 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Normal Bump Shader #134182
06/06/07 09:52
06/06/07 09:52
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
Hi there,

Im trying to understand how to add a bump shader in my project.
The only problem is it isn't working.
I have a FX file from the internet (AU Resources)
And tryed to add the code to my own script.
I have no error's and also do not see the bump :S
I have 2 map's and both in same map.

Any one can help me how to do it right ? or give an example also?

I want just the block i create in WED to give a bump and not things i made in MED!

Plz help me out with it


-The Dragon's Eye is alway's watching you!-
Re: Normal Bump Shader [Re: SurudoiRyu] #134183
06/06/07 10:09
06/06/07 10:09
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
for bump effect You don't need .fx, simple material effect will be enough
all you need is ordinary (color) texture as first one and normal_map texture as second one which one you may create with TGAtoDOT3.exe by ATI

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}; //0.5 0.5 0.0 0.0

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



Last edited by tompo; 06/06/07 10:09.

Never say never.
Re: Normal Bump Shader [Re: tompo] #134184
06/06/07 10:39
06/06/07 10:39
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
texture entSkin1; //Colormap texture entSkin2; //Normalmap
here is must define the texture i gues ?
bmap entSkin1 = enskin1.tga for example ?

And isn't it better to do that technique in a fx ? for later if i have more textures so i don't need 10,000 of those huge scripts ?

Thnx for reply'ing allready
Hope you can explain me more ^^


-The Dragon's Eye is alway's watching you!-
Re: Normal Bump Shader [Re: SurudoiRyu] #134185
06/06/07 10:46
06/06/07 10:46
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
no... U don't have to define this
1. create model
2. create color texture for this model (.tga)
3. from this texture create normal_map texture or from gray-scaled
4. skin your model
- for first skin use color texture
- for second one use normal_map texture
5. Attach material to model by script
6. enjoy

P.s. send me your email via PM and I'll send you example model with both skins, if you want to

Last edited by tompo; 06/06/07 10:49.

Never say never.
Re: Normal Bump Shader [Re: tompo] #134186
06/06/07 10:54
06/06/07 10:54
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
hehe i want a script for the block's etc. in de WED ^-^ Not in MED
but also what you say is usefull i will try that later but i want to try in WED i have a world and want to optimize the texture with a bump on it ^^

Thnx,


-The Dragon's Eye is alway's watching you!-
Re: Normal Bump Shader [Re: SurudoiRyu] #134187
06/06/07 11:00
06/06/07 11:00
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
here U have nice and free texture to use for bump effect
web page
1. create box in med
2. skin it with top-left skin as first one
3. skin with bottom-right (normal_map) as second one
4. attach material to model

about blocks... U can chose material from the list in block properties
can blocks have more than one skin on the same surface? I'm affraid not so bump will not working

Last edited by tompo; 06/06/07 11:14.

Never say never.
Re: Normal Bump Shader [Re: tompo] #134188
06/06/07 11:12
06/06/07 11:12
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
So i cannot put it on block's ? cause i can define a material script to it maybe with a effect_load on it ? from a bump and define 2 materials ? Cause this tutorial did it also but i cant get it into 1 shader effect in my own project :S it doesn't show anything :S

Maybe you could look at it and understand it ?
So you can tell me what i need to do to get it work?

Link for the tutorial:
http://www.coniserver.net/coni_users/web_users/pirvu/au/scripts/shadercollection.zip


-The Dragon's Eye is alway's watching you!-
Re: Normal Bump Shader [Re: SurudoiRyu] #134189
06/06/07 15:49
06/06/07 15:49
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
hey, got your PM, thanks...

Shaders on WED geometry is too slow. And you can't simply use the material option for geometry, you have to write the shader differently so that GS sends the textures through. You need to use models. If you still want bumpmapping on your level, then you can create your level from models, and use the polygon flag for collision.

This is what many people are doing, but without a plugin (such as sphere), it will still be slow.

I created a normal mapping shader, which I have in my signature at the bottom of my posts. Give it a try.


xXxGuitar511


xXxGuitar511
- Programmer
Re: Normal Bump Shader [Re: xXxGuitar511] #134190
06/07/07 05:39
06/07/07 05:39
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
hehe ok thanks that explains a lot ^-^,
i will give it a try to build my lvl then in med
is there any good tutorial for MED ? cause im not into it
More into 3D-Max and this is very weird to use for me
like how to add a texture or 2 textures to get that bump effect?

Thanks for the reply ^^


-The Dragon's Eye is alway's watching you!-
Re: Normal Bump Shader [Re: SurudoiRyu] #134191
06/07/07 06:01
06/07/07 06:01
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
You can of course use MED, but I don't recommend it. It's.. ..awkward. You can use MAX and then export to MDL format...

As for MED tutorials, sorry I can't help you there. Hopefully someone can drop one here for you


xXxGuitar511
- Programmer
Page 1 of 3 1 2 3

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