That is beautiful :)
The problem seems to lie in the amount of time needed to do the difference
with that enormous spherical shell.
So I put a render in a different place and tried it with the smaller value
and it came out in a minute (reduced range).
Without the render it never starts (0/1000). With the render it went 22/1000
very quickly and came back with an object in a minute.
Cheers...
http://forum.openscad.org/file/n13625/mesh_disc-OpenSCAD_001079.png
//
module mesh(size=40, top=61, bot=50) {
k =1.1;
for (x = [0: size]) {
for (y = [0: size]) {
// render()
rotate([(y2cos(30)k)-(202cos(30) k) + (cos(30) (x%2)k), (x1.5k
)-(201.5k), 0]) {
polyhedron (
points = [
[0.5,cos(30),top],[1,0,top],[0.5,-cos(30),top],[-0.5,-cos(30),top],[-1,0,top],[-0.5,cos(30),top],
[0.5,cos(30),bot],[1,0,bot],[0.5,-cos(30),bot],[-0.5,-cos(30),bot],[-1,0,bot],[-0.5,cos(30),bot]
],
faces = [
[0,1,2],[0,2,3],[0,3,4],[0,4,5],
[0,6,7],[0,7,1],[1,7,8],[1,8,2],[2,8,9],[2,9,3],[3,9,10],[3,10,4],[4,10,11],[4,11,5],[5,11,6],[5,6,0],
[6,8,7],[6,9,8] ,[6,10,9],[6,11,10]
]
);
}
}
}
}
module rim(rad=59, res=200) {
//rim
translate([0,0,cos(30)*rad]) {
difference() {
cylinder(h = 2, r=32, center = true, $fn=res);
cylinder(h = 3, r=30, center = true, $fn=res);
}
}
}
module dome(rad1=60, rad2=59, res=200) {
render(); // had to add this to get it capable of doing F6
intersection() {
difference() {
sphere(rad1, $fn=res);
sphere(rad2, $fn=res);
}
cylinder(h = 100, r=30, $fn=res);
}
}
//
difference() {
dome(60,59,100);
mesh(9,61,58);
//rim();
}
--
View this message in context: http://forum.openscad.org/Need-help-on-Render-tp13624p13625.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Neon22:
Your use of render() confuses me. The manual says
render() {
some geometry
}
While you just say
render();
How does that work?
I have to say that I tried to use render() at one point and simply gave
up from confusion. If it always renders (does an F6) for the specified
geometry, then how does it save time? Or does the render only occur if
the source code in that geometry has changed since the most recent
render? The documentation would benefit from a better example, IMHO.
Jon
On 8/28/2015 4:48 AM, Neon22 wrote:
That is beautiful :)
The problem seems to lie in the amount of time needed to do the difference
with that enormous spherical shell.
So I put a render in a different place and tried it with the smaller value
and it came out in a minute (reduced range).
Without the render it never starts (0/1000). With the render it went 22/1000
very quickly and came back with an object in a minute.
Cheers...
http://forum.openscad.org/file/n13625/mesh_disc-OpenSCAD_001079.png
//
module mesh(size=40, top=61, bot=50) {
k =1.1;
for (x = [0: size]) {
for (y = [0: size]) {
// render()
rotate([(y2cos(30)k)-(202cos(30) k) + (cos(30) (x%2)k), (x1.5k
)-(201.5k), 0]) {
polyhedron (
points = [
[0.5,cos(30),top],[1,0,top],[0.5,-cos(30),top],[-0.5,-cos(30),top],[-1,0,top],[-0.5,cos(30),top],
[0.5,cos(30),bot],[1,0,bot],[0.5,-cos(30),bot],[-0.5,-cos(30),bot],[-1,0,bot],[-0.5,cos(30),bot]
],
faces = [
[0,1,2],[0,2,3],[0,3,4],[0,4,5],
[0,6,7],[0,7,1],[1,7,8],[1,8,2],[2,8,9],[2,9,3],[3,9,10],[3,10,4],[4,10,11],[4,11,5],[5,11,6],[5,6,0],
[6,8,7],[6,9,8] ,[6,10,9],[6,11,10]
]
);
}
}
}
}
module rim(rad=59, res=200) {
//rim
translate([0,0,cos(30)*rad]) {
difference() {
cylinder(h = 2, r=32, center = true, $fn=res);
cylinder(h = 3, r=30, center = true, $fn=res);
}
}
}
module dome(rad1=60, rad2=59, res=200) {
render(); // had to add this to get it capable of doing F6
intersection() {
difference() {
sphere(rad1, $fn=res);
sphere(rad2, $fn=res);
}
cylinder(h = 100, r=30, $fn=res);
}
}
//
difference() {
dome(60,59,100);
mesh(9,61,58);
//rim();
}
--
View this message in context: http://forum.openscad.org/Need-help-on-Render-tp13624p13625.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.6125 / Virus Database: 4409/10525 - Release Date: 08/27/15
Sorry, Jon, I just don't know. I should look at the source I suppose.
My assumption is that the object gets sent to CGAL for resolving.
Therefore its cached and used in a further stage.
But I'm guessing...
--
View this message in context: http://forum.openscad.org/Need-help-on-Render-tp13624p13629.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
jon_bondy wrote
The manual says
render() {
some geometry
}
While you just say
render();
How does that work?
The manual is correct.
render(); is basically a null statement, render nothing. So I can't see how
it makes a difference, I doubt it does. Actually I just measured it, no
difference.
render() is usually good where some geometry either;
a. doesn't preview well, F5 sometimes has trouble with complex items, the
render() will show the geometry correctly,
b. is repeated many times, the render()'ed geometry, once cached, /may/ be
faster to paint than the CSG preview.
The other effect, is when render()'ed in preview, that cached bit does NOT
need to be re-rendered for F6, hence F6 /may/ be faster, where F5 included
render()'s.
CGAL, F6 & render(), are cached, with the values of the tree for that
geometry, so a sphere(r=10) if it occurs multiple times will have one
geometry, however if you have a for(i) loop with sphere(r=i) the different
sizes will be different cached geometry, there will be no cache performance
improvement.
Depending on the geometry, you should generally have a guess at the
convexity parameter too. Otherwise the render() can be useless.
jon_bondy wrote
I have to say that I tried to use render() at one point and simply gave
up from confusion. If it always renders (does an F6) for the specified
geometry, then how does it save time? Or does the render only occur if
the source code in that geometry has changed since the most recent
render? The documentation would benefit from a better example, IMHO.
AFAIK, yes, if the geometry parameters don't change, it doesn't render. But
not based on source code as such, but have a look at the CSG Tree (under
Design menu), if an item there has the same parameters, it only evaluates
once (in that context).
In conclusion tho, I doubt the design here benefits from render(). Each of
the 41 x 41 hex elements that form the mesh is a distinct, the polyhedron is
probably cached, but it then has to be modified 1600+ times...
Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Need-help-on-Render-tp13624p13643.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@MichaelAtOz thanks for the clarity. I'm mystified then as to how the render
went from never completing ( in 10 mins) to completing in < minute for this
particular object. Clearly its not related to render() but just a
coincidence as Ive worked on the object.
My comment was based on my experience with this object and what I noticed
which was this:
My thought process is clearly wrong but its still a mystery to me as to what
I did to make it speed up. Maybe it was simply turning aspects into modules
?
--
View this message in context: http://forum.openscad.org/Need-help-on-Render-tp13624p13644.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nice explanation. If we can get content like this into the manual, I
think it would be helpful to others.
So, just to be clear, performance improvements can be expected if
Jon
On 8/29/2015 11:19 PM, MichaelAtOz wrote:
jon_bondy wrote
The manual says
render() {
some geometry
}
While you just say
render();
How does that work?
The manual is correct.
render(); is basically a null statement, render nothing. So I can't see how
it makes a difference, I doubt it does. Actually I just measured it, no
difference.
render() is usually good where some geometry either;
a. doesn't preview well, F5 sometimes has trouble with complex items, the
render() will show the geometry correctly,
b. is repeated many times, the render()'ed geometry, once cached, /may/ be
faster to paint than the CSG preview.
The other effect, is when render()'ed in preview, that cached bit does NOT
need to be re-rendered for F6, hence F6 /may/ be faster, where F5 included
render()'s.
CGAL, F6 & render(), are cached, with the values of the tree for that
geometry, so a sphere(r=10) if it occurs multiple times will have one
geometry, however if you have a for(i) loop with sphere(r=i) the different
sizes will be different cached geometry, there will be no cache performance
improvement.
Depending on the geometry, you should generally have a guess at the
convexity parameter too. Otherwise the render() can be useless.
jon_bondy wrote
I have to say that I tried to use render() at one point and simply gave
up from confusion. If it always renders (does an F6) for the specified
geometry, then how does it save time? Or does the render only occur if
the source code in that geometry has changed since the most recent
render? The documentation would benefit from a better example, IMHO.
AFAIK, yes, if the geometry parameters don't change, it doesn't render. But
not based on source code as such, but have a look at the CSG Tree (under
Design menu), if an item there has the same parameters, it only evaluates
once (in that context).
In conclusion tho, I doubt the design here benefits from render(). Each of
the 41 x 41 hex elements that form the mesh is a distinct, the polyhedron is
probably cached, but it then has to be modified 1600+ times...
Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Need-help-on-Render-tp13624p13643.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.6125 / Virus Database: 4409/10540 - Release Date: 08/29/15
For your 1) case, that is for F5, but F5 also caches (different cache)
without render(), so it depends on the geometry I think. However, with
render() the first F5 will be slower...
As a general statement. Unless something doesn't display properly - like I'm
finding for text() - in preview (F5), don't bother with render().
Another technique some people use is to export the complex bits as a STL,
import() them, as they have been rendered hence that bit doesn't need to be
rendered again (if that part of the model is stable).
Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Need-help-on-Render-tp13624p13648.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
...and if you notice a laggie display refresh on preview, render() can help.
Compare the display responsiveness of a non-trivial model after F5 v's F6.
Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Need-help-on-Render-tp13624p13649.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Neon22 wrote
I'm mystified then as to how the render went from never completing ( in 10
mins) to completing in < minute for this particular object.
BTW, your model renders, without render(), in 12m 55s on my 2.54GHz system.
It caches as it goes, so if you cancelled after 10m, then added the
render();, most of it was already cached so it just had to finish the rest.
Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Need-help-on-Render-tp13624p13650.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
On 08/30/2015 11:06 PM, MichaelAtOz wrote:
As a general statement. Unless something doesn't display properly - like I'm
finding for text() - in preview (F5), don't bother with render().
Large text() can create lots of vertices, so render() can help
with display performance in some cases.
If the display looks strange, that's more likely an issue with
unknown/wrong convexity, e.g.
difference() {
cube([30, 30, 10], center=true);
linear_extrude(30, center=true) text("W");
}
produces lots of preview artifacts on my system.
Adding convexity=4 to the linear_extrude fixes that.
I guess it's pretty much model dependent if it's better to
just give the correct convexity or use render() to workaround
the display issue by forcing the mesh calculation.
ciao,
Torsten.