Welcome to Fractal Forums

Fractal Software => 3D Fractal Generation => Topic started by: alexl on May 04, 2011, 04:53:09 AM




Title: Realtime rendering on GPU
Post by: alexl on May 04, 2011, 04:53:09 AM
Basically I work in the area of generative art. I use the GPU for realtime rendering and very rarely use fractals, they struck me as pretty boring. But two weeks ago I found information about mandelbox... Wow!  I think it is a very interesting approach... So I applied this algorithm in my existing engine and .. look at the result:

(http://www.sanbasestudio.com/art/img/mandelbox_shadows2.jpg)

The speed is not too impressive - about 7fps on 1920x1080 GTX480 but I'm waiting for a new generation of videocards.

www.sanbasestudio.com


Title: Re: Realtime rendering on GPU
Post by: ker2x on May 04, 2011, 05:05:05 PM
7 fps is slow ?  :o


Title: Re: Realtime rendering on GPU
Post by: alexl on May 05, 2011, 02:36:08 AM
7 fps is slow ?  :o

Yes, I want to have 30fps :)

This is demo:
http://www.youtube.com/watch?v=z18omLWzChE


Title: Re: Realtime rendering on GPU
Post by: Lee Oliver on May 05, 2011, 02:37:27 AM
This looks promising, keep us posted on any new developments :)


Title: Re: Realtime rendering on GPU
Post by: David Makin on May 05, 2011, 02:53:58 AM
7 fps is slow ?  :o

Depends on the context, but for smooth animation in realtime around 25fps is a generally accepted minimum, though a lot of games in the past used to get away with as low as 10fps and IMHO anything less than that is not "realtime" but just "interactive" :)


Title: Re: Realtime rendering on GPU
Post by: alexl on May 10, 2011, 06:13:10 PM
Several images:

(http://www.sanbasestudio.com/art/img/x1547.jpg)
Space Yard.

(http://www.sanbasestudio.com/art/img/x1551.jpg)
Seems a lot of construction here :)

(http://www.sanbasestudio.com/art/img/x1550.jpg)
I don't know what it is. Just nice.

(http://www.sanbasestudio.com/art/img/x1555.jpg)
It's kind of cave...

(http://www.sanbasestudio.com/art/img/x1553.jpg)
Ropes or vines.

(http://www.sanbasestudio.com/art/img/x1549.jpg)
It looks like a bark

(http://www.sanbasestudio.com/art/img/x1545.jpg)
And the latest one: something in the style of Monet

All these screenshots were taken within one hour. I used the same formula with different parameters (I change them manually).
Speed: 12fps on 1920x1080 (GTX480)




Title: Re: Realtime rendering on GPU
Post by: Syntopia on May 11, 2011, 11:07:54 PM
Very nice images - I like the final one in particular.


Title: Re: Realtime rendering on GPU
Post by: cbuchner1 on May 12, 2011, 08:32:49 PM
(http://jeffrey-davis.net/blog/wp-content/uploads/2010/04/holy-carp.jpg)

These are beautiful!!!


Title: Re: Realtime rendering on GPU
Post by: David Makin on May 12, 2011, 08:48:47 PM

All these screenshots were taken within one hour. I used the same formula with different parameters (I change them manually).
Speed: 12fps on 1920x1080 (GTX480)


Excellent work ! Any chance of releasing the binary ? (or even the source ;)

I have an awful lot of catching up to do with respect to 3D hardware, I'm working on it though.
At the moment I'm just trying a combined diamond-square/perlin noise algorithm in the hope that once I've got it fast enough simply rendering in 2D to a texture I can then use an adapted form of DE to give a realtime 3D landscape renderer without any polygons at all, though if that's asking a little too much I could easily convert to using a multi-resolution mesh method instead ;)
Am still working on the design for the initial format of a UF-like GPU program - I'm deliberately sticking to a format that will work on iPad/iPhone (and other mobile devices if anyone wants to convert from iOS) as well as OSX (and Win7/Linux if anyone wants to convert).


Title: Re: Realtime rendering on GPU
Post by: eiffie on May 13, 2011, 06:56:14 PM
I would be happy to get 12 of those frames per minute on my GPU. And I second the call for at least releasing a section of the pixel shader - like maybe the occlusion and lighting?? Great stuff anyways.


Title: Re: Realtime rendering on GPU
Post by: alexl on May 14, 2011, 12:51:01 AM
Any chance of releasing the binary ? (or even the source ;)

Unfortunatelly it requires VERY powerfull system...
take a look: http://www.sanbasestudio.com/system.html

I can show the formula (first image):

vec4 sphere(vec4 z)
{
   float r2 = dot(z.xyz,z.xyz);
   if(r2<2.0)
      z*=(1.0/r2);
   else   z*=0.5;

   return z;

}
vec3 box(vec3 z)
{
   return clamp(z, -1.0, 1.0) * 2.0 - z;
}

float DE0(vec3 pos)
{
   vec3 z=pos-from;
   float r=dot(pos-from,pos-from)*pow(length(z),2.0);
   return (1.0-smoothstep(0.0,0.01,r))*0.01;
}

float DE2(vec3 pos)
{

   vec4 scale = -20*0.272321;
     vec4 p = vec4(pos,1.0), p0 = p;  
   vec4 c=vec4(param[31].w,param[32].w,param[33].w,0.5)-0.5; // param = 0..1

     for (float i=0;i<10; i++)
   {
      p.xyz=box(p.xyz);
      p=sphere(p);
      p=p*scale+c;
     }

   return length(p.xyz)/p.w;
}

float DE(vec3 pos)
{

   float d0=DE0(pos);   
   float d2=DE2(pos);

   return max(d0,d2);
}

 
Record:
 http://www.youtube.com/watch?v=RSjWB21PJfs


Concerning:
give a realtime 3D landscape renderer without any polygons at all

Take a look at some of my works:

http://www.youtube.com/watch?v=lkTJL7PZdNY

http://www.youtube.com/watch?v=M-zxQ7tFncU

http://www.youtube.com/watch?v=F7LE7W3n5BI



Title: Re: Realtime rendering on GPU
Post by: David Makin on May 14, 2011, 03:56:13 AM
Any chance of releasing the binary ? (or even the source ;)

Unfortunatelly it requires VERY powerfull system...
take a look: http://www.sanbasestudio.com/system.html


Well I have a new MacPro with dual 2.66GHz 6-core Westmeres and an ATI Radeon HD 5870 :)
CPU (Ultra Fractal) benchmarks here:

http://www.shadoworld.co.uk/UF5/Benchmark/Benchmark%20results.htm

However I'm hoping to get at least "interactive" speeds (say 5 to 10 fps) for my 3D fractal shader 2 rendering on the iPad and iPhone - not including all the bells and whistles with respect to lighting of course ;)




Title: Re: Realtime rendering on GPU
Post by: David Makin on May 14, 2011, 04:04:32 AM


I can show the formula (first image):

vec4 sphere(vec4 z)
{
   float r2 = dot(z.xyz,z.xyz);
   if(r2<2.0)
      z*=(1.0/r2);
   else   z*=0.5;

   return z;

}
vec3 box(vec3 z)
{
   return clamp(z, -1.0, 1.0) * 2.0 - z;
}

float DE0(vec3 pos)
{
   vec3 z=pos-from;
   float r=dot(pos-from,pos-from)*pow(length(z),2.0);
   return (1.0-smoothstep(0.0,0.01,r))*0.01;
}

float DE2(vec3 pos)
{

   vec4 scale = -20*0.272321;
     vec4 p = vec4(pos,1.0), p0 = p;  
   vec4 c=vec4(param[31].w,param[32].w,param[33].w,0.5)-0.5; // param = 0..1

     for (float i=0;i<10; i++)
   {
      p.xyz=box(p.xyz);
      p=sphere(p);
      p=p*scale+c;
     }

   return length(p.xyz)/p.w;
}

float DE(vec3 pos)
{

   float d0=DE0(pos);   
   float d2=DE2(pos);

   return max(d0,d2);
}


OK, I'm new to shader code but so far I've found nothing to indicate that the OpenCL compilers do auto-inlining - am I missing something ?


Title: Re: Realtime rendering on GPU
Post by: Syntopia on May 14, 2011, 08:29:57 AM
OK, I'm new to shader code but so far I've found nothing to indicate that the OpenCL compilers do auto-inlining - am I missing something ?

I think the code is GLSL (given the 'vec3' type). GLSL compilers will do agressive inlining and loop unrolling, so there is no need to do this manually. It is possible to get the GPU assembly using Nvidia’s Cg SDK, if you want to check the compiler output. I am guessing OpenCL will perform the same kind of optimizations.


Title: Re: Realtime rendering on GPU
Post by: David Makin on May 14, 2011, 12:12:14 PM
OK, I'm new to shader code but so far I've found nothing to indicate that the OpenCL compilers do auto-inlining - am I missing something ?

I think the code is GLSL (given the 'vec3' type). GLSL compilers will do agressive inlining and loop unrolling, so there is no need to do this manually. It is possible to get the GPU assembly using Nvidia’s Cg SDK, if you want to check the compiler output. I am guessing OpenCL will perform the same kind of optimizations.


Thanks, given that info I will be doing a test shader fragment to check if inlining is done automatically on the devices I'm interested in (and to what extent) - to be honest I never even trust the documentation with respect to this sort of thing because it's often out of date or even completely wrong - in the past that even goes for documentation from Intel, and for many others it's nothing unusual ;)


Title: Re: Realtime rendering on GPU
Post by: alexl on May 14, 2011, 05:55:45 PM
Yes, it's GLSL.
You can find doc here: http://www.opengl.org/documentation/glsl/


Title: Re: Realtime rendering on GPU
Post by: alexl on May 30, 2011, 12:03:06 AM
It's stereo demo:
   http://www.sanbasestudio.com/demo/stereo.html

If your eyes are not so widely apart, try this version:
   http://www.sanbasestudio.com/demo/stereo1.html



Title: Re: Realtime rendering on GPU
Post by: marius on May 30, 2011, 01:05:48 AM
It's stereo demo:
   http://www.sanbasestudio.com/demo/stereo.html

If your eyes are not so widely apart, try this version:
   http://www.sanbasestudio.com/demo/stereo1.html



try uploading to youtube, its player allows for lots of stereoscopic playback options. Including nvidia shutter setups these days.


Title: Re: Realtime rendering on GPU
Post by: alexl on May 31, 2011, 07:12:46 PM
try uploading to youtube, its player allows for lots of stereoscopic playback options. Including nvidia shutter setups these days.
Which format I should use for this? I mean L-R, R-L or anaglyph? I used L-R schema but in this case I can't make distance between centers of images > 2.5"


Title: Re: Realtime rendering on GPU
Post by: marius on June 01, 2011, 06:16:39 PM
try uploading to youtube, its player allows for lots of stereoscopic playback options. Including nvidia shutter setups these days.
Which format I should use for this? I mean L-R, R-L or anaglyph? I used L-R schema but in this case I can't make distance between centers of images > 2.5"
I use over-under to retain max horizontal resolution but you can upload full-rez side-by-side.

Anaglyph is hard to pull apart and has compromised the color information, so you have to upload a clean left and right frame composite.

With the yt3d tags you can then specify which portion of the frame is left and which is right.
Look for examples of those tags as used by some of the 3d vids for inspiration.


Title: Re: Realtime rendering on GPU
Post by: alexl on July 25, 2011, 01:46:30 AM
A couple of images:

(http://www.sanbasestudio.com/art/img/x1567.jpg)

(http://www.sanbasestudio.com/art/img/x1569.jpg)


Title: Re: Realtime rendering on GPU
Post by: alexl on October 16, 2011, 08:33:52 PM
A couple of stereoscopic images:

(http://www.sanbasestudio.com/jpg/stereo.jpg)

(http://www.sanbasestudio.com/jpg/stereo2.jpg)


... and youtube demo (3D, side-by-side):

http://www.youtube.com/watch?v=Arloc-N1Whs


Title: Re: Realtime rendering on GPU
Post by: ld0d on October 23, 2011, 10:12:43 AM
Hi,

I have also written some realtime rendering code; have a look at the other thread behind this link (http://www.fractalforums.com/movies-showcase-%28rate-my-movie%29/realtime-mandelbox-t9134/)... (sorry to hijack your thread :)

 - ld


Title: Re: Realtime rendering on GPU
Post by: alexl on January 17, 2012, 10:32:11 PM
I just published two of my 3D fractal works in stereoscopic (side-by-side) format.  If you have 3D TV - these videos are able to showcase the true potential of your TV!
Take a look: http://www.sanbasestudio.com/3d.htm


Title: Re: Realtime rendering on GPU
Post by: marius on January 18, 2012, 06:10:45 AM
I just published two of my 3D fractal works in stereoscopic (side-by-side) format.  If you have 3D TV - these videos are able to showcase the true potential of your TV!
Take a look: http://www.sanbasestudio.com/3d.htm

very cool, nice and serene. Good music to match.

The 3d isn't popping out as much. What field of view are you rendering? Looks large, given the spherical looking near plane clipping.

How do you render left & right? Simple side-step or asymmetric frustum?

I find 3d effects are best when rendering approximately the field of view of the display device. And trace rays for left & right eye through the pixels of the projection plane / screen. That results in slightly different directions for same pixels in left & right eye, hence the asymmetric.

Nice texturing / coloring. Care to share your approach?


Title: Re: Realtime rendering on GPU
Post by: Mrz00m on March 06, 2012, 06:01:14 AM
hiya, just for reference, there is also stream rendering  examples on subblue fractal website, boxplorer cl binaries, and mandelbulber 1.11. speed just depends on iteration depth according to subblue, you cant get the highest quality boxes in 30fps mode yet.


Title: Re: Realtime rendering on GPU
Post by: alexl on March 14, 2012, 07:03:03 PM
How do you render left & right? Simple side-step or asymmetric frustum?
I use this approach:
// vertex shader
void main(void)
{
   gl_Position = ftransform();
   gl_TexCoord[0] = gl_MultiTexCoord0;

   coord=gl_TexCoord[0].xy;
   coord.y-=(eye-0.5)*0.08;  // parallax far
   from.z+=(eye-0.5)*0.012 // parallax near
   vec3 Dir = normalize(Target-Eye);
   vec3 up = Up-dot(Dir,Up)*Dir;
   up = normalize(up);
   vec3 Right = normalize( cross(Dir,up));
   dir = (coord.x*Right + coord.y*up )+Dir;
}

// fragment shader
void main()
{
   gl_FragData[0].xyz= trace(from,dir);
}

Also a couple of pictures:

(http://sanbase.org/tmp/f1.jpg)

(http://sanbase.org/tmp/f2.jpg)

It is mandelbox, scale=1.5 c=0.1

     for (i=0;i<12;i++)
   {
      p.xyz=boxFold(p.xyz);
      p/=max(dot(p.xyz,p.xyz),0.5);
      p*=scale;
      p.xyz+=c;
      if(i==2)
         p.xyz+=p.zxy;
     }


Title: Re: Realtime rendering on GPU
Post by: Syntopia on March 14, 2012, 11:18:24 PM
Hi Alexl,

Last week I downloaded your two side-by-side movies, and played them on a computer with a 3D monitor (a Samsung Syncmaster 3D w. shutter glasses). The 3D perception was really good - so for me your frustum setup works fine.


Title: Re: Realtime rendering on GPU
Post by: alexl on April 17, 2012, 03:27:10 PM
Last week I downloaded your two side-by-side movies, and played them on a computer with a 3D monitor (a Samsung Syncmaster 3D w. shutter glasses). The 3D perception was really good - so for me your frustum setup works fine.
I've made a true 3DBD (MVC format). It's here: http://www.sanbase.org


Title: Re: Realtime rendering on GPU
Post by: alexl on April 21, 2012, 09:03:26 PM
I continue to develop this technology. A couple of samples:

(http://www.sanbasestudio.com/art/img/ex1600.jpg)

(http://www.sanbasestudio.com/art/img/ex1589.jpg)

The second one is a screenshot from: http://www.sanbase.org (stereoscopic movie)


Title: Re: Realtime rendering on GPU
Post by: Syntopia on April 21, 2012, 09:45:04 PM
Great images, and kudos for creating an entire 3D bluray production.

Your movies look texture-mapped. Do you project 2D textures onto the fractals?

I've tried this myself, using the following approach:
Code:
vec3 color = texture2D(tex, p.yz)*normal.x
     + texture2D(tex, p.xz)*normal.y
     + texture2D(tex, p.xy)*normal.z;
Basically, to avoid the texture looking stretched in some directions, I choose the projection based on the surface normal. This works, but the resulting texture will be blended together of several textures.

Here is an example:
(http://blog.hvidtfeldts.net/media/texture.png)

Here the same image with a grid texture:
(http://blog.hvidtfeldts.net/media/texture2.png)

But the method works best when the surface hasn't got rapidly varying surface normals.

How do you project onto 3D?


Title: Re: Realtime rendering on GPU
Post by: alexl on April 21, 2012, 11:11:03 PM
Great images, and kudos for creating an entire 3D bluray production.

Your movies look texture-mapped. Do you project 2D textures onto the fractals?

I've tried this myself, using the following approach:
Code:
vec3 color = texture2D(tex, p.yz)*normal.x
     + texture2D(tex, p.xz)*normal.y
     + texture2D(tex, p.xy)*normal.z;
Basically, to avoid the texture looking stretched in some directions, I choose the projection based on the surface normal. This works, but the resulting texture will be blended together of several textures.

But the method works best when the surface hasn't got rapidly varying surface normals.

How do you project onto 3D?
I use the same approach:

vec4 surface_3D(float zoom, vec3 pos, vec3 norm)
{
   vec4 surf1=surface(zoom*pos.yx); // left/right
   vec4 surf2=surface(zoom*pos.yz); // vert
   vec4 surf3=surface(zoom*pos.xz); // top

   vec3 blend_weights = abs(norm.zxy);
   blend_weights /= (blend_weights.x + blend_weights.y + blend_weights.z );

   return  (surf1*blend_weights.x + surf2*blend_weights.y + surf3*blend_weights.z);

}

It is a fake, of course but ... it works. :)

I used also:
    vec3 blend_weights = abs(norm.zxy);
    blend_weights = smoothstep(0.5,1.0,blend_weights);   
    blend_weights /= (blend_weights.x + blend_weights.y + blend_weights.z );

Sometimes it looks better but it depends on picture.



Title: Re: Realtime rendering on GPU
Post by: Syntopia on April 21, 2012, 11:41:17 PM
I use exactly the same normalization, just with an added power function to control the transition:
Code:
n = pow(abs(n),P);
n/= (n.x+n.y+n.z);
I've also found this: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html where a slightly differnt blending function is used.


Title: Re: Realtime rendering on GPU
Post by: alexl on April 22, 2012, 12:23:36 AM
I use exactly the same normalization, just with an added power function to control the transition:
Code:
n = pow(abs(n),P);
n/= (n.x+n.y+n.z);
I've also found this: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch01.html where a slightly differnt blending function is used.

Yeah, they use:
blend_weights = (blend_weights - 0.2) * 7;   
blend_weights = max(blend_weights, 0);     

I tested nvidia algorithm but I do not see significant difference.


Title: Re: Realtime rendering on GPU
Post by: alexl on April 30, 2012, 09:08:42 PM
Video on youtube:
http://www.youtube.com/watch?v=eNIzC7QipLE


Title: Re: Realtime rendering on GPU
Post by: alexl on November 14, 2012, 10:20:24 PM
One more video:

http://www.youtube.com/watch?v=snTL81mewz8

http://player.vimeo.com/video/53626373

Hardware:
(http://sanbase.org/tmp/comp71.jpg)

CPU: i7 3770
GPU: GTX680.


Title: Re: Realtime rendering on GPU
Post by: weavers on November 16, 2012, 04:34:32 AM
_______________________________________________________________________________________________________________________ ______

Greetings and Salutations Master, ALEXI Its been a million hours or more, you've been busy!

THERE you go again, taking us along for another one of your great fractal time cruises in fractal mind scape alternate, Time, away from out of our comfort zone, of knowns time, to unknown spatial time!

Long live the total time, every second spliced by your mind to our kind,  you do so pleasure our eyes with this journey, which proves to us, you're a Time Raider Pirate Traveler, full of intriguing visions! You definite got this viewers attention, great job! Glad to see your work! We really appreciate it and don't mind telling you so! What we see here is : We appear to be in a Fractal Jungle, a forest in breeding, there are distance spires, lines, cables, electrical lines, that are alive and hanging resembling spiders and circles, portals belonging to mind scape's too scary for us to follow! Again love your background skies so real!
Thanks for sharing this mentsl taxi ride, into one of your minds super creations! Really cool! Enjoyed the trip! Yes, the music is perfect! It more than tells the story. It says it all, within its beauty lies dark tantalizing touches of danger, good, we are dare devils anyway, unafraid, Thanks again!





The Fractal Forum  the possibilities are infinite

.


Title: Re: Realtime rendering on GPU
Post by: M Benesi on November 17, 2012, 01:35:07 AM
Nice videos, peaceful.  Jealous of the hardware too! 


Title: Re: Realtime rendering on GPU
Post by: alexl on March 25, 2013, 09:11:24 PM
Screenshot:

(http://sanbase.org/jpg/000250.2.jpg)


Title: Re: Realtime rendering on GPU
Post by: cbuchner1 on March 25, 2013, 10:58:16 PM
I just placed an order for the Blu Ray. Surprisingly your order page sent me right to Paypal.

I am situated in Germany. The shipping address stored in PayPal states "Deutschland" as country, I hope this is translated to "Germany" automatically when PayPal sends you the recipient Information. Otherwise Canadian post might get confused.

Your shipping rate seems relatively low. Let me know if I need to send additional funds in order to have this shipped internationally.

At this price, the 3D Blu Ray seems a steal.


Title: Re: Realtime rendering on GPU
Post by: alexl on March 26, 2013, 06:37:55 PM
The disc has been sent to your address today :)
I hope you have a 3D TV.
P.S. As far as see, you live in an apartment building, but your address do not include the number of the apartment.


Title: Re: Realtime rendering on GPU
Post by: cKleinhuis on March 26, 2013, 07:16:16 PM
Ehrm please discus private details in private!
No need for appartment num here ;)


Title: Re: Realtime rendering on GPU
Post by: cbuchner1 on March 27, 2013, 11:45:07 AM
Ehrm please discus private details in private!
No need for appartment num here ;)

Right, the recipient's name genereally identifies the apartment here. Which occasionally confuses the post man if two building residents have similar sounding names. ;)

I am looking forward to this disc. I own a 3D monitor and intend to buy a 3D TV soon.

Christian


Title: Re: Realtime rendering on GPU
Post by: alexl on March 27, 2013, 06:57:48 PM
This content has been optimized for 55" screen. If you have 40" -70" - it's OK, but I think that your monitor is 27" or something like that. The thing is that the objects can be located quite close to the viewer (half of the distance to the screen). In case of big TV screen that's fine, but if you use a monitor, it may be too close to your eyes.

One more screenshot (new stuff):
(http://www.sanbase.org/jpg/x1612.jpg)


... and video (see screenshot 3 posts above):

http://www.youtube.com/watch?v=-itQwiAqo9M


Title: Re: Realtime rendering on GPU
Post by: alexl on May 13, 2013, 06:46:07 PM
"Our World is a Crazy Fractal"
Video:

http://www.youtube.com/watch?v=Nn9_JGPA9j0


Title: Re: Realtime rendering on GPU
Post by: Mrz00m on September 12, 2014, 12:04:33 PM
The programming figured here is different from the mandelflying program isn't it?

nice work. the entire thing looks ray traced. that's all i can reveal for the moment :)