PDA

View Full Version : objects as a mask



wibly wobly
01-21-2014, 08:22 AM
I'm trying to wrap my head around a way to do this and I haven't been able to find a way, and I'm drawing a black searching. Basically, what I'm trying to do is use an object and it's position to generate a clip map. I don't want to use a texture as a clip map because it will run straight through on a Y axis, I want to punch a whole in a a background object where the foreground object obscures it (without seeing the FG object). To further elaborate, I have a shallow boat and you can see the generated water in the bottom because of it's open design. I want to use a simple wireframe mesh that sits at a higher plane in the boat and wherever you see that FG object, it will cut a hole on the water. Otherwise, if I use a textured clip map, it's too wide because boats are wider higher at the top then at the bottom.

Cheers.

ernpchan
01-21-2014, 08:34 AM
You could use an object that's set to be a Matte object in the object properties.

wibly wobly
01-21-2014, 08:55 AM
I'd rather not just use the clip map setting under the object/render settings to create the whole as I'd have to render out multiple passes (I'm assuming this is what you're referring to). I'd like to track the item info of the object through a node tree to create it so I don't have to worry about rendering more layers. I just haven't been able to figure out how. I'm sure the nodes are there to make this but, I haven't been able to figure out how to make an item cut a whole in another.

Danner
01-21-2014, 08:59 AM
I don't think Ernpchan understood your question, matte objects are used for making compositing passes. In this case compositing is a good idea, but a simpler solution can be made if you save out two diffrent versions of your scene, one with everything (including the boat if you want it to reflect on the water), and the other just the boat. Render both sequences, the boat sequence with alpha, layer the boat pass on top of the water pass and you are done.

jeric_synergy
01-21-2014, 09:01 AM
Riiiiiiiiiiiiiight (pounding head w/fists)... I did this YEARS ago. --Now, how did I do that?

IIRC, I used SURFACE EFFECTORS. I don't think we even have them any more.

Well, here's one way:

make a poly that's the cross section of the hull at the altitude you want the boat to be in the water (in "drill speak", the 'core' of the water and hull)
render out a mask of that poly head on (90*)
trim the mask image to have minimal borders
load the mask
parent a NULL to the boat
assign the image as a clip map to the water
use the NULL as the image's REFERENCE OBJECT
the NULL and the IMAGE will move w/the boat,
and having a null will allow you to cheat it +-X/+-Z

jeric_synergy
01-21-2014, 09:07 AM
The above will work right away (no nodes!) but if you want to explore a nodal solution I'd suggest looking into DPont's BOOLEAN node....thingy. I have no idea how it works, but IIRC it will allow you to have one object cut away another much like a clipmap, but in 3D.

This is a superior solution for a more cartoony boat that jumps out of the water a lot.

wibly wobly
01-21-2014, 09:19 AM
Thanks guys. Your methods you're describing are is something I'd prefer to avoid. I'm going to be rendering out object passes and layers as it is and I'd just like to avoid having to play around with yet another thing in AE. I'd like to have a totally in LW solution. I have too many other things I'd rather have to pay attention to.

edit: The only thing I've found so far about DPont's BOOLEAN node is that it was crashing a lot of people. :/ I'll give it another look. I don't remember seeing much documentation about it.

ernpchan
01-21-2014, 09:20 AM
Yeah I may have jumped the gun on my response. Using the matte object route will let you cut a hole out as a whole in your render. It's not gonna work on an individual layer/object like how a track matte works in AfterEffects.

jeric_synergy
01-21-2014, 09:21 AM
??? I'm not talking separate passes: the REFERENCE OBJECT clip map works entirely within LW.

The clip map render is ONE image, not a pass. Once its prepped, you're done.

0_o

Danner
01-21-2014, 09:24 AM
Rethinking my solution, it wouldn't work if you look at the boat from a side.. i was thinking a top down view.. hmm

jeric_synergy
01-21-2014, 09:33 AM
Here's a third possible solution, dependent on the particular meshes: Model the water AROUND the boat. If the hull is sufficiently thick or the displacement of the water very slight you can move the water object THRU its displacement (i.e. World Coordinates).

IOW, the water is parented to the boat. The hole moves w/the boat. Water displacement is World Coordinates, and exclusively on the Y axis.

It might be convenient to add bones to the water to solve any interpenetration issues.

dpont
01-21-2014, 09:57 AM
...The only thing I've found so far about DPont's BOOLEAN node is that it was crashing a lot of people. :/..

If it is the case, I'm very sorry
it was not intended to crash people.

Denis.

jeric_synergy
01-21-2014, 10:00 AM
Anytime I've supplied Denis with bug reports and appropriate supporting sample files, he has fixed the problem frighteningly fast.

EVERY time.

So, if people are having troubles w/any of Denis' offerings, they should create appropriate examples and explain the problem fully to him.

wibly wobly
01-21-2014, 10:08 AM
If it is the case, I'm very sorry
it was not intended to crash people.

Denis.

Wow, I don't think I phrased exactly what I meant regarding that comment. You're nodes are a gawdsent. I don't know what I'd do without them! The only related information I found that use that node was causing the person's system to crash all the time. It's probably a very isolated problem as, like most places on the internet, we only come out and complain when we have problems. The content people, just carry on doing what they're doing.

I'll have a second look at your boolean plugin. It sounded like it could do what I'm looking for. I just got sidetracked.

edit @jeric Agree, his stuff is fantastic.

jeric_synergy
01-21-2014, 10:17 AM
WW, do you have a still frame of your project?

Slartibartfast
01-21-2014, 10:17 AM
Maybe like this?

119480119481

Donut (inside your boat-object) over flat poly (sea). Donut unseen by camera and dont cast shadows. Make it pure white 100% luminosity. Setup nodes on sea-surface according to the picture and turn on VPR. And set the "direction" in the raycast node to X=Z=0 and Y=1 (tracing upwards)

I wonder if it's possible to set the direction = direction from camera. Could be a better solution..

Good luck with your project!

jeric_synergy
01-21-2014, 10:24 AM
Slartibartfast, very clever.

This works for a realistic boat: a cartoony boat that leaps clear of the water would require something more elaborate.

Slartibartfast
01-21-2014, 10:54 AM
Thanks jeric_synergy! I think that if one could trace the opposite camera-ray it would work, even when airborne, since the transparent part would always be "behind" the boat. Think of it as if the camera were a spotlight, and the shadows made the watersurface transparent. You would never see the shadow because of the object casting it is in the way. I might be totally wrong though :bday:
Gotta try...

jeric_synergy
01-21-2014, 11:19 AM
I might be totally wrong though :bday:
No, SBF, that sounds like a winner: anywhere the camera sees the boat, it should not see the water, so that should work perfectly.

What would be the vector-multiplicand to reverse the direction of a vector? (Is it simply -1/-1/-1? )

Slartibartfast
01-21-2014, 11:35 AM
No, SBF, that sounds like a winner: anywhere the camera sees the boat, it should not see the water, so that should work perfectly.

What would be the vector-multiplicand to reverse the direction of a vector? (Is it simply -1/-1/-1? )

Well, yeah I would think so. Tried it initially (before my first post) but I screwed it up. Maybe it should be normalized after multiplication?

Slartibartfast
01-21-2014, 11:38 AM
After another try, it was exactly like you said, with no (obvious) need to normalize. I'll post a demo shortly

jeric_synergy
01-21-2014, 11:43 AM
It has to be when a ray that hits the boat COINCIDES with a ray from the water.

So, you want to compare camera rays. When they are identical, the water should be made transparent.

I think....

wibly wobly
01-21-2014, 11:49 AM
Thanks Slartibartfast. That looks exactly like what I'm looking for. I was trying to poke around with using the world pos of the object to drive the transparency on the other but, my knowledge of using nodes like that is pretty limited. OT +1 to having help text / bubbles for nodes. Hopefully, I'll get a chance to try your method out later today or tomorrow. Cheers.
@jeric I don't think I can show anything right now. If things work out like I hope they will, I'll def try and post some renders and workflow info, assuming the client is ok with doing this. Our background colour keys / concepts look fantastic right now, just trying to make my water look close to it. That's the hard part. If I can post anything, it probably won't for a while. Perhaps around late summer / early fall.

Thanks everyone, I'll keep you posted.

jeric_synergy
01-21-2014, 11:54 AM
After another try, it was exactly like you said, with no (obvious) need to normalize. I'll post a demo shortly
LOL, ok, now you're going to have to walk me thru the logic again...

Slartibartfast
01-21-2014, 12:17 PM
A little movie:
119484 (DL, remove ".txt")

Here's the scene :-)

119485

I'm glad you liked it wibly wobly.

Slartibartfast
01-21-2014, 12:19 PM
LOL, ok, now you're going to have to walk me thru the logic again...

Umm, ok I'm a little confused myself about vectors in LW. Some clever guys here says certain inputs wanna have normalized vectors, and I wasn't sure about this one. Basically, normalizing a vector removes the amplitude or length, so it just tells wich direction it is pointing at. I think :D.
And about the nodes logic: spot position (on water surface) is the point on the surface which is beeing evaluated. (input node-)Ray direction is the direction from the camera to the evaluated spot (At least if you don't have reflected rays bouncing around. I'm not sure how to tell within the node editor). Multiply by -1,-1,-1 and you send a ray back towards the camera. If it hits anything (in this case an invisible lid on the boat) it will return the color of that hitpoint (which would be pure white = 1.0 or 100% in our case). Pass that 100 % into the transparency channel and voilá!

wibly wobly
01-21-2014, 01:58 PM
It works like charm. Cheer. I was afraid by some chance it might not see the displacement I'm applying to the water plane but, it does it just fine. Simple node voodoo at work. Thanks again. You just saved me a lot of time re-rendering things.