I’m cooking up a scene where a character uses an umbrella as a floatation device. The probolem is the water plane shows through the umbrella and of course completely ruins the illusion of the umbrella properly submerged in the water. I can’t think of anyhting to solve this problem and I’d love to hear any creative solutions. Attached pic shows what I mean.
No, I want it to look submerged. With two layers it would always be in front and look like it was on top of the water plane. I was thinking maybe a texture/plane that becomes enabled once the umbrella hits the water plane. The texture/plane would be a flat representation of the part of the umbrella that is “underwater”. But there’s also the character riding this umbrella that needs to look like he’s sitting in it. Aargh, this is just like Bill’s radar system of doing realtime booleans cutting off pieces of ships entering the radar sphere… I don’t know if it’s possible.
One more hack idea, if you just need to view your character in 3rd person, you might be able to get away with having a bone linked to the point of the umbrella or an animation so when it is “submerged” you squash the top of the umbrella to flatten it out. Depending how your character sits in it you might be able to get away with it to a small extent.
I really like the idea of an umbrella ad a flotation device btw. Pretty cool.
Hmmm, how about flattening out the inside top of the umbrella and parallax/normal mapping it so it still has the illusion of shadow depth below that point? That could work tweaking the textures just right! The character could sit on that and look pretty good if in the right pose. Cool, thanks again man.
If I understand what you want correctly, would it be practical in your situation to cut out a shape in the water mesh for the umbrella to sit in and move that mesh with umbrella ?
Use render-to-texture to draw a solid circle the size of the umbrella’s circumference at the section where it intersects the water plane at the appropriate location on the water plane.
Then, use this solid circle as an opacity map to create a see-through section in the water plane.
You can do it with a vertex shader. I had a similar thing with my 3D map, while not solved (don’t have a good enough gfx card) it is possible to cull geometry in a shader. Irregular shapes are hard obviously, but a sphere is doable. Look at my last post in my sphere map thread. That code came from one of Neil’s friends, all it does it cull any thing in the radius of the sphere. It will require Cg, but it’s possible since a umbrella is basically a piece of a sphere. Hope that sort of helps.
Heya, Bill. So, what exactly does this cool-looking shader do? Do you havce an example movie? I’m always keen to enjoy some of your awesome shader-work!
Well it would need to be written in Cg which I really haven’t got into since by gfx card is not up to par. Give me a few months when I get my macBook pro and I will have a demo. I was just saying it could be done.
Step right up one and all, pitch in your spare change to the "Buy Sync1B a Macbook for the betterment of the Unity Shader Library. Thats right for a small donation you will be doing your part to improve the developer community.
I just thought of a crazy idea, maybe you could modify a projector to project alpha. It would take some fine tuning of the projector placement, but it might work? I will look into that, Aras, what do you think?
Another cheat that occurs to me is that you could put a flat polygon at the water level inside the umbrella and texture map it with a picture of the inside of the umbrella (already suggested.) But that picture could be a visually correct picture generated on-the-fly with a second camera, using render-to-texture. So the lighting, hero’s feet etc would look correct, theoretically.
This is possible. I know someone who managed to get a boat to float in water without water appearing inside the boat, but he did it using OpenGL directly in a program he wrote himself. I believe the trick is to use the depth (Z) buffer to prevent the water from being drawn on the inside of the boat, presumably by drawing an invisible, depth-writing plane across the top of the boat’s hull.
Unfortunately, this is drawing-order dependent… you’d need to draw the boat first, then the invisible plane, then the water. I don’t know if it’s possible to get Unity to do this. You might at least be able to put the water into the transparent objects queue (using a shader) so that it gets drawn later.