Logo by CorneliaYoder - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Visit the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. April 25, 2024, 11:25:57 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: a lil' problem with my DE formula in fragmentarium  (Read 2691 times)
0 Members and 1 Guest are viewing this topic.
ker2x
Fractal Molossus
**
Posts: 795


WWW
« on: January 05, 2012, 05:54:59 PM »

is my formula wrong ?
Why does it look all messy ?

Code:
#include "DE-Raytracer.frag"


float DE(vec3 pos) {
return (length(pos)-1.0)+sin(pos.x*pos.y*pos.z*100.0)/10.0;
}



PS : sorry it's not really fractal (yet!) undecided
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #1 on: January 05, 2012, 07:32:36 PM »

If you want it 100% correct, the distance must be non-directional.
This is often not possible or to much work, so you need to decrease the raystep multiplier.  Fragmentarium has such a limiter somewhere.  smiley

You can predict more or less how much you have to decrease this limiter on such easy formulas, the higher those "hills" made with those offsets are, the more you have to decrease the limiter.

Maybe i make a little graph if i have time, but it is not hard to understand, like a heightmap flying over and the distance is calculated towards the ground direction and a hill in front of you is nearer, but not considered in the calculation!
Logged
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #2 on: January 05, 2012, 07:48:10 PM »

(Oh, Jesse just posted while I was typing  smiley)

A DE function must return the distance to the closest point on the fractal surface (or a lower bound for the distance). So not all functions can be used as DE's. In particular, the slope of the DE must never be more than 1. Otherwise the ray marcher will overstep and end up inside the object. In mathematical terms this means the DE-function must be Lipschitz continuous (with a Lipschitz constant of one) and zero at the object boundary.

Sometimes you can get reasonable results by dividing the DE with a fixed number (the Fudge Factor in Fragmentarium).
And sometimes you can get rid of some noise by oversampling (rendering in hires and downsizing).

Here is what I got after trying your formula and fiddling with the parameters:


* sphere.png (186.05 KB, 533x374 - viewed 298 times.)
Logged
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #3 on: January 05, 2012, 09:21:46 PM »

yay \o/



Thank you for your help.
I don't really understand yet, but i'm working on it.  grin

I'm learning GLSL (with the help of a book and http://www.iquilezles.org/www/index.htm ) and found that fragmentarium is really helpfull to learn by trial and error  angel
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #4 on: January 05, 2012, 09:31:52 PM »

(Oh, Jesse just posted while I was typing  smiley)


Yeah, i am sorry for my crappy explanation!

Lipschitz continuous, have to remember this  smiley


ps: great work on your program, Syntopia.  Just wondering if it would be a good idea for speed purpose, if doing only some raysteps in each thread and giving finished rays new ones.  Or does this automatically happen if you run on more pixels than GPU threads are available?
So no threads have to wait...
(Hope this sounds not to silly, i am a GPU newbie)
Logged
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #5 on: January 05, 2012, 09:40:57 PM »

Ho, btw, i'm using Fragmentarium on a low-end AMD Fusion EeePC and it works flawlessly (it's slower than my GTX470 of course, but it works!)
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #6 on: January 05, 2012, 09:52:16 PM »

ps: great work on your program, Syntopia.  Just wondering if it would be a good idea for speed purpose, if doing only some raysteps in each thread and giving finished rays new ones.  Or does this automatically happen if you run on more pixels than GPU threads are available?
So no threads have to wait...
(Hope this sounds not to silly, i am a GPU newbie)


I'm not sure exactly what you ask, but for a GPU, using one thread per pixel is probably quite optimal. Many threads are a good thing on a GPU - in fact the numbers of threads should be much higher than the number of physical execution cores (which already is in the hundreds for a modern graphics card). This is due to the latency of many operations on the GPU - while waiting for an operation to finish, the GPU can switch to another thread on the multiprocessor and continue (there is no cost for switching between threads on the same MP). That there will be threads waiting to be scheduled, shouldn't make a difference - the total amount of work there needs to be done is the same no matter how you divide it.

Having said that, using one thread per pixel is also by far the easiest when using GLSL. There is no way to synchronize between threads in GLSL.

The only problem with this approach is, that the drawing of a frame must finish in less than two seconds. Otherwise Windows kill the display driver and restores it (you can get around this by rendering in tiles, though).

Logged
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #7 on: January 05, 2012, 10:07:10 PM »


I'm not sure exactly what you ask, but for a GPU, using one thread per pixel is probably quite optimal. Many threads are a good thing on a GPU - in fact the numbers of threads should be much higher than the number of physical execution cores (which already is in the hundreds for a modern graphics card). This is due to the latency of many operations on the GPU - while waiting for an operation to finish, the GPU can switch to another thread on the multiprocessor and continue (there is no cost for switching between threads on the same MP). That there will be threads waiting to be scheduled, shouldn't make a difference - the total amount of work there needs to be done is the same no matter how you divide it.

Having said that, using one thread per pixel is also by far the easiest when using GLSL. There is no way to synchronize between threads in GLSL.

The only problem with this approach is, that the drawing of a frame must finish in less than two seconds. Otherwise Windows kill the display driver and restores it (you can get around this by rendering in tiles, though).


Thanks, you got it even my question was wrong... i meant not threads but cores, so rendering more pixels (generating each a thread?) would lead to full usage of all available cores until all threads are finished.

Ok, no disadvantage here.
You only have more control over the GPU when doing less steps, or as you did with tiling.

This question is of course more of a technical interest, the speed is not really bad  wink  A Beer Cup
« Last Edit: January 05, 2012, 10:09:57 PM by Jesse » Logged
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #8 on: January 05, 2012, 11:08:22 PM »

i'm having fun  embarrass

« Last Edit: January 05, 2012, 11:18:49 PM by ker2x » Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #9 on: January 05, 2012, 11:18:49 PM »

Ho, btw, i'm using Fragmentarium on a low-end AMD Fusion EeePC and it works flawlessly (it's slower than my GTX470 of course, but it works!)

Really? I would have thought these were too weak? I still haven't figured out what this AMD Fusion APU thing is, though.
Logged
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #10 on: January 05, 2012, 11:27:55 PM »

Ho, btw, i'm using Fragmentarium on a low-end AMD Fusion EeePC and it works flawlessly (it's slower than my GTX470 of course, but it works!)

Really? I would have thought these were too weak? I still haven't figured out what this AMD Fusion APU thing is, though.

The Historical 3D Fractal Mandelbulb, is running at 1.3FPS in continuous render mode.
The AMD Fusion is a graphic chipset embedded on the CPU (with shared memory and so on).

Here is the output of GPU-Z on my system : http://www.techpowerup.com/gpuz/5e8e4/


(and 18FPS on my linux laptop with a GTX460M  grin )
« Last Edit: January 06, 2012, 12:11:25 PM by ker2x » Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #11 on: January 05, 2012, 11:32:04 PM »

Okay a question.
Explain me a way to render a fractal only writing the formula and estimating the distance (without having to calc derivs, too hard and long for me ) pwease grin
Logged

No sweat, guardian of wisdom!
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #12 on: January 06, 2012, 12:30:08 AM »

<snip>

Otherwise Windows kill the display driver and restores it (you can get around this by rendering in tiles, though).


Surely there's some way to change that behaviour anyway huh?
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #13 on: January 06, 2012, 09:55:55 AM »

<snip>

Otherwise Windows kill the display driver and restores it (you can get around this by rendering in tiles, though).


Surely there's some way to change that behaviour anyway huh?

You can hack the registry to change this timeout. it's explained in the Fragmentarium FAQ, and i explained the same process some times ago because there is the same problem with OpenCL.
There is also the same problem on linux, unfortunally.
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Fragmentarium - an IDE for exploring 3D fractals and other systems on the GPU. Fragmentarium « 1 2 ... 8 9 » Syntopia 121 52130 Last post June 21, 2016, 11:27:30 PM
by Max Sinister
Mandelbox crossnavigation between Mandelbulber and Fragmentarium Help & Support Phlexonance 4 1661 Last post August 26, 2011, 01:34:01 AM
by A Noniem
having fun with fragmentarium Images Showcase (Rate My Fractal) ker2x 5 2385 Last post January 14, 2012, 12:26:39 PM
by ker2x
Formula directories problem Mandelbulb 3d chaos_crystal 5 1397 Last post November 01, 2013, 04:45:44 AM
by Nahee_Enterprises
[Solved] Fragmentarium hangs problem Fragmentarium Leonrott 9 3070 Last post October 30, 2013, 02:31:57 AM
by 3dickulus

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.186 seconds with 24 queries. (Pretty URLs adds 0.013s, 2q)