Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 831 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
animating bumpmaps #77259
06/09/06 21:06
06/09/06 21:06
Joined: Sep 2004
Posts: 1,214
Austin, Texas
Josh_Arldt Offline OP
Senior Developer
Josh_Arldt  Offline OP
Senior Developer

Joined: Sep 2004
Posts: 1,214
Austin, Texas
How could I achieve animating normalmap?
I have an animated normalmap sprite file which I want to use as a normalmap.
How can I use this as a normalmap and cycle through the frames?

Re: animating bumpmaps [Re: Josh_Arldt] #77260
06/09/06 21:49
06/09/06 21:49
Joined: Apr 2005
Posts: 3,815
Finland
Inestical Offline
Rabbit Developer
Inestical  Offline
Rabbit Developer

Joined: Apr 2005
Posts: 3,815
Finland
I'm not even close to know ánything about shaders, but in the effect, just flap through the skin frames?


"Yesterday was once today's tomorrow."
Re: animating bumpmaps [Re: Inestical] #77261
06/09/06 22:04
06/09/06 22:04
Joined: Sep 2004
Posts: 1,214
Austin, Texas
Josh_Arldt Offline OP
Senior Developer
Josh_Arldt  Offline OP
Senior Developer

Joined: Sep 2004
Posts: 1,214
Austin, Texas
hmmm... Your idea gave me an idea...
What if I just keep changing the skin2 of the material every frame?

Re: animating bumpmaps [Re: Josh_Arldt] #77262
06/09/06 23:30
06/09/06 23:30
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
Yes this would work.. could be done with a bitmap pointer.



Sphere Engine--the premier A6 graphics plugin.
Re: animating bumpmaps [Re: Matt_Aufderheide] #77263
06/10/06 00:02
06/10/06 00:02
Joined: Sep 2004
Posts: 1,214
Austin, Texas
Josh_Arldt Offline OP
Senior Developer
Josh_Arldt  Offline OP
Senior Developer

Joined: Sep 2004
Posts: 1,214
Austin, Texas
Hmmm a bitmap pointer you say?
What did you have in mind Matt?

bmap* anim_normal = <anim_normal+10.tga>;

Then maybe somewhere...
while(1)
{
anim_normal.frame+=time;
wait(1);
}

???

Re: animating bumpmaps [Re: Josh_Arldt] #77264
06/10/06 03:50
06/10/06 03:50
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
Happy Birthday xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Something like that should work. You wouldn't even have to change the shader

Just animate a bmap, and pass it to the shader as a mtl_skin via the skin var...


xXxGuitar511
- Programmer
Re: animating bumpmaps [Re: xXxGuitar511] #77265
06/10/06 03:55
06/10/06 03:55
Joined: Sep 2004
Posts: 1,214
Austin, Texas
Josh_Arldt Offline OP
Senior Developer
Josh_Arldt  Offline OP
Senior Developer

Joined: Sep 2004
Posts: 1,214
Austin, Texas
Yes, exactly. I haven't tried it yet. I just wanted to get a general idea of what I'm going to do before I get around to it.

Re: animating bumpmaps [Re: Josh_Arldt] #77266
06/10/06 05:01
06/10/06 05:01
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
Happy Birthday xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Kool. I can't wait to see if it works out (or not). I'd write some code up for you, but I'm just too damn tired right now. Maybe I'll type somethin up tomorrow mornin'. If you can get the shader, I can try and animate it. lol.

What would be the best way to do this though? You could use the models skins as frames:
Code:

bmap* CMap;

// Animate an Entity by changing the frame parameters.
action AnimateMap
{
my.skill2 = 0.5; // Speed to animate
my.skill3 = 1;
while(1)
{
my.skill1 = cycle(my.skill1 + (my.skill2 * time), 1, ent_skins(my));
my.skill3 = int(my.skill1) + 1;
bmap_for_entity(my, my.skill3);
//
wait(1);
}
}



Then the pointer CMap is set to the skin that needs to be used for the shader mapping. This loop will not include the first skin of the model. This way you can have the models first skin the diffuse map. Then fill the other skins with the normal mapping frames. The above action will cycle through them, and set the predefined bitmap pointer to the entities skin.

The code above is made to work with only one entity though. For multiple entity support, you could simply set up an event for the shader.

Code:

function GetSkin();

material mat_IDK
{
enable_render = on;
event = GetSkin;
effect = "Whatever...";
}

function GetSkin()
{
mtl.skin1 = bmap_for_entity(my, my.skill3);
}

// Animate an Entity by changing the frame parameters.
action AnimateMap
{
my.skill2 = 0.5; // Speed to animate
my.skill3 = 1;
my.material = mat_IDK;
while(1)
{
my.skill1 = cycle(my.skill1 + (my.skill2 * time), 1, ent_skins(my));
my.skill3 = int(my.skill1) + 1;
//
wait(1);
}
}



This code will work with multiple entities, but will also take up more resources.

Say an entity has 6 skins. 1 diffuse texture, and 5 bumpmaps. This code will cycle through skins 2 - 6, and send the current one to the shader each frame. This way you can animate your bumpmaps. It will also work with multiple entities. As many as you want.

* The code above is not tested. Theoretically, it *should* work... If I had a model with animated bumpmaps to test it with, then i would.

Last edited by xXxGuitar511; 06/10/06 16:31.

xXxGuitar511
- Programmer
Re: animating bumpmaps [Re: xXxGuitar511] #77267
06/13/06 02:45
06/13/06 02:45
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
Happy Birthday xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
@Josh_Arldt:
Lose interest in the idea?


xXxGuitar511
- Programmer
Re: animating bumpmaps [Re: xXxGuitar511] #77268
06/25/06 06:51
06/25/06 06:51
Joined: Sep 2004
Posts: 1,214
Austin, Texas
Josh_Arldt Offline OP
Senior Developer
Josh_Arldt  Offline OP
Senior Developer

Joined: Sep 2004
Posts: 1,214
Austin, Texas
Thanks man.
No I haven't lost interest in the idea.
I haven't had much free time lately.
It's of a lower priority on my to-do list.


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