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
2 registered members (AndrewAMD, Imhotep), 567 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 3 of 14 1 2 3 4 5 13 14
Re: Bump Mapping Shader [Re: oliver2s] #22160
01/17/04 09:54
01/17/04 09:54
Joined: Jan 2002
Posts: 1,276
trapped in a paper bag
Drew Offline
Serious User
Drew  Offline
Serious User

Joined: Jan 2002
Posts: 1,276
trapped in a paper bag
works great! even has proper lighting in shadows...

here is the code, with action and material (for shader newbies like me)

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] = modulate;
COLORARG1[1] = texture;
COLORARG2[1] = current;

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

VertexShader =
decl
{
stream 0;
float v0[3]; //Position
float v3[3]; //Normal
float v7[2]; //Textur Koordinaten 0
}
asm
{
vs.1.0
m4x4 oPos, v0, c0
m4x4 r10,v0,c4
m3x3 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, 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
};
}
}
";
}



action Shader_bumpmap
{
my.material=bumpmap;
}




Drew Medina
Game Developer (Artist)
Personal & professional website
Deviant Art
My Blogspot
Re: Bump Mapping Shader [Re: Drew] #22161
01/17/04 15:24
01/17/04 15:24
Joined: Jan 2002
Posts: 1,276
trapped in a paper bag
Drew Offline
Serious User
Drew  Offline
Serious User

Joined: Jan 2002
Posts: 1,276
trapped in a paper bag


I applied the bump shader to a chunk of wall entity, works great except the ambient color. Is there a way to match the ambient of the level better?
or some rgb value we can change to match? The bumpmapped object does pick up the light and dark of the shadows nicely, but is way too dark.. you can see the same object on thr right,, without bumpmapping.
also- thank you for sharing the shader!!

i translated this using babelfish

Ich wendete das Stoß shader an einem Klumpen des Wandwesens, bearbeite großes ausgenommen die umgebende Farbe an. Gibt es eine Weise, das umgebende des Niveaus besser zusammenzubringen? oder etwas rgb Wert, den wir zum Gleichen ändern können? Bumpmapped Gegenstand aufhebt das helle und die Dunkelheit der Schatten freundlich, aber ist die dunkle Weise zu. Sie kann den gleichen Gegenstand auf thr Recht, ohne bumpmapping. sehen danken Ihnen auch für das Teilen des shader!!


Drew Medina
Game Developer (Artist)
Personal & professional website
Deviant Art
My Blogspot
Re: Bump Mapping Shader [Re: Drew] #22162
01/17/04 15:58
01/17/04 15:58
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline

Senior Expert
Orange Brat  Offline

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
You might be able to better match the ambient with the level if both the ambient value of the level and the entity matches. I'm talking about using materials and not setting it in WED. I've pretty much gotten everythign to match(levels, models, entities, flat surfaces) using the one that is in the templates folder. It's global, but works for quick tests. Just fiddle with the values. Once you get the hang of it...you'll appreciate the extra control.


________________

The bumpmapping is nice. Thanks for the contrib.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: Bump Mapping Shader [Re: oliver2s] #22163
01/17/04 16:55
01/17/04 16:55
Joined: May 2002
Posts: 2,541
Berlin
EX Citer Offline
Expert
EX Citer  Offline
Expert

Joined: May 2002
Posts: 2,541
Berlin
Yo, dann könnte man passend zu diesem Topic hier ein paar normal map translator programme links einfügen, hm? ZB ich könnte den für nvidia hier reinsetzen, den ich allerdings noch nicht getested habe und daher nochnicht bewerten kann.
Ausserdem fahr ich gleich nach berlin und kann also eh erst morgen abend das hier machen.
EX

Last edited by EX Citer; 01/17/04 16:57.

:L
Re: Bump Mapping Shader [Re: EX Citer] #22164
01/17/04 20:13
01/17/04 20:13
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Here are some programms to create the normalmaps you need for this shader:

ATI's Normalmap Generator (I use this tool)
Normalmap 3D Studio Max Plugin (I've not tested this)
Adobe Photoshop Normalmap Filter (I've not tested this)

Re: Bump Mapping Shader [Re: oliver2s] #22165
01/18/04 01:43
01/18/04 01:43
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
You don't need a normal map converter. Just use a greyscale bumpmap and apply the bmap_to_normals() instruction - it is then converted to a normal map within the engine.

Re: Bump Mapping Shader [Re: jcl] #22166
01/18/04 03:07
01/18/04 03:07
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
@jcl: danke für den Hinweis. Hab diesen Befehl doch glatt übersehen im neuen Handbuch.

Re: Bump Mapping Shader [Re: oliver2s] #22167
01/19/04 02:12
01/19/04 02:12
Joined: Mar 2002
Posts: 492
Tirana/Albania
fuxerz Offline
Senior Member
fuxerz  Offline
Senior Member

Joined: Mar 2002
Posts: 492
Tirana/Albania
looking good but why cant i get it to work right?all i get is a transparent material with a gradient color!
my model has notmal skin with alpha for bump.

Re: Bump Mapping Shader [Re: fuxerz] #22168
01/21/04 02:11
01/21/04 02:11
Joined: Jan 2002
Posts: 90
Nebraska
DarkShadow Offline
Junior Member
DarkShadow  Offline
Junior Member

Joined: Jan 2002
Posts: 90
Nebraska
hi all,

i tried this code even though my card doesnt support hardware shaders, it seems to work, but not really too sure, i modified a model and added a normal map to it, added the action to the model then ran it with a plain version of the model beside it to compare, well the shader is definately working but it is really dark and i can only really make out one part of the model skin and it is definately bumpmapped, however this won't due for a game, i must be missing something, do i need a dynamic light in the scene to really see the effect, or maybe do i need to adjust the material? i'm rather new to this, i just upgraded from a5 and really don't know about all the material effects and stuff, if anyone can help, i'd be grateful, i'll even send my test project if anyone wants to see it. Also while i'm at it, i have another questionit seems rather easy to apply this shader to a model or terrain, but how would i go about using it on a map entity, as map entities don't have skins really, just textures, so i don't really understand how to add a normal map to a map entitiy for use by the shader, anyway, like i said, i'm new to this stuff so bear with me on these. Anyway that's all i need right now, thanks in advance for any help.


James


It's tough to escape what's all in your head. PORTFOLIO - Here
Re: Bump Mapping Shader [Re: DarkShadow] #22169
01/22/04 03:53
01/22/04 03:53
Joined: Sep 2003
Posts: 407
inside to my
er_willy Offline
Senior Member
er_willy  Offline
Senior Member

Joined: Sep 2003
Posts: 407
inside to my
hello thanks for you work but... I use the sader and work fine the ligting areas but the sadows zone in very dark (excesive ) i playing when materials opcions but no work.

hasta luego colega

Page 3 of 14 1 2 3 4 5 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