This scanner light plane need to block by walls, player, other guard during the game playing. At first I was trying to do this by creating a new type of light in unity. I learned about the light cookies and try to use to two light to fake this effect, but then I find out it is impossible to do it in unity. I can not change the light cookies into a shape of scanner plane. Then I had thought about raycasting. but it needs to check a lot of points for the plane
Then I try to make a volume light in unity which I think will be the best way to do it.
This is a fake volume light in unity which looks like what I need but it still go through the player which can not work for us.
Another link is the Unity3D Extension: Volumetric Light Beam Kit I followed the way they do it and found out this one looks so good like below, but it will still go through body.
Then I realize I need to change the way to do. I did some researching on the internet and found this.
Depth Mask Unity
In this example the boat shows perfect, although the water part is higher than the boat like the picture below, but because of the new rendering shader which is called Depth Mask.
So I starting to do the same way and wrote my own shader but I only get the thing like this.
It shows good but I can not find a way to calculate the length of invisible cube, to stop the light plane to show after go though the invisible cube.
I had to say at this point. I was so frustrating about it. I worked for nearly two weeks and it turn to nothing.
OH MY GOD!!!!!
I went to Jack to talk about the this and Max also come to me to try to help me out. But we still can not find out a way to do it.Then I got some intelligence from our programming class from Shane. We talked about this problem on Class and decide to fake it, to separate the scanner plane to six pieces and do the ray casting on each piece. We know this is not perfect, but it will work. Sometime you really need to be cowboy programmer.
So I just did as we discuss on the class and it only took me like 3 or 4 days to finish it

没有评论:
发表评论