Gents / Ladies,
Is the subject possible? As part of my internship I am creating a great number of scenes that are camera static so I am directed to delete all hidden geometry. It would be great if there were a script I could write to do this. Would anyone happen to know how I should structure the logic for if a poly can be seen by the camera? I'd imagine I would like it to be in a percentage coverage so that I don't accidentally delete something that could be mostly seen. Just brainstorming.
As always any help would be most appreciated (and save me some work
)
Cheers~
Replies
You could probably select all the faces of the meshes in edit poly, viewing from the camera angle, while having (ignore backfaces?) enabled. And then just to be on the safe side, expand your selection once, then inverse your selection and delete.
Still though, are you sure this is a good idea? Could get some pretty iffy shadow casting if there's going to be any lighting in there.
Thanks again.
Cheers~
related results (using google)
http://www.scriptspot.com/bobo/mxs2/cfc/
http://www.scriptspot.com/3ds-max/scripts/camera-based-face-selection
http://72.27.230.245/3ds-max/scripts/camerafacecounter
The way pretty much all of them work is by creating a cone mesh of the field of view, then looping through all objects to see if they hit, if they do: loop through the faces see if they intersect or are within the cone and if they face the camera (backface culling) if all that applies keep the faces, the others delete.
I remember a thread on Cgtalk or here where someone created a script that actually adds faces over time as the camera would be animated. So imagine a a complex scenery and you only keep the faces of the environment that is actually visible to the camera. So if you aim for that you need an bitArray per object where you mark all the faces being kept - or to delete over the range of time-range.
Anyway I have seen more stuff like this on the internet so search more aggressive as I did and you will find them.
Cheers~
If you are stuck with even starting to script this, just ask here. I or many of the other members will help you with the bits you are stuck with - if you should. I remember myself creating once a script like this, at least with the camera facing part. If i'd had to do it again and I'd be kinda lost right I'd just open those sample scripts I linked copy bits of them and try to get as far as possible with that.
http://www.scriptspot.com/files/u4824/del_interior_faces_0_titus_mod.ms