Fractal with ICE - WIP

Discussions about SOFTIMAGEs© Interactive Creative Environment©
User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Fractal with ICE - WIP

Post by Daniel Brassard » 22 Oct 2012, 23:02

You could use quaternions (well, except for cos, cosh, etc.), which are essentially an extension of complex numbers and just leave j and k at 0. I believe that ICE uses W for the real part and X for i, but it doesn't really matter as long as two of the XYZ values are 0. Things like the conjugate would be fairly simple compounds.
Thanks for the hint Graham. I'll investigate this as well. :-bd

Dan
$ifndef "Softimage"
set "Softimage" "true"
$endif

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Fractal with ICE - WIP

Post by Daniel Brassard » 17 Dec 2012, 05:44

A little experiment in fractal visualization using 4 reflective mirror balls arranged in tetrahedral configuration.
Attachments
Mirror_Balls.jpg
$ifndef "Softimage"
set "Softimage" "true"
$endif

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Fractal with ICE - WIP

Post by Daniel Brassard » 17 Dec 2012, 05:50

Well, I hit a snag with the Mandelbrot Set. I can generate up to 19 iterations, but at 20 iterations i get this message:

Cannot allocate xxxxxxx bytes of continuous memory. XSI may become unstable from now on.

Then XSI just crash.

I tried many things to optimize the ICETree but I can't find a way to get around that message. Well maybe someone can help. I attached the scene file if somebody care to test.

Some helpful tips is greatly appreciated. I am using Softimage 2013.

Dan
Attachments
Mandelbrot_19.jpg
Fractal_Mandelbrot5.zip
(129 KiB) Downloaded 125 times
$ifndef "Softimage"
set "Softimage" "true"
$endif

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: Fractal with ICE - WIP

Post by Chris_TC » 17 Dec 2012, 17:33

With your default settings, 20 iterations worked, as did 30 (RAM consumption only about 500 MB). But at 30 iterations I then doubled the X subdivisions to 8, and that made the scene crash after a while.

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Fractal with ICE - WIP

Post by Daniel Brassard » 17 Dec 2012, 18:55

Thanks Chris_TC for the test.

With my old machine, I can't pass 500MB so crash more often than you. Even when I change the setting from 19 iteration to 10 iterations, you would think it's less work, the machine would not crash, but it does!

My new machine in the other hand will be a beast (Asus P9X79 / 32 MB Ram / I7 Quad Core 3820). Just have to choose the right Graphic card for the job.

Well, back to the drawing board, may have to code that one. I wonder if I could do the Mandelbrot via script and feed the PointCloud with the color attribute .....
$ifndef "Softimage"
set "Softimage" "true"
$endif

grahamef
Posts: 281
Joined: 23 Jun 2009, 21:01

Re: Fractal with ICE - WIP

Post by grahamef » 17 Dec 2012, 23:22

I think the problem is that you are using a While loop inside a Repeat loop. In fact the outer loop looks fishy to me -- why do you need to loop by the size of the ParticlePosition array?

I'm attaching a simplified example. Not sure how high you can go before it breaks.

EDIT: So far I've done a 1000x1000 grid with 5000 iterations with a bunch of other apps open. It gets slow but doesn't seem to require more memory with increased iterations.
Attachments
Mandelbrot_gf.zip
(111.16 KiB) Downloaded 100 times
mandelbrot_gf.png

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Fractal with ICE - WIP

Post by Daniel Brassard » 18 Dec 2012, 03:58

Hi Grahamef,

Thank you for taking the time to look at my ICETree.
In fact the outer loop looks fishy to me -- why do you need to loop by the size of the ParticlePosition array?
The size of the ParticlePosition array is used to determine how many particle position I have.

Each particle position give me the x and y position that I need to feed the mandelbrot algorithm with.

I use the ParticlePosition to cycle each particle for the while loop. Maybe I don't need to do that.

I will look at your solution obviously as it does not crash like mine. Always learning some tricks with ICE.
$ifndef "Softimage"
set "Softimage" "true"
$endif

grahamef
Posts: 281
Joined: 23 Jun 2009, 21:01

Re: Fractal with ICE - WIP

Post by grahamef » 18 Dec 2012, 16:32

I let it run overnight with 100000 iterations. Starting to see some nice fractal effects at the edges, but losing the gradient -- I might try running the value through a power function before look-up.
mandelbrot_gf_100000iter.png

grahamef
Posts: 281
Joined: 23 Jun 2009, 21:01

Re: Fractal with ICE - WIP

Post by grahamef » 18 Dec 2012, 16:46

Daniel Brassard wrote:
Each particle position give me the x and y position that I need to feed the mandelbrot algorithm with.

I use the ParticlePosition to cycle each particle for the while loop. Maybe I don't need to do that.
Doing it one particle at a time is the problem. Do them all at once (which you can't do with an object array, you need a per-component set of values) and let ICE chop them up into buckets for multi-threading.

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Fractal with ICE - WIP

Post by Daniel Brassard » 18 Dec 2012, 22:28

Do them all at once (which you can't do with an object array, you need a per-component set of values) and let ICE chop them up into buckets for multi-threading.
Interesting, almost a new thread that need to be opened to show that trick in action.

Maybe you can provide a simple example of this (this part of the ICE workflow is still a bit hard for me to grasp)
$ifndef "Softimage"
set "Softimage" "true"
$endif

grahamef
Posts: 281
Joined: 23 Jun 2009, 21:01

Re: Fractal with ICE - WIP

Post by grahamef » 19 Dec 2012, 00:48

Daniel Brassard wrote:Interesting, almost a new thread that need to be opened to show that trick in action.

Maybe you can provide a simple example of this (this part of the ICE workflow is still a bit hard for me to grasp)
There's nothing special about it -- it's the way ICE works naturally when dealing with a per-component set of data like PointPosition, instead of a single array of values in the object context. You can see it in my previous scene, where the While node is not nested and uses per-point values for Px, Py, and Escaped. Bottom line: Don't convert data to object arrays unless you need to convert between contexts.

I'm attaching an updated compound so people who aren't on 2013 can play with it too. Just plug it into the root of an ICE tree on an empty point cloud. This one has added parameters for zooming as well as comments so hopefully it is easier to figure out. Apropos the above, you'll notice that after I create the required number of particles with an object array of constant position (0,0,0), I switch to per-point context to calculate and set their final positions in the grid -- a small optimization, I'll admit.

BTW I accidentally forced a refresh this morning in my 100000 iteration scene and it was actually less than 20 minutes to complete. I think I'll try 3000000 tonight. :)
Attachments
gray_Mandelbrot.zip
(9.09 KiB) Downloaded 101 times
mandelbrot_gf_zoom.png

grahamef
Posts: 281
Joined: 23 Jun 2009, 21:01

Re: Fractal with ICE - WIP

Post by grahamef » 10 Jan 2013, 23:22

My previous example had a stupid error in it (should have used a Delay Set Data). I was wondering why I wasn't getting closer to the right shape despite ridiculously high iterations. I'm attaching an updated compound.

It might be nice to add a smoothed gradient when I have time, something along these lines: http://linas.org/art-gallery/escape/escape.html
Attachments
mandelbot_gf12.png
mandelbot_gf12.png (13.36 KiB) Viewed 1247 times
gray_Mandelbrot.1.2.xsicompound.zip
(9.09 KiB) Downloaded 81 times

User avatar
Tekano
Posts: 488
Joined: 09 Jun 2009, 14:49
Location: London, UK

Re: Fractal with ICE - WIP

Post by Tekano » 11 Jan 2013, 11:06

yes! :-bd I wondered why the previous ones when cranked up iterations made no real difference. your latest change seems to have bought about the classic mandlebrot nice one, will check it later.

regarding optimisation - is this still iterating a point at a time...? is there any other way to speed it up other than external c++ node or whatever?
Gossip is what no one claims to like, but everybody enjoys.

grahamef
Posts: 281
Joined: 23 Jun 2009, 21:01

Re: Fractal with ICE - WIP

Post by grahamef » 11 Jan 2013, 18:12

Tekano wrote:regarding optimisation - is this still iterating a point at a time...? is there any other way to speed it up other than external c++ node or whatever?
No, it's iterating the Mandelbrot formula on all points at the same time.

grahamef
Posts: 281
Joined: 23 Jun 2009, 21:01

Re: Fractal with ICE - WIP

Post by grahamef » 11 Jan 2013, 21:47

Last update for now: I implemented the smooth shading.
Attachments
gray_Mandelbrot.2.0.xsicompound.zip
(9.34 KiB) Downloaded 98 times
mandelbrot_smooth.png
mandelbrot_smooth.png (47.78 KiB) Viewed 1329 times

User avatar
Daniel Brassard
Posts: 878
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario
Contact:

Re: Fractal with ICE - WIP

Post by Daniel Brassard » 12 Jan 2013, 01:41

Nice Grahamef,

Thanks for taking the time to show us how to do this more efficiently. The zooming function is a nice touch. I was also asking myself why the details was stretched at the limit border, never though of the delay data node to correct it.
$ifndef "Softimage"
set "Softimage" "true"
$endif

Post Reply

Who is online

Users browsing this forum: No registered users and 56 guests