Shan-Ho Tsai:
|I am trying to follow one of Randy's suggestions, namely, prebuilding
|the cubes in a native DX file and then rendering it. I now have a list
|of all the vertices.
|
|What is the best way to define cubes in a native DX file?
|(I tried to define the cubes following Example 11 on User's Guide
|page 265 (solid.dx), by defining 'position list' (coordinates of the
|vertices), 'edge list', 'loop list', 'faces list' etc. Is this the
|best way?)
Best is really up to you and what you need to do with your data. But
defining the cubes themselves is easier IMO:
object "positions" class array type float rank 1 shape 3 items 8 data follows
-1 -1 -1
-1 -1 1
-1 1 -1
-1 1 1
1 -1 -1
1 -1 1
1 1 -1
1 1 1
attribute "dep" string "positions"
#
object "connections" class array type int rank 1 shape 8 items 1 data follows
0 1 2 3
4 5 6 7
attribute "element type" string "cubes"
attribute "ref" string "positions"
attribute "dep" string "connections"
#
object "cubes" class field
component "positions" value "positions"
component "connections" value "connections"
#
end
Two pluses: 1) simpler, 2) you're defining the volume rather than just the
surface elements, which gives you more flexibility.
If you just want the surface elements (e.g. for visualization), make DX
compute them for you by passing this through ShowBoundary. Alternatively,
you could change your connections from "cubes" to "quads" in the above
example and define the surface polys yourself, but that's just extra
hastle. Or you could define these surface polys using a faces-loops-edges
format, which is a little more work.
BTW: see the "Order of Vertices in Cuboids" figure in the User's Guide for
the cube vertex ordering used in the above.
|And how can I get the image? I tried to use Import -> ShowBoundary
|-> FaceNormals -> Image. But ShowBoundary complains that there are
|no connections.
Hmm. Well, if you define a faces-loops-edges (FLE) field, the boundary you
get will be lines, not faces, and the rest of your dataflow doesn't do what
you apparently want (rendered faces, not a wireframe diagram).
In general:
- If you have volumes and want:
a) volume rendering, just pass to Image
b) surface rendering, pass to ShowBoundary to get surfaces, and then...
- If you have surfaces, pass to Image.
Optionally insert a FaceNormals before Image to override the
smooth-shading default and use flat shading.
Randy
--
Randall Hopper (mailto:[EMAIL PROTECTED])
Lockheed Martin Operation Support
EPA Scientific Visualization Center
US EPA N127-01; RTP, NC 27711