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
4 registered members (AndrewAMD, TedMar, dr_panther, Ayumi), 1,048 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
animated texture for models [Q] #376498
07/03/11 14:23
07/03/11 14:23
Joined: Feb 2010
Posts: 68
mireazma Offline OP
Junior Member
mireazma  Offline OP
Junior Member

Joined: Feb 2010
Posts: 68
I need an animated texture for a model. I can't use sprites over the normal texture because I also need bump and parallax so the only way (I can see) is to replace the texture every frame of the game with a whole new texture that represents the subsequent frame of the "animated" texture (I couldn't express myself any better and preserve the clarity :)). And it's more: I must have control over the animation frames (the speed of "playing").
I think the best option is to use ent_setskin I have a doubt: The manual says:
Quote:
Skins can be replaced by calling ptr_remove for removing the skin returned by ent_getskin, and then setting the new skin with ent_setskin.

Is it really necessary? Can't I just call ent_setskin directly?
My guess is the worst that could happen is not freeing the memory containing the old useless texture. But since I intend to reuse that texture (the "animation" is a loop) I don't want to flush it anyway. But I don't want any internal unknown bugs by not removing the old texture first.
Plus I want to set the skin every single frame and that would cost me fps's cause ent_setskin is rated fast but ptr_remove is medium.
Otherwise, is there a better way for creating an "animated" texture for a model?


ERROR in communism.cpp, line 0:
#include<god.h>
was fatally missed.
Re: animated texture for models [Q] [Re: mireazma] #376528
07/04/11 00:22
07/04/11 00:22
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
what kind of animation are you using. possibly use a shader to display the portion of the bmap for each stage of the animation?

Re: animated texture for models [Q] [Re: MrGuest] #376540
07/04/11 08:41
07/04/11 08:41
Joined: Feb 2010
Posts: 68
mireazma Offline OP
Junior Member
mireazma  Offline OP
Junior Member

Joined: Feb 2010
Posts: 68
That would be very convenient. Wouldn't have to deal with ent_setskin or anything. I know shaders could be made to achieve all kinds of things visually, but to be honest, I haven't thought of such a shader.
The animation is this:

I have a tank and I need the tracks -- both wheels and linked tracks themselves -- to animate as the tank moves. Let's say I'd offset the UV to scroll the linked tracks but what about the wheels? they need to rotate and the bigger picture is I'd use the shader in other projects, as well.
Here is the track model:

Btw this is the default 3DSG parallax effect which is faulty, as you can see, but that's a different story...
The linked track (the part that goes on the ground) will have stripes not the way the track goes but across, to suggest the links but the diffuse texture is not ready yet.

+'s and -'s:

- The trick is I want to use bump and parallax as well. How does this get along with the method? Would it work? And would it require that the normal/height mapping textures be of the same format?
+ The texture size is small so the frames would fit into a 512 x 512 or maybe even 256 x 256 texture.
- only a few polys of the model need animated texture so there'd have to be both "dead" and "animated" parts into the same texture (not necessarily a minus but makes the shader more complicated)

I'm far from making my first shader (to say the least). Do you know of one that does what you said?

Last edited by mireazma; 07/04/11 08:46.

ERROR in communism.cpp, line 0:
#include<god.h>
was fatally missed.
Re: animated texture for models [Q] [Re: mireazma] #376560
07/04/11 12:50
07/04/11 12:50
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
The parallax shader is not faulty, you are using it wrong. Why do you even try to make a tank with a shader and ~20 polygons? My advice: Scrap your idea and start all over again.
You can, f.i., take a quad (2 triangles) (for each wheel) and assign a wheel texture with alpha channel. Now you can animate the wheels easily by rotating them. The tracks should be a separate entity (to keep it simple) where you can now easily shift the U/V parameter.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: animated texture for models [Q] [Re: Superku] #376567
07/04/11 13:52
07/04/11 13:52
Joined: Feb 2010
Posts: 68
mireazma Offline OP
Junior Member
mireazma  Offline OP
Junior Member

Joined: Feb 2010
Posts: 68
Thanks, Superku. I'm not only open to, but I always appreciate new ideas.
But you see, it's hard to follow your sig in my case wink.
I'm making a RTS game and I took into account about all the "terms" that would make the balance between visual richness and video load. I assumed like 500 objects simultaneously rendered, out of which 250 are tanks (a tank would be made out of ~5). This would be a peak, but encountered often. So I need to reduce the polys accordingly and still get the 3D feeling for the tracks (not to mention the animation...). I can't afford more objects in a tank.
And about the faulty use of the shader -- although I'm so tempted to do it, I'm not that rude to ask you for help once again. You already helped me once with an external topic laugh But believe me, I'm disappointed about the parallax.

Last edited by mireazma; 07/04/11 13:52.

ERROR in communism.cpp, line 0:
#include<god.h>
was fatally missed.
Re: animated texture for models [Q] [Re: mireazma] #376568
07/04/11 14:04
07/04/11 14:04
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
I already told you that parallax is only for plane surfaces, like floors or simple boxes, the same for occlusion shader.


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: animated texture for models [Q] [Re: painkiller] #376574
07/04/11 14:51
07/04/11 14:51
Joined: Feb 2010
Posts: 68
mireazma Offline OP
Junior Member
mireazma  Offline OP
Junior Member

Joined: Feb 2010
Posts: 68
Painkiller, I replied in that specific topic


ERROR in communism.cpp, line 0:
#include<god.h>
was fatally missed.
Re: animated texture for models [Q] [Re: mireazma] #377095
07/10/11 01:32
07/10/11 01:32
Joined: Aug 2008
Posts: 482
B
bart_the_13th Offline
Senior Member
bart_the_13th  Offline
Senior Member
B

Joined: Aug 2008
Posts: 482
Use LOD
When you want to see 500 tanks on screen, that means the camera is very far away from the scene so the tank can be shown with less detail, I guess no one will notice that their wheel and tracks is moving or not. Except the 500 models occupy the same spot since you forgot to add collision grin
Then when the camera come closer, use the tank with more details, maybe using Superku's method, but instead of separating the wheel from the tank(and having them as different entities) you can stick them in the model and rotate them by animating it directly, you can control the rotation by using ent_animate.

[EDIT]
usng ent_setskin affect all entities sharing the same model, that mean you can't have one model animated while the others not

Last edited by bart_the_13th; 07/10/11 01:33.

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