Notifications
Clear all

[Closed] Script to find non visible mesh

Hey all! Long time visitor, first time poster. Love this site =-)

So I am trying to figure out the best way to determine what polys will never be seen by the camera. Basically, if you position a cube so that one end is inside another cube, I want to be able to highlight or delete that face.

From searching (Still kinda new to MaxScript) I don’t seem to see anything with what I want so I decided to try and write it myself.

Currently my ides is to create a sphere, encompassing all objects in question, loop through each vert in that sphere and cast a ray to each object face. Keeping track of any faces that did not get hit first and deleting them. All i am ultimately using is intersectRayScene for the test.

I already know of a number of potential flaws in this idea but so far, it seems doable and initial tests with whole objects seems promising.

Does anybody know of any better way to do this in script? Or is there already something for this that I don’t know about?

3 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

what is your programming skill? the answer to your question is you have to cast rays from this camera and check their intersection with the scene. so you have to render from the camera. using your own algorithm or any other (some built-in for example). there is no easier solution. you can easily find all faces that look away from camera but if you want to find all faces that blocked by other faces we have to render.

It’s a bit late for me to really think about it now, but I remembered a MAXScript help topic that’s quite close to what you wanna achieve

How do I Get Faces With Normals Facing Away?
http://docs.autodesk.com/3DSMAX/14/ENU/MAXScript%20Help%202012/index.html?url=files/GUID-A02EECAD-E33B-40C0-BC32-FF5C1C6E828-266.htm,topicNumber=d28e91952

You might want to search for:
How Do I Get Faces With Normals Facing Away?

Read this topic in MAXSCRIPT help…

or read the link here:
http://docs.autodesk.com/3DSMAX/14/ENU/MAXScript%20Help%202012/index.html?url=files/GUID-A02EECAD-E33B-40C0-BC32-FF5C1C6E828-266.htm,topicNumber=d28e91952

-Videep