[Closed] Cutting polys based on alpha
I need to trim a bunch of polys in relation to their texture.
So for example, if i have several planar pillar fences, i need to cut the polyons so that a majority of the alpha part is removed. Thus, leaving a simple “poly” version of the mesh that mimics the pillar shape.
Doing this by hand will be quite tedious as there is a great number of them, so i was wondering if anyone has any techniques for doing this. Ideally, it would be great to do this in a view similar to the Unwrap UVW modifier, where all the polygons are stacked on each other, and then its a simple cut, cut, remove.
These are pre – created elements, so recreating them is not really an option.
Has anyone had to do anything like this, or have any solution? Thanks.
Thanks for the reply.
I’m not quite sure this will give me what i need, but then again i’ve never used volume select. Can this take a 2 poly plane, with say the picture of a rail and a post, and cut it up into say a 8 poly plane that follows the bitmaps alpha channel? Not exactly but roughly.
If so, can you give me an example of how to do it? The help isn’t very clear.
Thanks.
If you’re looking to ‘remove polys based on a texture’s alpha level’ then here’ some psuedocode:
For every 0 alpha value in the bitmap array, find that objects corresponding face, then remove that face.
The problem you’ll run into then is the ‘resolution’ of the mesh. For a lowpoly model, this method will almost definitely remove faces that you don’t want removed. If your mesh is a high poly model though, this method might remove just the faces you don’t want. Hope this helps.
Yea, the problem is its literally a plane, so 2 triangles, that needs to be cut. Thats why i was thinking if could maybe do some kind of flattening so the tri’s line up in world space where they sit in UV space.
This would result in all the faces that share the same uv space would be stacked on top of each other…then i could just do some simple slices.
Once thats done, bring the tri’s back to their original world space position. The only thing i could think of is store each face element, and moving according to that, since the poly indexing will change when i cut them. And i’m not quite sure whats the maxscript call to get a face element in the viewport.
I could be over thinking this though.
It’d be kind of something like doing a tessellate to increase your face count, putting on a volume select modifier set to select faces and using the texture method with your black and white map in it which will select polys based on black / white values, then feeding the result into a delete mesh operator. If it’s selecting the wrong part, there’s an invert option in volume select to (as you’d guess) invert your selection and swap the white faces for the black faces and feed them into your delete mod instead. If you want to go down the other route, again tessellate your plane, stick on a displace mod with your black and white map in it’s map slot and a small displace amount. Stick on a slice modifier set to remove top or bottom, depending on which is correct and then use an xform to scale the faces back to where they started.
For anything like this you’re going to have to use a lot of polygons in the tessellate to get an accurate result.
This method might be a bit slow, but you can parse the texture, find distinct points to generate a spline from, and use the “ShapeMerge” compound object in Max to cut into the mesh.
Or even easier, just take those spline points and convert them to poly, and behold, your shape.
This method might fail with more complex outlines, shapes, etc.
Just another thougth… if it’s a plane that needs to be cutted by the alpha… why not using it in the opacity map slot? Or cutout if it’s a mr shader.