Hello Guest

Author Topic: Creating Texture2D from diced atlas  (Read 4361 times)

mitralone

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
Creating Texture2D from diced atlas
« on: March 29, 2014, 05:46:28 am »
Hello,

I need to get a single sprite from a collection and convert it to a Texture2D to post to facebook or twitter. My atlas is diced so I am not sure how to get it from the atlas.

Is there any way possible to get it from the mesh of the sprite or any export command to simply write the contents of the sprite into a Texture2D?

Thanks

Mitralone

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Creating Texture2D from diced atlas
« Reply #1 on: March 29, 2014, 11:49:18 am »
Not directly, but you could create a render texture, draw the sprite into it and grab the pixels from there.

mitralone

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Creating Texture2D from diced atlas
« Reply #2 on: March 29, 2014, 08:38:40 pm »
Well, thats a pro feature :) anything I can do with free version?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Creating Texture2D from diced atlas
« Reply #3 on: March 29, 2014, 09:43:07 pm »
Well you can create it but it will require reading a bunch of textures working out UVs and writing pixels out manually. Once you find the spriteDefinition sprite collection data, you will need to walk through all the quads work out the min and max uv values, then write that out into the final texture. This is doable, but a pain.