Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (flink, AndrewAMD), 656 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Sprite Animation #463468
12/05/16 20:55
12/05/16 20:55
Joined: Sep 2005
Posts: 352
Germany
preacherX Offline OP
Senior Member
preacherX  Offline OP
Senior Member

Joined: Sep 2005
Posts: 352
Germany
Ist es normal/gewollt, dass wenn man ein Sprite, welches z.B. 512 Pixel breit ist, in eine Datei mit 12 Frames legt ("Beispiel+12.png") und dann aufruft, eine Oversize-Warnung erzeugt wird? Bei A7 passierte das meines Wissens nach nicht. Wie behandelt die Engine solch ein Sprite? Kann es bei älteren Grafikkarten dadurch zu Problemen kommen?
Oder wäre es sinnvoller, 12 einzelne Sprites zu erstellen und die Animation mit ent_morph durchzuführen?

Re: Sprite Animation [Re: preacherX] #463896
01/04/17 13:35
01/04/17 13:35
Joined: Sep 2005
Posts: 352
Germany
preacherX Offline OP
Senior Member
preacherX  Offline OP
Senior Member

Joined: Sep 2005
Posts: 352
Germany
I will try it in english and with an update of the question:

I'm getting an oversize error if I create a sprite with many frames ("example+12.png") even if one frame is only using a resolution of 128x512 pixel.

In A7 such a sprite was seperated into 12 pieces and generates no error.
But A8 seems to take the complete texture and uses the UV-coordinates for animation. But this could be a problem for some graphic cards, or not?

Can I change this behaviour to A7 somehow?

Re: Sprite Animation [Re: preacherX] #463985
01/11/17 17:01
01/11/17 17:01
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
From what I see in the source code, A8 indeed uses a single image for sprite animation. I think the only way to use separate images for animation is changing the bitmap in an entity action.

Re: Sprite Animation [Re: jcl] #463994
01/12/17 08:34
01/12/17 08:34
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
or you can use a shader to animate the sprite like I did, then you can use rows and columns to keep texture size below limits. I used the following snippet in the pixel shader to animate the sprite LODs of my RTS units (animation frames stored in columns) and use to the correct animation sequence according to camera and character angle difference (stored as direction 0-7, where direction = angle/45), see comments at the end of lines placed a bit far:

to get actual values from entity skill:
Code:
float4 vecSkill41;							// x frame, y width, z direction, w height


pixel shader uv calculation:
Code:
//----------------------------------------------------------
// texture - keep its alpha afterwards
	
float2 Tile = 0;
Tile.x = frac(In.Tex.x * vecSkill41.y + floor(vecSkill41.x) * vecSkill41.y);				// x frame 0..7, 			y unit-width, 			frac for safety				frame is fine with floor(vecTime.w)
Tile.y = frac(In.Tex.y * vecSkill41.w + vecSkill41.z * vecSkill41.w);						// z direction 0..7, 	w unit-height, 		frac for safety
	
float4 Color = tex2D(colorSampler, Tile);										
   
//----------------------------------------------------------



Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Sprite Animation [Re: sivan] #464029
01/15/17 00:21
01/15/17 00:21
Joined: Sep 2005
Posts: 352
Germany
preacherX Offline OP
Senior Member
preacherX  Offline OP
Senior Member

Joined: Sep 2005
Posts: 352
Germany
Thanks for the response and thank you sivan for the example!


Moderated by  old_bill, Tobias 

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