One spriteSheet for different objects with different UV mapping

Software: Away3D 4.x

Matej, Jr. Member
Posted: 28 May 2013 07:51 AM   Total Posts: 38

Hello,

I have one spriteSheet that I would like to use as Texture for different Objects.

Because, before I was using animating UV to move the texture for each object individually, now I wonder how to create it with SpriteSheetAnimator.

Lets say my SpriteSheet is 1024x1024.
My first model has UV mapped to 128x128 or (1/8,1/8) of UV.
My second model has UV mapped to 128x512 or (1/8,1/2) of UV.

Should I now map my models to (1,1) UV?
and if I do that for first model I make

spriteSheetHelper.generateSpriteSheetClipNode(animID88); 


and for second model

spriteSheetHelper.generateSpriteSheetClipNode(animID82); 

and then SpriteSheetAnimator makes inside GPU part of the SpriteSheetTexture as whole texture for model, there for 1,1 UV

Is that correct?

 

   

Avatar
Fabrice Closier, Administrator
Posted: 28 May 2013 08:09 AM   Total Posts: 1265   [ # 1 ]

If you use the helper, yes it generates the animatio grid using 0-1 range.
However, (I need extend the tut on this) you can actually define what ever region, using the mesh uv range as you please.
However if you share the animatorSet, it will not work on meshes having other uv’ing unless you define more sets using other custom nodes.
In short you’d be better off keeping all within 0-1 and reuse the same animation data and material and have other animators. Pretty much as shown in second part of the tutorial.

   

Matej, Jr. Member
Posted: 28 May 2013 08:26 AM   Total Posts: 38   [ # 2 ]

Thank you.

   

Matej, Jr. Member
Posted: 28 May 2013 10:42 AM   Total Posts: 38   [ # 3 ]

I am getting Error

A Material instance cannot be shared across renderables with different animator libraries

Seems like that since I create two different animationSEts this error pops out.

The reason for two sets is because like I wrote before, one object uses 128x512 image from SpriteSheet and another uses
128x128 image from SpriteSheet.

So I have to create two ClipNodes with different rows and columns, because both textures for both objects are in the same sprite sheet.

Can this be avoided or do I have to create one animation set for each object?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X