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,574 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
Rate Thread
Page 3 of 7 1 2 3 4 5 6 7
Re: dot3 bumpmapping example [Re: ventilator] #16963
10/25/03 16:43
10/25/03 16:43
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
hey this is nifty code!
one question..
how would you set it to get light vecs from static and dyamic lights.. if you have multiple lights would you have it always use the vec from the closest light?
anyway great code.. i was working with diffuse+spec lighting but having major trouble.. this is a step in the right direction ..


Sphere Engine--the premier A6 graphics plugin.
Re: dot3 bumpmapping example [Re: Matt_Aufderheide] #16964
10/25/03 22:18
10/25/03 22:18
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
Quote:

how would you set it to get light vecs from static and dyamic lights.. if you have multiple lights would you have it always use the vec from the closest light?




i think currently you would have to find the nearest light in the entity's action and pass its position (or direction) to the shader with skill41. if you pass the light's position you would also have to change the shader from using a directional light source (the sun) to a point light source but that isn't difficult.

i think the new light management which is planned by conitec will make light handling a lot easier and more convenient.

shaders often use more than one light source and at the moment this would be tricky because there aren't enough skills to pass several light positions over to the shader...

Re: dot3 bumpmapping example [Re: ventilator] #16965
10/26/03 06:29
10/26/03 06:29
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
ventilator- very cool code... the textures seem inverted now, negative... any ideas?
thanks!!!


Drew Medina
Game Developer (Artist)
Personal & professional website
Deviant Art
My Blogspot
Re: dot3 bumpmapping example [Re: Drew] #16966
10/26/03 06:47
10/26/03 06:47
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
maybe you applied the textures to your model in the wrong order? it could look strange if the colormap gets converted to a normalmap!

Re: dot3 bumpmapping example [Re: Drew] #16967
10/26/03 06:48
10/26/03 06:48
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
I had that problem.. remeber to setup your starter funtion for the material.. and also it is better to make the normalmap yourself with a conversion program.. ATI has such tools on their website..

additional questions for Ventilator..
how do you convert the lighting model to use point lights?
also, can you pass light rgb values?
finally, im trying to setup the shader to use a specific normal map for each entity type.. im having trouble with this becasue i cant use bmap_for_entity in the skin declaration.. i cant see any other way to specify variable skins..


Sphere Engine--the premier A6 graphics plugin.
Re: dot3 bumpmapping example [Re: Matt_Aufderheide] #16968
10/26/03 07:40
10/26/03 07:40
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
how do you convert the lighting model to use point lights?
in your entity action you pass the position of the light to the shader:

my.skill41=float(lightpos.x);
my.skill42=float(lightpos.y);
my.skill43=float(lightpos.z);
my.skill44=float(1);

instead of sundir you have to define vecSkill41 as a constant in the shader:

VertexShaderConstant[16]=<vecSkill41>;

then you have to calculate the light direction for each vertex:

m4x4 r10,v0,c4 // transform vertexpos to world space
sub r10,r10,c16 // lightdir=vertexpos-lightpos
dp3 r10.w,r10,r10 // renormalize it
rsq r10.w,r10.w
mul r10,r10,r10.w

dp3 r8.x,r5,r10 // transform lightdir to texture space
dp3 r8.y,r6,r10
dp3 r8.z,r7,r10
mad oD0.xyz,r8.xyz,c95.x,c95.x

...
i haven't really tested this though...

also, can you pass light rgb values?
yes, sure! you could use the material diffuse, ambient, specular colors (which are accessible through vecdiffuse,...) as light colors in the shader. alternatively entity or material skills could be used to pass the color information.

finally, im trying to setup the shader to use a specific normal map for each entity type.. im having trouble with this becasue i cant use bmap_for_entity in the skin declaration.. i cant see any other way to specify variable skins..
bumpmaps can be specified per model or per material. in my example i did it per model and converted the bumpmap in the entity's action.

specifying the bumpmap per material works like that:

bmap b_bumpmap=<bumpmap.tga>;
material mat_diffuseperpixel
{
skin1=b_bumpmap;
...

technique diffuseperpixel
{
pass p0
{
Texture[0]=<texSkin1>;
Texture[1]=<mtlSkin1>;
...

starter mat_diffuseperpixel_init()
{
bmap_to_normals(mat_diffuseperpixel.skin1,16);
}

you have to use a starter function for bmap_to_normals then!

Re: dot3 bumpmapping example [Re: Matt_Aufderheide] #16969
10/26/03 08:26
10/26/03 08:26
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
thanks a lot for response!
OK.. maybe im dumb.. :P
i dont want to use the bmap_to_normal ...
i have made already a normal map.. and i need to somehow assign normal maps per entity.. see? how in the entity action can you tell it which map to use as the normal map.. and then pass it to shader?


Sphere Engine--the premier A6 graphics plugin.
Re: dot3 bumpmapping example [Re: Matt_Aufderheide] #16970
10/26/03 08:31
10/26/03 08:31
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
oh! sorry, i think i didn't understand you correctly. you want to use different normal maps for entities which all use the same model?

Re: dot3 bumpmapping example [Re: ventilator] #16971
10/26/03 13:00
10/26/03 13:00
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
no.. i guess im not being clear.. sorry

maybe i dont understand how your script works...
all i want is to use different normal maps for different entities.. not differnt ones per the same models...see. maybe your script already can do that..but i dont see how. I dont want to define differetn materials for each model.. just use the same mat_diffuse. How does it know which model/skin gets which normal map?
instead of defining skin2=<wahtever.tga> as the normal map.. how do you make the shader know to use differnt normal maps .. maybe im being dense.. thank you for your patience.


Sphere Engine--the premier A6 graphics plugin.
Re: dot3 bumpmapping example [Re: Matt_Aufderheide] #16972
10/26/03 13:25
10/26/03 13:25
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
Quote:

maybe you applied the textures to your model in the wrong order? it could look strange if the colormap gets converted to a normalmap!




hmmm... I dont know how i would do that ;p
I used the code as is... the bump is there (inverted colors), but still doesn't seem to change with motion, its based on the sun right? Its really great that your are helping with this, thank you!



Drew Medina
Game Developer (Artist)
Personal & professional website
Deviant Art
My Blogspot
Page 3 of 7 1 2 3 4 5 6 7

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