Hello Guest

Author Topic: Depth Mask negative depth  (Read 4561 times)

korn3l

  • Newbie
  • *
  • Posts: 12
    • View Profile
Depth Mask negative depth
« on: October 16, 2013, 03:08:59 pm »
Currently tk2dUIMask won't work if we set a negative depth. I tried modifying the depth mask shader ZTest to GEqual, but it won't work. I tried modifying the script changing all the "-depth" values to "depth", but it still won't work.
I'm starting to think that this isn't possible. Is there a workaround for this ?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Depth Mask negative depth
« Reply #1 on: October 16, 2013, 03:10:04 pm »
Just move it back physically? It clips inside the blue volume, so just move it in such a way that the blue volume encompases what you want to clip...

korn3l

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Depth Mask negative depth
« Reply #2 on: October 16, 2013, 03:58:32 pm »
I use a perspective camera and because of that the mask will "slide" over my sprite, because of the mask "moving" faster than the sprite just behind it.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Depth Mask negative depth
« Reply #3 on: October 17, 2013, 01:26:56 am »
If you're masking 2D elements, it might be easier to have a second 2d camera in there?
Anyway, you can modify the mask object to work with negative depths - the way its set up is the mesh z is pushed back by "depth" and the sorting order is kept at z=0. All of this happens in FillMesh - you should be able to modify it to work whatever way you like. The code that does this is very isolated.