View Full Version : help:mesh individual faces look at constrant?

11 November 2003, 12:15 PM

how can I make a mesh individual faces to look at my camera? Maybe there is a script somewhere or I can write easy one myself?

I want to make huge forest from planes but when there are a lot of plane obejcts viewports gets very slow. So I want to make one mesh to work faster.


11 November 2003, 07:38 PM
That would be a challenging proposition, that in the end would probably be self-defeating: single-mesh might be faster in the viewports, but the Maxscript required to drive the motion would slow it back down again. And that's if you can even find a way to make a script controller drive individual mesh faces. I'd leave 'em separate and use the standard lookat controller, and if viewport interaction became a concern I would just hide off all but 10 to 20 percent of the tree planes.


11 November 2003, 08:01 PM
bilieve me, lookat controller on every of 10 000 planes would be death to max, I heve tried it. And my scene consists of about 25 000 planes. I could use instanced trees with already assigned lookat controller, but the problem is that the forest is already created.

I dont think that it is necessary to use controller. If I could find a normal vector of a face (or individual plane) and control it, then maybe it would be possible to point it to a camera (or whatever: a dummy) via selection for in loop for every frame (again loop). I dont think it would be very hard for max to handle this script..
but I am not very proficient in maxscript so maybe there is similar script I could reuse..?

anyway it would be great to use only one mesh with looking faces, because it is much faster then individual planes.

11 November 2003, 08:34 PM
Gotta go with Shady on this one...

The script would have to first find paired faces, then find the normal for the pair, compare to the vector of the camera, compute the change in the vertex positions to get the desired normals for the paired face then move the verts. twenty thousand planes vs fourty thousand faces.. hummmm....

Good luck with that one...

I'd layer out my scenes with all those cards by z-Depth and composite them...

Keith Morrison

11 November 2003, 09:23 PM
would it be more efficient to write your own look-at script that only controls the horizontal rotation and nothing else? Might be less computationally heavy than the standard max controller.

Sean Looper

11 November 2003, 09:39 PM

search "BillBoard"

try Billboard-o-matic 1.0... simple scripted controller by swami.

good luck

Keith Morrison

11 November 2003, 09:54 PM

Thanks. yes, I have tried this script and... well it is rather heavy too, to use it on so many planes I must increase Init Heap Alocation to 100 mb and during renderings it computes very long. And this script controls only Z rotation and I need all three axes - then forest looks more convincing when camera flies over the trees.
I indeed plan to render trees in several passes with alpha channel, bake the shadows.

Let say the same Align to View function in the max (for objects) aligns all planes rather quickly and does what I want, so I am thinking maybe it is possible to reuse this function with script for every frame.. :shrug:

11 November 2003, 01:23 PM
Maybe you can do this with a particle system, since that has the option for camera facing built in and it can have all particles in the system as one mesh. if you have pflow you could create a scripted birth operator that places a particle at every plane you have, since you say you already built it.

11 November 2003, 01:27 PM
Hi Cyberdigitus,

Thanks! Very good tip! max 5 particles cant handle it, but pflow may. Have to try it!

CGTalk Moderation
01 January 2006, 03:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.