|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| What is a best way to create Brush-shape node (or convex polyhedron defined by set of |
|
![]() demiurghg Member since: 3/31/2009 From: Saint petersburg, Russian Federation |
||||
|
|
||||
| Hello, Brush-shape is convex polyhedron defined by set of bounding planes. This kind of objects is widely used in Quake 1, 2, 3 engines as base geometric primitive. It provides good base for some algorithms such collision detection, visibility and so on. Each plane is defined by three points. Attributes of the each plane are UV offset, scale and material. So, I want to create node which “produce” mesh which present this polyhedron. I should be able to move and rotate each plane separately, set UV scale and offset and set materials for each. It would be great to allow edge and vertex dragging. There is some math: 1. Vertices coordinates are computed by finding of intersection of all plane triplets. Points of intersection, which appear outside of polyhedron, will be removed. So, here we`ll get vertices: p0, p1, … pn. 2. Normal for each face is the same as normal to enclosing plane. 3. Computing of UV coordinates is depending on orientation of the plane. If X-axis is closest axis to plane normal, UV coordinate for each vertex will computed by following formulas: u = (p.x + u_offset) * u_scale * 128 / tex_width; v = (p.y. + v_offset) * u_scale * 128 / tex_height; Can you advice me what is best way to implement Brush-shape? Thanks a lot in advance. P.S. Sorry for my English :) |
||||
|
||||
![]() demiurghg Member since: 3/31/2009 From: Saint petersburg, Russian Federation |
||||
|
|
||||
| up :( |
||||
|
||||
![]() Megahertz Member since: 10/19/2000 From: USA |
||||
|
|
||||
| Perhaps this will help you with what I think you're question is. http://mattn.ninex.info/files/MAPFiles.pdf |
||||
|
||||
![]() Bob Janova Member since: 2/14/2006 From: York, United Kingdom |
||||
|
|
||||
| The Quake series are open source, so you can probably find an implementation in there. I wrote some code to do this but it never quite worked due to floating point issues. It worked like this: - for each plane, find the lines of intersection with the other planes - for each line, find the points of intersection with the other lines - choose the smallest closed polygon that those points make (from the 'innermost' of the points on each line) The trouble is that line-line intersections rely on exact hits in 3D and you need to be careful with making the tolerance too big. |
||||
|
||||
![]() demiurghg Member since: 3/31/2009 From: Saint petersburg, Russian Federation |
||||
|
|
||||
| Megahertz Bob Janova No, mathematical background isn`t interesting me because I`d already done this :) Question is about good implementation of this stuff in Autodesk Maya. Which kind of node I should use and how to connect them. |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|