Mesh tool requestCommunity Forums/Developer Stations/Mesh tool request
| I'm looking for a tool that will take a 3ds/x/b3d mesh, and output 2 b3d meshes, an exterior and interior mesh. Say for instance a building with one or more rooms, produce a mesh that is just the building exterior with all textures & materials intact, and the same again for the inside of the building. The idea being that the interior will be hidden until the player enters the building.|
I know this can be done by hand, but I would like to automate the processing of props from my artists as there will be a substantial number of buildings done this way.
| how would you do that? checking the visibility of the interior things from outside? but what if thins can be seen trough windows, doors etc?|
Maybe it wouldn't be that hard to quickly run trough the levels an "shoot" everything, that should be inside, so it can be stored in a list.
| I would be happy at 1st cut with code that takes the normal of a face, shoots a ray from the center and each vertex of the face along the normal, and marks it "exterior" if all the rays tested intersect no other polys of the model.|
Not 100% accurate, but a good starting point if you accept the restriction that you cant see through windows/doors until you open/pass through them. A more accurate but more time consuming method would be to test if the rays cross the plane of any polys in the model.
My artists are creating insanely complex buildings that will be placed as props on a terrain, want to seperate interior and exterior so I can alpha out the interior until the player enters a building.
I'd like source code too, so I can add on features as I come up with them. I'll even agree that any derivative works will be released free to the community :)
Edit: I've been catching up on the portal / occlusion / visibility discussions and just got your csp_vis code to look at. That may be enough to get me started on doing what I want for myself.
In fact -- it has me thinking about doing an automatic portal detection system using the color codes to indicate depth along the camera view axis. will take multiple passes, one for each angle checked. using flat projection and scaning the 2D limits of the bounding box normal to the camera view vector, you can test if adjacent pixels have radically different colors, which would indicate a portal.
Have to think about this more :) such as what color to assign for surfaces at an angle, and some way to optimize moving "through" the mesh to catch interior portals without having to scan every point of a fixed grid. (besides the fact that this likely should be in a thread on its own if it has any merit at all)
| Sleeping on it worked :)|
only do the view vectors that are normal to a face in the mesh.... i.e. scan each surface for portals using ICU... when you get that color change, it shouldnt be hard to figure the verts that bound the color change and create a clockwise list of verts to be the portal.
create a box larger than the bounding box of the mesh, and place the mesh in it for this test -- set it to a specific unique color (all faces of it).. any portal that shows this color leads "outside" and can be ignored (will never do portal operations on whats beyond that portal since we cant know what will be past that portal at this stage of processing).