Author Topic: Sharing Atlas Between Multiple Materials  (Read 1997 times)

Ferazel

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 150
    • View Profile
Sharing Atlas Between Multiple Materials
« on: October 04, 2012, 11:34:10 AM »
Does anyone know the best way to share the same texture2D atlas with multiple materials/atlases? I want to have a lit material for sprites in some conditions, but in most conditions I want to use the standard transparent unlit/transparent colored shader. I don't want to duplicate the texture2D data, but rather just have a material with a lit shader that references the same texture atlas (Texture2D). Then I can use the lit shader on some panels, and the unlit shader in other panels. I tried to replace the material on the panel, but that looks like it is updated dynamically. I tried to make a texture atlas reference, but it seems to use the same material as the original atlas?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Sharing Atlas Between Multiple Materials
« Reply #1 on: October 05, 2012, 08:37:56 AM »
The best way would be duplicating the atlas and material, then changing the shader on one of those materials. That said though, as soon as you update one atlas, it will be out of sync with the other. I don't advise trying to save texture memory this way as it will cause you headaches.