- Home /
The question is answered, right answer was accepted
Grey out part of the scene from rendering
If interested, see Edit at the bottom
Hey,
I can think of where to start from with this...
The user can place a point on the terrain, then give a radius, and everything outside of that circle is greyed out. Terrain, object, all.
The idea is that, inside the circle, everything is rendered normally but outside the circle, everything is grey.
Considering that the camera is also able to move around (in all directions) that means I cannot just use some kind of plane with a transparent grey texture at the distance...Also, I cannot just put a thick fog at the distance since it would move away with the camera approaching the edge of the circle.
I thought of particle system but it sounds really expensive since the terrain is really long.
I just need something to start with. Maybe Unity has something like this that I do not know about...
Any tips? Thanks already.
EDIT: Ok, I do not have the answer yet as I have had not time to really try but I thought of a possible solution.
The problem I had is that the camera is moving and the fake fog should be staying where it is so fog or object attached to the camera wont do.
But One thing I can do is use a simple distance script and render all of my object in grey by accessing their renderer and turn them all to grey. It would take time but the application can have a stop, it is not a game.
All I need is to render my terrain "normally" in the radius and apply a grey texture anywhere else.
I could use a for loop iterating over the whole terrain and if the position is outside the radius, I could apply a decal on top.
Well, I will try it, if someone would know right on how to do that, it would fasten my process.
Thanks
Actually yes something like this!!!. I see the page on wikipedia about fog of war but it's only half of it. From what I see, the camera is always above but in my case, the camera is still able to move in 3D. That means when the camera reaches the edges of the circle, it renders grey on one side and colorful on the other.
It would be like being in a normal environment and suddenly entering a totally grey world.
That sounds a little too far fetched so I might have to lower the requirement.
Actually, the application has nothing to do with war or even game. It is for a road and transportation institute. The idea is that the circle defines a zone where it is allowed or not allowed to build something. For instance, you have a monument and within 200m no building taller than 20m can be build. The user places the point on the monument, defines 200 for radius, now we have a colorful zone indicating where it is not allowed.
Answer by fafase · Jun 10, 2013 at 11:47 AM
Ok I got my solution and it is actually so dumb that it did not occur to me before.
All I do is setting my main light down to get the whole world dark and then I use a spot light directed to the ground with a cookie to make the edges sharper.
I wanted to add a pic of the result but I am not allowed as the question has already exceeded the amount of space or else. So trust me...
Answer by ByteSheep · May 25, 2013 at 11:21 AM
This is a fairly late reply (funnily enough did see it in the advanced question section eventually), have you thought about trying to use subtractive rendering?
You could create a plane parallel to the ground covering the scene and then use the method in this answer (http://answers.unity3d.com/questions/404637/subtractive-rendering.html) to cut a circular hole in the plane at the position you need it.
In addition you could make sure the plane covering the rest of the scene always is rendered above everything else - (maybe using two cameras or this technique? http://answers.unity3d.com/questions/8220/rendering-order.html)
Here's an example - you can move the circle with WASD, move the camera with Q/E and make the circle radius bigger or smaller with G/H. It's pretty rough but you get the idea. Hope I understood correctly what you are trying to do :)
That would be the closest way I could try for now. I need to see with the "customer" what he meant exactly. The perfect way would be to have all terrain and object greyed out but I doubt this is possible without deep manipulation.
The plane over the terrain is halfway only since the terrain may relief, it would be that either the plane is up high enough to be over all relief or some relief are getting through. One solution I thought of could be to duplicate the scene (terrain and objects) with a grey rendering, same transform only with a y of +0.1 and then apply the subtractive rendering on the position...may be a little far-fetched though. I will try and report anyway.
Follow this Question
Related Questions
Unity terrain and odd frustum culling behavior 0 Answers
Far away details aren't rendered 2 Answers
I Have Glitch Problem Car Move At time car back light and num plate glitch 0 Answers
Is it possible to only render on one side of a plane? 4 Answers
ClearFlags don't seem to work when I manually call Render() on my cameras. 0 Answers