[OpenSCAD] Improve rendering speed
rcmpersiano at gmail.com
Thu Jun 9 11:40:55 EDT 2016
> Have fun with the Klein bottle. Let me know, how you solve the
> self-intersection part ;-)
Rudolf, don't be so skeptical. :)
The Klein bottle is a non-orientable surface. So it is the Roman surface. I
processed the Roman surface with my f-rep evaluation system and got the
following rendered image:
where the surface was unioned with a OpenSCAD sphere. It is a crude
representation of a yet rudimentary (but large and complex) f-rep processing
code. The gaps you see are the natural "makeup" of the SI the surface has.
To produce that image (and its stl), it is only required the Roman surface
> function cushion_surface_eval(pt, a) =
> // http://mathworld.wolfram.com/CushionSurface.html
> let( x = pt, y = pt, z = pt,
> x2 = x*x, y2 = y*y,
> z2 = z*z, z3 = z*z2, z4 = z2*z2 )
> a*(z2*x2 - z4 - 2*z*x2 + 2*z3 + x2 - z2
> - pow(x2-z,2) - y2*y2 - 2*x2*y2 - y2*z2 + 2*y2*z + y2);
and then create the f-rep representation and display:
> prim_data = [ROMAN, 5, 1, 1];
> roman = f_scale(f_primitive(prim_data), 6);
> mseh = f_mesh_evaluation(roman, [-33,-33,-33], 66, 66, 66, 40, 40, 40);
The gaps in the model can be reduced by refining the discretization of the
mesh. This is the bottleneck of the approach: the time to render is O(n^3)
where n is the discretization of each axis. For that image, the console
> Compiling design (CSG Tree generation)...
> ECHO: "
> INFO: mesh_surface id = 0 > received 5632 polygons to display
> ECHO: "
> INFO: mesh_surface id = 0 > generated 19488 triangles with 26592 vertices
> on polyhedron
> Rendering Polygon Mesh using CGAL...
> Geometries in cache: 130
> Geometry cache size in bytes: 25310688
> CGAL Polyhedrons in cache: 2
> CGAL cache size in bytes: 47539440
> Total rendering time: 0 hours, 2 minutes, 12 seconds
> Top level object is a 3D object:
> Simple: yes
> Vertices: 9615
> Halfedges: 55420
> Edges: 27710
> Halffacets: 36226
> Facets: 18113
> Volumes: 10
> Rendering finished.
Bounding boxes would help here.
View this message in context: http://forum.openscad.org/Improve-rendering-speed-tp17580p17619.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
More information about the Discuss