![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Tor Olav Kristensen
Subject: Isosurface Approximation macros rewrite
Date: 21 Feb 2008 20:08:59
Message: <47be20ab@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Here is an include file with a collection of macros
that are a rewrite of the Isosurface Approximation
macros that Kevin Loney once wrote and Jaap Frank
later modified. (There's also a file that can be used
to test the macros.)
I have optimized the macros so they run faster than
the original ones. They can be used in much the same
way as those on Mike Williams' web page.
Here's some relevant posts:
Subject: Isosurface approximation
Sender: Kevin Loney
Date: 2003 April 9th
Newsgroup: povray.binaries.images
Subject: Isosurface approximation MkII
Sender: Kevin Loney
Date: 2003 April 10th
Newsgroup: povray.binaries.images
Subject: Isosurface approximation MkIII
Sender: Kevin Loney
Date: 2003 July 1st
Newsgroup: povray.binaries.images
Re: Isosurface approximation MkIII
Sender: Jaap Frank
Date: 2003 July 6th
Newsgroup: povray.binaries.scene-files
Also see:
"Approximation Macro" (Mike Williams' web page)
http://www.econym.demon.co.uk/isotut/approx.htm
--
Tor Olav
http://subcube.com
Post a reply to this message
Attachments:
Download 'isosurface_kl_jf_tok.inc.txt' (26 KB)
Download 'isosurface.pov.txt' (3 KB)
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Thanks!
I tested in on a quite complicated surface.
Old method: 67 seconds
Your method: 47 seconds.
A big improvement!
Jos
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
great Tor!
BTW, while we're at it, how about not letting the code simply eventually
dying out as the previous ones? Would you be ok about including these
useful set of macros in the Povray Object Collection? yes, it's about
objects mainly, but I guess useful generic object-making macros would be
a good idea too. One of the main purposes of the collection is to get
useful povray SDL code under an open-source license so anyone can later
legally modify it. Since this is a rewrite...
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Tor Olav Kristensen
Subject: Re: Isosurface Approximation macros rewrite
Date: 2 Mar 2008 20:22:10
Message: <47cb52c2$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
nemesis wrote:
> great Tor!
>
> BTW, while we're at it, how about not letting the code simply eventually
> dying out as the previous ones? Would you be ok about including these
> useful set of macros in the Povray Object Collection? yes, it's about
> objects mainly, but I guess useful generic object-making macros would be
> a good idea too. One of the main purposes of the collection is to get
> useful povray SDL code under an open-source license so anyone can later
> legally modify it. Since this is a rewrite...
Releasing the code that I wrote for these macros under the "Creative
Commons - Lesser General Purpose License" is all ok for me.
But I think that it is also necessary to get permission from Kevin Loney
and Jaap Frank for their contributions.
--
Tor Olav
http://subcube.com
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Jaap Frank
Subject: Re: Isosurface Approximation macros rewrite
Date: 3 Mar 2008 17:09:01
Message: <47cc76fd@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmail com> schreef in bericht
news:47cb52c2$1@news.povray.org...
> nemesis wrote:
>> great Tor!
>>
>> BTW, while we're at it, how about not letting the code simply eventually
>> dying out as the previous ones? Would you be ok about including these
>> useful set of macros in the Povray Object Collection? yes, it's about
>> objects mainly, but I guess useful generic object-making macros would be
>> a good idea too. One of the main purposes of the collection is to get
>> useful povray SDL code under an open-source license so anyone can later
>> legally modify it. Since this is a rewrite...
>
> Releasing the code that I wrote for these macros under the "Creative
> Commons - Lesser General Purpose License" is all ok for me.
>
> But I think that it is also necessary to get permission from Kevin Loney
> and Jaap Frank for their contributions.
>
> --
> Tor Olav
> http://subcube.com
Hello again Tor Olav,
Thanks for the mail you send.
I was a couple of years out of circulation, but I'm starting to do something
with POV-Ray again.
I've studied your changes to the file today and you did a marvellous job.
It's more readable and faster.
Just a small flaw in the last line inside MakeMesh, it has to be
#declare TriCnt = TriCnt + Cnt.
Now you get the triangle count, else it gives zero.
Of coarse I tested the last project I was doing with it too - I've put my
test function crackle in the file - and I have add something to make the
result more reliable although it makes it slower. Therefore I made a
variable so you can choose to do this or not.
It's the variable CenterCheck. It turned out that with a rough function ,
many pieces and small islands are missed by the tests on inside/outside,
because all corners are just outside or inside the structure. If you use an
extra test point in the centre of the cell, you find more pieces of the
puzzle
because the grid is smaller. This was not enough for small islands, so I
made it one level deeper still. It looks two levels deep if Level>=1 in
the macro MakeMesh, else one level. Deeper probing makes it unac-
ceptable slow.You can't miss it if you look at the macro.
Another change is the possibility to choose SubSegs for the recursions.
If you start with isoSegs = <1,1,1>*6 and Depth = 2, you have to test
10 million cells for the surfaces, because all Cells are subdivided in
6*6*6 = 216 SubCells and all these cells again in 216 SubCells . Your
number of cells grows explosively in this way.
In the old file every Cell was subdivided into eight SubCells, so SubSegs
was always equal to two. This way you can control the grow of Cells
better. I've made several test with different combinations and came with
the following conclusion:
1. Smaller SubSegs(2, 3) with higher Depth (3,4,5) is faster.
2. Greater SubSegs(4,5) with lower Depth (1,2) is a bit more accurate,
but alas it's slower.
A trade off between accuracy and speed is:
isoSegs = <1,1,1>*6
SubSegs = 3 and Depth = 3
CenterCheck = on.
It took about 10 min for a good accurate mesh.
If you are interested I can send you all the statistics and pictures so you
can check for yourself. It is a bit too much for the news site, but I will
show
some examples.
POV just crashed on isoSegs=6, SubSegs=4, Depth=3 and CenterCheck
= on after one and a half hour parsing with 'Out of memory'. The Mesh is
already .5 Gbyte! It should test about 56 million Cells!
I have 1 Gbyte of RAM, so it was huge.
With these new add-ons it gives splendid results and it is very fast, even
for
rough surfaces you get acceptable results. Maybe you see possibilities for
new streamlining of the code.
Of coarse nemesis can use it for the Povray Object Collection, if Kevin
agrees too, because he started it all.
Example statistics (you can see the pictures):
Fn Segs SubSegs Depth Check TriCnt Time
Correct?
--------------------------------------------------------------------------
2Pi 5 5 1 off 38250
16s holes
2Pi 5 5 1 on 52190
22s +
8Pi 7 7 1 off 695190 3m
39s holes
8Pi 7 7 1 on 778456 4m
8s +
Crackle 6 6 2 on 978552 13m 10s
Crackle 6 6 2 on 1774660 26m 33s
+++
Crackle 6 2 5 on 1184460 13m 29s
++
Crackle 6 3 3 on 919184 10m 53s
The 2Pi and 8Pi refer to the triple cosine functions.
You can test my files and see some results with it.
Jaap Frank
Post a reply to this message
Attachments:
Download 'isosurface_Segs_5_Depth_1_Check_On_Fn_2Pi.png' (61 KB)
Download 'isosurface_Segs_5_Depth_1_Check_Off_Fn_2Pi.png' (61 KB)
Download 'isosurface_Segs_7_Depth_1_Check_On_Fn_8Pi.png' (96 KB)
Download 'isosurface_JF.pov.txt' (4 KB)
Download 'isosurface_KL_JF_TOK_JF.inc.txt' (28 KB)
Download 'isosurface_Segs_7_Depth_1_Check_Off_Fn_8Pi.png' (96 KB)
Preview of image 'isosurface_Segs_5_Depth_1_Check_On_Fn_2Pi.png'
![isosurface_Segs_5_Depth_1_Check_On_Fn_2Pi.png](/povray.binaries.scene-files/attachment/%3C47cc76fd%40news.povray.org%3E/isosurface_Segs_5_Depth_1_Check_On_Fn_2Pi.png?ttop=441393&toff=350&preview=1)
Preview of image 'isosurface_Segs_5_Depth_1_Check_Off_Fn_2Pi.png'
![isosurface_Segs_5_Depth_1_Check_Off_Fn_2Pi.png](/povray.binaries.scene-files/attachment/%3C47cc76fd%40news.povray.org%3E/isosurface_Segs_5_Depth_1_Check_Off_Fn_2Pi.png?ttop=441393&toff=350&preview=1)
Preview of image 'isosurface_Segs_7_Depth_1_Check_On_Fn_8Pi.png'
![isosurface_Segs_7_Depth_1_Check_On_Fn_8Pi.png](/povray.binaries.scene-files/attachment/%3C47cc76fd%40news.povray.org%3E/isosurface_Segs_7_Depth_1_Check_On_Fn_8Pi.png?ttop=441393&toff=350&preview=1)
Preview of image 'isosurface_Segs_7_Depth_1_Check_Off_Fn_8Pi.png'
![isosurface_Segs_7_Depth_1_Check_Off_Fn_8Pi.png](/povray.binaries.scene-files/attachment/%3C47cc76fd%40news.povray.org%3E/isosurface_Segs_7_Depth_1_Check_Off_Fn_8Pi.png?ttop=441393&toff=350&preview=1)
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Jaap Frank
Subject: Re: Isosurface Approximation macros rewrite
Date: 3 Mar 2008 17:10:58
Message: <47cc7772@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
the rest of the pictures
Post a reply to this message
Attachments:
Download 'isosurface_segs_6_depth_2_Check_On_Fn_Crackle.png' (111 KB)
Download 'isosurface_segs_6_Subsegs_2_depth_5_Check_On_Fn_Crackle.png' (107 KB)
Download 'isosurface_segs_6_Subsegs_3_depth_3_Check_On_Fn_Crackle.png' (109 KB)
Download 'isosurface_segs_6_depth_2_Check_Off_Fn_Crackle.png' (82 KB)
Preview of image 'isosurface_segs_6_depth_2_Check_On_Fn_Crackle.png'
![isosurface_segs_6_depth_2_Check_On_Fn_Crackle.png](/povray.binaries.scene-files/attachment/%3C47cc7772%40news.povray.org%3E/isosurface_segs_6_depth_2_Check_On_Fn_Crackle.png?ttop=441393&toff=350&preview=1)
Preview of image 'isosurface_segs_6_Subsegs_2_depth_5_Check_On_Fn_Crackle.png'
![isosurface_segs_6_Subsegs_2_depth_5_Check_On_Fn_Crackle.png](/povray.binaries.scene-files/attachment/%3C47cc7772%40news.povray.org%3E/isosurface_segs_6_Subsegs_2_depth_5_Check_On_Fn_Crackle.png?ttop=441393&toff=350&preview=1)
Preview of image 'isosurface_segs_6_Subsegs_3_depth_3_Check_On_Fn_Crackle.png'
![isosurface_segs_6_Subsegs_3_depth_3_Check_On_Fn_Crackle.png](/povray.binaries.scene-files/attachment/%3C47cc7772%40news.povray.org%3E/isosurface_segs_6_Subsegs_3_depth_3_Check_On_Fn_Crackle.png?ttop=441393&toff=350&preview=1)
Preview of image 'isosurface_segs_6_depth_2_Check_Off_Fn_Crackle.png'
![isosurface_segs_6_depth_2_Check_Off_Fn_Crackle.png](/povray.binaries.scene-files/attachment/%3C47cc7772%40news.povray.org%3E/isosurface_segs_6_depth_2_Check_Off_Fn_Crackle.png?ttop=441393&toff=350&preview=1)
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Tor Olav Kristensen
Subject: Re: Isosurface Approximation macros rewrite
Date: 5 Mar 2008 21:25:04
Message: <47cf5600@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Jaap Frank wrote:
> "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmail com> schreef in bericht
> news:47cb52c2$1@news.povray.org...
>> nemesis wrote:
>>> great Tor!
>>>
>>> BTW, while we're at it, how about not letting the code simply eventually
>>> dying out as the previous ones? Would you be ok about including these
>>> useful set of macros in the Povray Object Collection? yes, it's about
>>> objects mainly, but I guess useful generic object-making macros would be
>>> a good idea too. One of the main purposes of the collection is to get
>>> useful povray SDL code under an open-source license so anyone can later
>>> legally modify it. Since this is a rewrite...
>> Releasing the code that I wrote for these macros under the "Creative
>> Commons - Lesser General Purpose License" is all ok for me.
>>
>> But I think that it is also necessary to get permission from Kevin Loney
>> and Jaap Frank for their contributions.
...
> Hello again Tor Olav,
Hi Jaap
> Thanks for the mail you send.
> I was a couple of years out of circulation, but I'm starting to do something
> with POV-Ray again.
It's good to see you back again !
=)
> I've studied your changes to the file today and you did a marvellous job.
> It's more readable and faster.
Thank you.
> Just a small flaw in the last line inside MakeMesh, it has to be
> #declare TriCnt = TriCnt + Cnt.
> Now you get the triangle count, else it gives zero.
Ok. Good that you spotted that one.
> Of coarse I tested the last project I was doing with it too - I've put my
> test function crackle in the file - and I have add something to make the
> result more reliable although it makes it slower. Therefore I made a
> variable so you can choose to do this or not.
> It's the variable CenterCheck. It turned out that with a rough function ,
> many pieces and small islands are missed by the tests on inside/outside,
> because all corners are just outside or inside the structure. If you use an
> extra test point in the centre of the cell, you find more pieces of the
> puzzle
> because the grid is smaller. This was not enough for small islands, so I
> made it one level deeper still. It looks two levels deep if Level>=1 in
> the macro MakeMesh, else one level. Deeper probing makes it unac-
> ceptable slow.You can't miss it if you look at the macro.
>
> Another change is the possibility to choose SubSegs for the recursions.
> If you start with isoSegs = <1,1,1>*6 and Depth = 2, you have to test
> 10 million cells for the surfaces, because all Cells are subdivided in
> 6*6*6 = 216 SubCells and all these cells again in 216 SubCells . Your
> number of cells grows explosively in this way.
> In the old file every Cell was subdivided into eight SubCells, so SubSegs
> was always equal to two. This way you can control the grow of Cells
> better. I've made several test with different combinations and came with
> the following conclusion:
> 1. Smaller SubSegs(2, 3) with higher Depth (3,4,5) is faster.
> 2. Greater SubSegs(4,5) with lower Depth (1,2) is a bit more accurate,
> but alas it's slower.
> A trade off between accuracy and speed is:
> isoSegs = <1,1,1>*6
> SubSegs = 3 and Depth = 3
> CenterCheck = on.
> It took about 10 min for a good accurate mesh.
> If you are interested I can send you all the statistics and pictures so you
> can check for yourself. It is a bit too much for the news site, but I will
> show
> some examples.
>
> POV just crashed on isoSegs=6, SubSegs=4, Depth=3 and CenterCheck
> = on after one and a half hour parsing with 'Out of memory'. The Mesh is
> already .5 Gbyte! It should test about 56 million Cells!
> I have 1 Gbyte of RAM, so it was huge.
>
> With these new add-ons it gives splendid results and it is very fast, even
> for
> rough surfaces you get acceptable results. Maybe you see possibilities for
> new streamlining of the code.
It looks promising, but I don't have much spare time these days, so I'll
have to look at your additions at a later moment. Sorry.
> Of coarse nemesis can use it for the Povray Object Collection, if Kevin
> agrees too, because he started it all.
Just for the record:
Does that also mean that you release your contributions to these macros
under the CC-GNU LGPL, as described in this page ?
http://lib.povray.org/usersguide/04contributing.html
(There's a copy of the licensing section below my signature.)
If both you and Kevin do, then I'll go on and submit the macros to the
collection. (I haven't go any response from Kevin yet. I'm not sure
what his current email address is.)
> Example statistics (you can see the pictures):
>
> Fn Segs SubSegs Depth Check TriCnt Time
> Correct?
> --------------------------------------------------------------------------
> 2Pi 5 5 1 off 38250
> 16s holes
> 2Pi 5 5 1 on 52190
> 22s +
> 8Pi 7 7 1 off 695190 3m
> 39s holes
> 8Pi 7 7 1 on 778456 4m
> 8s +
> Crackle 6 6 2 on 978552 13m 10s
> Crackle 6 6 2 on 1774660 26m 33s
> +++
> Crackle 6 2 5 on 1184460 13m 29s
> ++
> Crackle 6 3 3 on 919184 10m 53s
>
> The 2Pi and 8Pi refer to the triple cosine functions.
>
> You can test my files and see some results with it.
I'll do that.
--
Tor Olav
http://subcube.com
4.2 Licensing
In order to submit a contribution to this collection you must be willing
and able to agree to the terms of use and distribution covering this
collection. All of the files from this collection are currently governed
by the Creative Commons - Lesser General Purpose License (CC-GNU
LGPL). CC-GNU LGPL
Before submitting any files to this collection you must:
* Verify that you are entitled to grant permission for the
distribution and use of all the files you contribute
* Grant the right to distribute the files you contribute under the
terms of this license in perpetuity.
* Grant the right in perpetuity for the use without restriction of
images generated using the files you contribute.
* Confirm that you have incorporated the following licensing
statement into all .pov and .inc files that you submit:
// This file is licensed under the terms of the CC-LGPL
The POV-Ray Team reserve the right to change the licensing conditions
for the collection in the future, in which case anyone who has
downloaded files under the CC-GNU LGPL will continue to be covered by
that license or may choose to use the new license.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Tor Olav Kristensen schreef:
> Jaap Frank wrote:
>> "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmail com> schreef in
>> bericht
>> news:47cb52c2$1@news.povray.org...
>>> nemesis wrote:
>
> .....
>> With these new add-ons it gives splendid results and it is very fast,
>> even
>> for
>> rough surfaces you get acceptable results. Maybe you see possibilities
>> for
>> new streamlining of the code.
>
> It looks promising, but I don't have much spare time these days, so I'll
> have to look at your additions at a later moment. Sorry.
Hello Tor Olav,
No problem. I will check for your reaction. Don't hurry your self.
>> Of coarse nemesis can use it for the Povray Object Collection, if Kevin
>> agrees too, because he started it all.
>
> Just for the record:
>
> Does that also mean that you release your contributions to these macros
> under the CC-GNU LGPL, as described in this page ?
>
> http://lib.povray.org/usersguide/04contributing.html
>
> (There's a copy of the licensing section below my signature.)
I approve of this licence. So go ahead.
> If both you and Kevin do, then I'll go on and submit the macros to the
> collection. (I haven't go any response from Kevin yet. I'm not sure
> what his current email address is.)
I've googled the news site, but his last entry was july 1 2003 with
the file I later changed. That email address was kevin < at > ekoik.com,
but I think that you used that one.
I must say that I was wondering that time that he never reacted to the
changes I made. So far I can see he never posted again after that.
So there is a possibility that we can't reach him.
Can we go on without his approval? I've no experience with this. What
do you think?
>> Example statistics (you can see the pictures):
>>
>> Fn Segs SubSegs Depth Check TriCnt Time Correct?
>> -------------------------------------------------------------------
This line should be:
>> You can test my files and see some results with it.
>
> I'll do that.
Will hear from you when you had time for it.
Greetings,
Jaap Frank
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |