Logo by Pauldelbrot - 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: Support us via Flattr FLATTR Link
 
*
Welcome, Guest. Please login or register. April 20, 2024, 02:18:11 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 question about scales  (Read 964 times)
0 Members and 1 Guest are viewing this topic.
lapinot
Alien
***
Posts: 25


« on: May 13, 2015, 04:28:17 PM »

Hi all.

I have 2 separate questions regarding 'scale' and what it means.

1) The scale factor : I have heard people talk about 'scale' as of 'a scale xyz power w mandelbulb' etc... I don't know what it is and how to implement it. For example, here is my mandelbulb glsl code :

Code:
float DE (vec3 pos) {

vec3 z = pos;
float wr = length(pos);
float dr = 1.0;

float escape = FEscape;
float Power = FPower;
float Scale = 1.0;

for (int i = 0; i != FMaxIterations && wr < FEscape; i++) {

float wo = acos(pos.y / wr);
float wi = atan(pos.x, pos.z);
dr = pow(wr, Power - 1) * Power * dr + 1;

wr = pow(wr, Power);
wo = wo * Power;
wi = wi * Power;

pos.x = sin(wo) * sin(wi);
pos.y = cos(wo);
pos.z = sin(wo) * cos(wi);
pos = pos * wr;

pos = pos + z;
wr = length(pos) * Scale;
}

return min(2.0, 0.5 * log(wr) * wr / dr);
}

This code works as it should. How would I 'insert' a scale variable into the formula ?

2) General size of a fractal : the code above gives me a bulb roughly contained in a radius 2 sphere (I guess). How would I have it contained in a radius 2'000'000 sphere (for example) huh? The idea is : glsl float precision is so bad that I can barely go under the 10-6 barrier. with a 106 scaled bulb, I would have twice as much precision to play with.

Maybe a similar question has been asked already I dunno  embarrass  thx for any insight  afro
Logged
eiffie
Guest
« Reply #1 on: May 13, 2015, 05:41:24 PM »

Divide pos and dr by scale before they are used elsewhere and you are done.
Logged
lapinot
Alien
***
Posts: 25


« Reply #2 on: May 13, 2015, 05:44:48 PM »

Divide pos and dr by scale before they are used elsewhere and you are done.


Okay thx  grin

What about part #2 ?  Is it possible to embed the fractal in a larger sphere ?
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #3 on: May 13, 2015, 06:18:22 PM »

2) General size of a fractal : the code above gives me a bulb roughly contained in a radius 2 sphere (I guess). How would I have it contained in a radius 2'000'000 sphere (for example) huh? The idea is : glsl float precision is so bad that I can barely go under the 10-6 barrier. with a 106 scaled bulb, I would have twice as much precision to play with.

Maybe a similar question has been asked already I dunno  embarrass  thx for any insight  afro

just scale everything as you wish, but dont confuse number precision with scale, scaling up does not give any bit of precision extra, shifting the decimal point to the left for a fixed amount will not give you precision gain, precision problems occur when the needed diference of 2 numbers can not be expressed by the floating point, no matter if too big or too small ...
« Last Edit: May 15, 2015, 12:08:10 PM by cKleinhuis » Logged

---

divide and conquer - iterate and rule - chaos is No random!
lapinot
Alien
***
Posts: 25


« Reply #4 on: May 13, 2015, 07:07:04 PM »

I know I wont technically get 'more precision'. What I meant is : by starting with a fractal with radius i.e. 2'000'000 instead of 2, I can 'zoom in' twice as much.

Because glsl float precision is rougly 106 - 10-6. So I would definitely get twice the available zooming by 'starting big'. By the way I posted a pic in the B&W art contest session of this year that illustrate just that. At max zooming level my scene looks like it's composed of voxels. So as you said the dimensions become too small for GLSL to see any difference in values, because of float limitations hence the voxelized look.
Logged
eiffie
Guest
« Reply #5 on: May 14, 2015, 08:39:36 PM »

Christian is right but you probably have to try it before it sinks in what is going on.
Set the scale to 10^6 so the functions looks like...

float DE(vec3 pos){
  pos=pos/scale;
  dr=1.0/scale;
  ...continue with the normal function without any reference to scale.

Make sure you back the camera up a bit smiley like 2*10^6.

Now zoom in by halving the distance to the surface each frame (it will become pixelated again in as few frames as before!)
But we would love to be proved wrong, who doesn't want double the space.
Logged
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #6 on: May 15, 2015, 09:59:19 PM »

@ eiffie

Quote
......, who doesn't want double the space.

Me, I don't want double the space, i'm lost enough as it is! grin.  In this already infinite fractal universe
 
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
IFS Dragon Scales Images Showcase (Rate My Fractal) zeldabob888 1 1322 Last post November 11, 2006, 03:49:14 AM
by matera
Metallic scales Images Showcase (Rate My Fractal) Jimmie 1 766 Last post September 13, 2011, 07:25:55 AM
by surrealista1
Lizard Scales Images Showcase (Rate My Fractal) Pauldelbrot 0 857 Last post September 13, 2011, 04:20:43 AM
by Pauldelbrot
Chromatic scales Ultrafractal Jimmie 0 912 Last post October 18, 2012, 10:33:14 PM
by Jimmie
The Scales of Justice Images Showcase (Rate My Fractal) thom 0 668 Last post April 03, 2016, 06:23:19 AM
by thom

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.169 seconds with 24 queries. (Pretty URLs adds 0.011s, 2q)