Hello Guest

Author Topic: Cutout shader  (Read 4926 times)

polluper

  • Newbie
  • *
  • Posts: 2
    • View Profile
Cutout shader
« on: September 08, 2015, 01:30:08 pm »
Hi,

I have just purchased your wonderful asset, absolutely amazing!
I do have a problem though, I try to make a wall with some cutouts for windows. Since the windows can appear anywhere (generated dynamically) I've created a sprite for the window-hole with tk2d CutoutVertexColor, and place it over the wall which have tk2d SolidVertexColor.

Unfortunately nothing happens, no hole no matter how I change the z-order/sorting orders. What am I missing?

Is it also possible to cutout only the wall, and have a room sprite behind it, which doesn't get cut out?

Thanks in advance! 

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Cutout shader
« Reply #1 on: September 09, 2015, 03:35:18 pm »
> Unfortunately nothing happens, no hole no matter how I change the z-order/sorting orders. What am I missing?
What kind of camera are you using? Is it perspective or ortho?

> Is it also possible to cutout only the wall, and have a room sprite behind it, which doesn't get cut out?
Not sure what you mean by this, could you post a pic to explain?

polluper

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Cutout shader
« Reply #2 on: September 10, 2015, 08:15:27 am »
Thanks for the reply.

I am using an ortho camera. I have made a mockup of what my end goal would be.

There are 3 sprites on the image:
- the blue room, which should be visible through the window
- the transparent sprite with black outline (just for the mockup, invisible otherwise) which cuts through the wall exposing the room
- the brown wall which normally overlaps all the rooms

I have made some digging around and it seems that depth mask would be the one I need to achieve this, however I don't know how to use that either.
Could you please help me how to set this up (which sprite should use which shader) with tk2d? Thanks!


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Cutout shader
« Reply #3 on: September 10, 2015, 10:49:52 pm »
If you want to use the depth mask look at the UI Mask sample. You can also use unity stencil but that'll require some custom shaders but it'll be easier to use. You'll need to split up the masking and outline so you'll need more than one sprite there.