Home » Community » Forums » Game Programming » What is a best way to create Brush-shape node (or convex polyhedron defined by set of
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

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
Post New Topic  Post Reply 
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 :)

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

up :(

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Perhaps this will help you with what I think you're question is.

http://mattn.ninex.info/files/MAPFiles.pdf

 User Rating: 1040   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

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.

 User Rating: 1434   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

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.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: