Hello Guest

Author Topic: Composing a (alpha-textured) sprite onto another sprite to make a hole  (Read 3298 times)

polphit

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 1
    • View Profile
Hello,

I would like to make a wall on which (at random position) a window is. I want to see scenes through the window.
So I want to
    1) make a wall sprite W
    2) render a window (a hole and its frame) sprite H onto W
    3) here, a region (in H) of alpha = 0 should be a hole in W after the composition

Can anyone help me to do it?
thank you in advance.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Composing a (alpha-textured) sprite onto another sprite to make a hole
« Reply #1 on: October 03, 2013, 05:49:22 pm »
You can use render textures if you have Unity Pro. Or if you don't, you could use texture.readpixels & setpixels to read and modify the texture. This is a slow operation though, so you don't want to do this every frame.