2D Toolkit Forum

2D Toolkit => Support => Topic started by: korn3l on October 16, 2013, 03:08:59 pm

Title: Depth Mask negative depth
Post by: korn3l 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 ?
Title: Re: Depth Mask negative depth
Post by: unikronsoftware 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...
Title: Re: Depth Mask negative depth
Post by: korn3l 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.
Title: Re: Depth Mask negative depth
Post by: unikronsoftware 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.