RE: LDCad POVray export
2018-03-03, 12:18 (This post was last modified: 2018-03-03, 12:21 by Michael Horvath.)
2018-03-03, 12:18 (This post was last modified: 2018-03-03, 12:21 by Michael Horvath.)
(2018-02-19, 2:05)Orion Pobursky Wrote:(2018-02-19, 1:50)Michael Horvath Wrote: Sorry, I got you and Roland mixed up earlier. I think LDCad output meshes *are* solid, which is why `ior` (index of refraction) is specified for transparent parts.
No they aren’t. Nothing that is a mesh is. This is why I started the LDraw POV project. Admittedly, I have no idea if it makes a huge difference and, if there is a noticeable difference, if it is worth the trouble for non-high res renders.
It seems solid meshes are possible in POV-Ray if you define an "inside_vector". But I have seen gaps between LDraw sub-parts, for instance where a low-res cylinder meets a high-res hole, or something similar. So maybe these are not "well-behaved".
http://wiki.povray.org/content/Reference:Mesh
Code:
Solid Mesh
The triangle mesh objects mesh (and mesh2) can be used in CSG objects such as difference and intersect. Adding the inside_vector they do have a defined inside. This will only work for well-behaved meshes, which are completely closed volumes. If meshes have any holes in them, this might work, but the results are not guaranteed.
To determine if a point is inside a triangle mesh, POV-Ray shoots a ray from the point in some arbitrary direction. If this vector intersects an odd number of triangles, the point is inside the mesh. If it intersects an even number of triangles, the point is outside of the mesh. You can specify the direction of this vector. For example, to use +z as the direction, you would add the following line to the triangle mesh description (following all other mesh data, but before the object modifiers).
inside_vector <0, 0, 1>
This change does not have any effect on unions of triangles, these will still be always hollow.