Hi there, Is it possible to hide objects behind a predefined area of a texture? Let's say, I have a texture with the aerial view of a street with a bridge and I want to have a car drive on the road, under the bridge, then the car needs to be hidden when it's under the bridge.
I know, I could render the whole thing again with an alpha (so only the bridge is visible in the second layer) on top of the first layer but is there a better version where i can just determine an area where the car is visible and where not?
asked Nov 30 '11 at 01:42 AM
Purely FWIW Somian. we've done this sort of thing a number of times, and for the overs I've simply put a small rectangle sitting in space where the bridge would be, and put a little bit of texture on to that (either a small image, or just align the big image).
I've never bothered doing one big image for the overs (as you describe) where you just knock-out the non-bridge sections in photoshop. (That's a good idea! - it might be a little inefficient?)
As I'm sure you know, none of this "really works" unless it's "really" 3D. To get effective shadows, and so on, and the really effective look of the car going under, you do need the bridge to actually be at least reasonably bridge-shaped (say one up, one flat, and one down at least -- if not "an actual realistic 3D model").
My point is if you really want a really true 3D look, it's one of those disgusting things where you have to "give up and do it properly" from the get go! Horrible, but true. A simple solution of overs and unders won't work.
BTW as I'm sure you know, you could just make a trigger area and just turn the car off altogether when it is under the bridge -- obviously though it would then disappear/appear all at once instead of partially as it goes under. Depending on the scale, speed, and feel of the graphics, that may be a good solution, or may not. (It could work well for small avatarish objects, train-logic-type games, say pedestrians popping under a bridge, or other graphicky situations.)
I am fairly sure there is no "disappear under here" solution, such as you describe. (Unless you want the car to flip on/off in binary.) You could probably do it using the layers paradigm in Unity and mixing cameras or something, but it would be a huge kludge.
A silly approach that comes to mind is using a projector in some way to project the over.
I fear the answer here is "on the hard way!"
answered Nov 30 '11 at 10:42 AM