Hello Guest

Author Topic: Runtime Atlasing using RenderTexture  (Read 4322 times)

darvy

  • Newbie
  • *
  • Posts: 3
    • View Profile
Runtime Atlasing using RenderTexture
« on: November 16, 2014, 08:11:23 am »
I am in the middle of implementing Runtime Atlasing through the RenderTexture method described in this thread ( http://2dtoolkit.com/forum/index.php?topic=4219.0 ). However, I am having trouble with the part where the sprites need to be packed into the view of a camera. Namely,

1) In what way should the sprites be rendered? Is it through Texture2D?
2) How do I pack the sprites into efficient positions?

I am sorry if these questions are obvious, but I have been stuck on this problem for quite a while and even implemented the feature through Texture2D.PackTextures, however its performance is simply not efficient enough for what I need.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Runtime Atlasing using RenderTexture
« Reply #1 on: November 16, 2014, 11:49:46 pm »
This method is completely out of scope for 2D Toolkit, but some info nonetheless -

1. You'll need to draw the sprites as quads, using GL.Begin / GL.End, or as runtime meshes (using runtime sprite collections on the source textures) with a second camera, etc.
2. You have the source to tk2d, you can get the algorithms tk2d uses to pack these textures. tk2dAtlasBuilder.cs and friends.

darvy

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Runtime Atlasing using RenderTexture
« Reply #2 on: November 17, 2014, 03:59:54 pm »
Thank you very much for your help. Hopefully this feature will be added into tk2d soon ( it is already on the roadmap ). With all the games that include character customization out there, this feature would really put tk2d above other frameworks.