POV-Ray : Newsgroups : povray.binaries.scene-files : Isosurface Approximation macros rewrite : Re: Isosurface Approximation macros rewrite Server Time
18 Apr 2024 10:45:54 EDT (-0400)
  Re: Isosurface Approximation macros rewrite  
From: Jaap Frank
Date: 3 Mar 2008 17:09:01
Message: <47cc76fd@news.povray.org>
"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> 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

Preview of image 'isosurface_Segs_5_Depth_1_Check_Off_Fn_2Pi.png'
isosurface_Segs_5_Depth_1_Check_Off_Fn_2Pi.png

Preview of image 'isosurface_Segs_7_Depth_1_Check_On_Fn_8Pi.png'
isosurface_Segs_7_Depth_1_Check_On_Fn_8Pi.png

Preview of image 'isosurface_Segs_7_Depth_1_Check_Off_Fn_8Pi.png'
isosurface_Segs_7_Depth_1_Check_Off_Fn_8Pi.png


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.