Mandelbrot ISL shader

General questions about Indigo, the scene format, rendering etc...
Post Reply
14 posts • Page 1 of 1
User avatar
OnoSendai
Developer
Posts: 6173
Joined: Sat May 20, 2006 6:16 pm
Location: Newcastle upon Tyne, UK
Contact:

Mandelbrot ISL shader

Post by OnoSendai » Wed Oct 06, 2010 9:19 pm

Hi Everyone,
for a bit of fun, I implemented rendering of the Mandelbrot set in ISL.

The material with shader is as follows:

Code: Select all

<material>
		<name>mat1</name>
		<diffuse>
			
			<albedo>
        <shader>
          <shader>
            <![CDATA[
            # x^2 = (a + bi)^2 = aa + 2abi + bbii
            # = a^2 + 2abi -b^2
            # = a^2-b^2 + 2abi
            
            # Does one iteration (application of f)
            # Returns (re(x), im(x), i)
            # Where i is the number of iterations before the point escaped.
            def f(vec3 x, vec2 c) vec3 :
              vec3(
                e0(x)*e0(x) - e1(x)*e1(x) + e0(c),
                2.0*e0(x)*e1(x) + e1(c),
                if((e0(x)*e0(x) + e1(x)*e1(x)) < 2.0, e2(x) + 1.0, e2(x))
              )
              
            # The composition of f with itself.  Does 2 iterations.
            # ISL doesn't support recursion for various reasons,
            # so we'll use the following composition technique for bounded 'recursion'.
            def f2(vec3 x, vec2 c) vec3:
              f(f(x, c), c)
              
            # Does 4 iterations
            def f4(vec3 x, vec2 c) vec3:
              f2(f2(x, c), c)
            
            # etc..
            def f8(vec3 x, vec2 c) vec3:
              f4(f4(x, c), c)
              
            def f16(vec3 x, vec2 c) vec3:
              f8(f8(x, c), c)

            def f32(vec3 x, vec2 c) vec3:
              f16(f16(x, c), c)

            def f64(vec3 x, vec2 c) vec3:
              f32(f32(x, c), c)

            def f128(vec3 x, vec2 c) vec3:
              f64(f64(x, c), c)
              
            def colour(real i) vec3:
              vec3(i * 0.02, i * 0.04, i * 0.08)

            def eval(vec3 pos) vec3 :
              # We will use the texture coordinates for c.
              # Return a colour based on the number of iterations before escape,
              # which is in the third vector component of the returned vector, hence the e2()
              # We call f128 to do 128 iterations.
              colour(e2(f128(vec3(0.0,0.0,0.0), getTexCoords(0))))
             ]]>
          </shader>
        </shader>
			</albedo>
		</diffuse>
	</material>
Attachments
mandelbrot_set.jpg

User avatar
fused
Developer
Posts: 3552
Joined: Fri Sep 22, 2006 7:19 am
Location: Berlin, Germany
3D Software: Cinema 4D

Re: Mandelbrot ISL shader

Post by fused » Wed Oct 06, 2010 9:25 pm

nooooooooooooooooooooooooooooooooooooooooooooooo!

User avatar
zeitmeister
2nd Place 100
Posts: 1996
Joined: Tue Apr 22, 2008 4:11 am
Location: Limburg/Lahn, Germany
Contact:

Re: Mandelbrot ISL shader

Post by zeitmeister » Wed Oct 06, 2010 9:26 pm

Hehe!
Cheers, David



DAVIDGUDELIUS // 3D.PORTFOLIO
·
Indigo 4.2.23 | Indigo for C4D 4.2.22 | C4D R14.042 | Mac OS X 10.13.6 | Windows 10 Professional x64

User avatar
lycium
Developer
Posts: 1193
Joined: Wed Sep 12, 2007 7:46 am
Location: Leipzig, Germany
Contact:

Re: Mandelbrot ISL shader

Post by lycium » Wed Oct 06, 2010 9:27 pm

nicely done mr chapman! i am ashamed you beat me to it :oops:

StompinTom
Indigo 100
Posts: 1819
Joined: Mon Sep 04, 2006 3:33 pm

Re: Mandelbrot ISL shader

Post by StompinTom » Thu Oct 07, 2010 2:18 am

lycium wrote:nicely done mr chapman! i am ashamed you beat me to it :oops:
http://en.wikipedia.org/wiki/Seppuku

User avatar
Borgleader
Posts: 2149
Joined: Mon Jun 16, 2008 10:48 am

Re: Mandelbrot ISL shader

Post by Borgleader » Thu Oct 07, 2010 2:51 am

lycium wrote:nicely done mr chapman! i am ashamed you beat me to it :oops:
I guess his edumaction paid off :lol:
benn hired a mercenary to kill my sig...

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Re: Mandelbrot ISL shader

Post by CTZn » Thu Oct 07, 2010 3:14 am

Hey StompinTom, it seems like there was a challenge between the guys but I don't think that seppuku was involved.

lol though :lol:
obsolete asset

User avatar
galinette
1st Place Winner
Posts: 923
Joined: Sat Jan 09, 2010 1:39 am
Location: Nantes, France
Contact:

Re: Mandelbrot ISL shader

Post by galinette » Thu Oct 07, 2010 10:20 am

Hey, not fair! Please advise when starting that kind of contest :)
Eclat-Digital Research
http://www.eclat-digital.com

User avatar
OnoSendai
Developer
Posts: 6173
Joined: Sat May 20, 2006 6:16 pm
Location: Newcastle upon Tyne, UK
Contact:

Re: Mandelbrot ISL shader

Post by OnoSendai » Thu Oct 07, 2010 9:07 pm

galinette wrote:Hey, not fair! Please advise when starting that kind of contest :)
Will do for next one :)

User avatar
Godzilla
Indigo 100
Posts: 985
Joined: Sat Jun 06, 2009 11:33 am

Re: Mandelbrot ISL shader

Post by Godzilla » Fri Oct 08, 2010 7:22 am

I was bored, so..


Image


Click the image for a larger version, or go here for the 'Holy shit thats huge' version.

Largest image done in Indigo?
samlavoie.xyz

StompinTom
Indigo 100
Posts: 1819
Joined: Mon Sep 04, 2006 3:33 pm

Re: Mandelbrot ISL shader

Post by StompinTom » Fri Oct 08, 2010 9:00 am

Godzilla wrote:I was bored, so..


Image


Click the image for a larger version, or go here for the 'Holy shit thats huge' version.

Largest image done in Indigo?
Geez, you couldn't have gotten rid of all the noise? I think that's begging for a challenge... How much RAM did that eat up?

User avatar
Godzilla
Indigo 100
Posts: 985
Joined: Sat Jun 06, 2009 11:33 am

Re: Mandelbrot ISL shader

Post by Godzilla » Fri Oct 08, 2010 9:09 am

About 6.5GB of RAM @ 1 Super Samples
samlavoie.xyz

User avatar
pixie
Indigo 100
Posts: 2191
Joined: Sat Dec 29, 2007 4:54 am
Location: Away from paradise
Contact:

Re: Mandelbrot ISL shader

Post by pixie » Fri Oct 08, 2010 9:41 am

Godzilla wrote:About 6.5GB of RAM @ 1 Super Samples
I wonder how much memory if you had used indigo_console

User avatar
arc en ciel
Posts: 138
Joined: Tue Apr 12, 2016 2:33 am

Re: Mandelbrot ISL shader

Post by arc en ciel » Wed May 24, 2017 6:44 am

Image
is someone could write a Mandelbrot ISL shader for blend channel, please :?:
I can't figure out how to do it...

Post Reply
14 posts • Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest