zTrack

Thanks for the notes the other day. I just spent about 1/2 hour with the Stubel and Wartmann tutes for Python and Blender. Excellent.

Anyway they got me up and running, and the first part of my project is done. It’s a simple z axis tracking utility. In the sample below, I’ve z-tracked the textured mapped tree planes to the camera (i.e. they always face the camera, but only through a z-axis rotation.) As I’ve said before, this is the technique used to make the superb forest flyovers in The Hunt. For my little clip, I used a crappy tree that I found on Google Images - nothing special. It looks pretty freaking good.

http://rolandhess.home.attbi.com/zTrackdivx.avi

Upon seeing the weird effect given by rotating the camera, I went back and watched The Hunt and saw that the camera doesn’t do a whole lot of that, so I can reasonably assume that the same limitations applied to them. Now picture the little demo with random tree distribution and sizing as well as maybe three or four different kinds of trees, and you’ll have an idea of what I’m going for.

The next part of the project is a little more complicated. I want to generate the objects on the fly, only within the portion of the emittor mesh that is on camera. Are there any quick and/or already discovered ways to determine whether on not a vertex will appear within a given frame? If it’s easy to determine, then tree (or whatever) meshes could be generated and destroyed, allowing you to create arbitrarily large treed landscapes, without having millions of polys sitting around doing nothing.

So - easiest way to determine if a vertex is within the camera plane? Anyone?

Looks good!
The technique you use is called billboarding, it is typically used in games, game blender has an option to do that as well.
Regarding your question, if I understand you correcty you want to test if anything is within view of the camera.
Do a search for ‘view frustum culling’, but a rough approximation might be enough if you have a lot of objects. You could do that by getting the near and far clipping planes of the camera (or define your own), and place a sphere in the center with the radius equal to the distance to these clipping planes. Then for every point/object you want to test, you simply test the distance of the object to the center of the sphere, and if that is larger than the sphere radius, it is outside the sphere and thus out of view.
This is a very rough approximation, since quite a few points outside the range of the camera will still be accepted as inside view.
So full ‘view frustum culling’ might be necessary if that is what you need.
But then again, maybe some-one knows a simpler technique…

You could also test to see if the camera is looking at the trees with a vector dot product between the camera view port and the vector pointing to the three. You’ll have to introduced a variable threshold due to the size of the object, but that should be fairly easy.

If that sounded like completely blingo to you, I can explain a little clearer of course.

Martin

Thanks. I will try that. If only I could execute an sql query on the vertex list this would be a piece of cake!

BTW, in case the video wasn’t working for anyone, I re-encoded and re-uploaded. It should work for everyone now.

I found some good info for both, so I think I’ll try both techniques. Just a quick gloss of the math involved for each tells me that theeth’s will be faster, but eeshlo’s suggestion more accurate. We’ll see.

Thanks again.

actually, they are about as equal math-wise.

If you combine both, you’d get the advantage of having only the ones in the viewport AND in the clipping distance.

Martin