Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
How might that work? Would you write a function that checks to see if the straight line between two verticies somehow interesects another object? If it does, how could you write an algorithm that moves the vertex 'just enough' so that it is no longer intersecting? This seems like a useful script but I can't quite picture how to do it.
There are functions already built into the Pro-Pack that let you manipulate the positions of vertices. The problem is figuring out which vertices are in-bounds or out-of-bounds. In-bounds in this case would be laying within the volume enclosed by the clothing and out-of-bounds would be laying 'above' the volume. If you know that a figure vertex is above a clothing polygon, you can use some simple vector algebra to move the vertex along the normal to put it inside the volume. Looking for edges of the figure intersecting the polygons of the clothing is one approach for checking bounds. Another uses the normals of the clothing polygons to do this check. The big problem is in the special cases where the figure's vertices are just above an edge or vertex of the clothing. So far, I'm hashing together an algorithm that works for general cases. The devil will be in the details on this one. ;-)
Usually you can use line casts for this. Itterate through all clothes ploygons and collide it with each poly in the body by casting the line segs formed by each edge of the clothes poly through the plane of each poly on the figure. If there is an intersection you can determine which vertex is behind the figure poly and move it to the surface. The only problem is recursive blow ups. Basically if you move a vertex you have to recheck the polygons attached to this vertex to see if they now intersect. This can cause problems in armpits and tight places probably requiring a recurse cap. Another method is to do a wrap algorythm. This itterates through each vertex of the clothes and casts a ray to a focal point (center of figure, center of wrap to figure, center of world etc). The ray intersects the figure mesh at some point with a simple plane to line intersect algorythm. At this point you can get a normal formed by the ray then back waya from the surface by a user set amount and place the vertex there. This method would saran wrap the clothes to the figure so it wouldn't work well with robes and capes. Havok has a soft body collision modeller that works quite well and at game framerate speeds. I've seen demos of a figure running in a chinese robe and the robe not only collides with his arm but with itself and the world so as to bounce off realistically. Since they use the vertex level as the collider the ability to collide clothes should not only be do-able but fast. They also had a demo of a large breasted woman using soft bodies for her breasts and her top. The breasts made the top stretch and expand as she bounced around.
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
Hey all :) Dos the poser python give you guys vertex level access to the meshes? If so, how hard would a brute force collision detection script be? I figure it would NOT be general cloth simulation, just something to keep a jumpsuit from having breakthroughs from morphs. It would be about the most useful script ever :)