DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« on: February 05, 2015, 06:35:41 PM » |
|
|
|
« Last Edit: February 07, 2015, 10:58:53 AM by DarkBeam »
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
knighty
Fractal Iambus
Posts: 819
|
|
« Reply #1 on: February 05, 2015, 07:52:34 PM » |
|
Niiice!
|
|
|
Logged
|
|
|
|
eiffie
Guest
|
|
« Reply #2 on: February 05, 2015, 10:44:06 PM » |
|
Nice formula and render!
|
|
|
Logged
|
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #3 on: February 06, 2015, 12:41:37 AM » |
|
Oh I am very honored, masters of raytracing Thanks a lot! Just hoping I transcribed correctly, 2 days of fight to finally reveal it
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
cKleinhuis
|
|
« Reply #4 on: February 06, 2015, 12:51:54 AM » |
|
nice, tststs no shadertoy implementation? and beside, how does this de behave when hybridised with another de ? hehe
|
|
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #5 on: February 07, 2015, 10:55:58 AM » |
|
Forgot to tell ... 1. Formula is approximated! If thickness is big, some cuts will be shown, the trouble will be evident for big N values probably. 2. Hstep must be < 0
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
subblue
|
|
« Reply #6 on: February 17, 2015, 09:24:14 PM » |
|
Very interesting! Can you explain some of the terms of the algorithm, for instance how are split(.., .., ..), intpu, fracpu, intpz, fracpz defined?
|
|
|
Logged
|
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #7 on: February 17, 2015, 10:02:55 PM » |
|
Split should ... split a number into its int and fractional part: Split(5.844,a,b) -> a=5 and b=0.844 Please try to implement. I don't know if I copied right...
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
TruthSerum
Guest
|
|
« Reply #8 on: May 23, 2015, 10:17:07 PM » |
|
Here it is in GLSL: void split(float x, inout float a, inout float b) { a = floor(x); b = fract(x); }
float map(vec3 p) { float x=p.x, y=p.z, z=p.y; float u, v, h2, h3, n=8.0; float intpu, fracpu; float intpz, fracpz; float DE; float Thick=0.5, Position=0.5; float Hstep=-1.0, Wstep=1.0; float twopi = 6.28318530718; // valid for thickness << abs hstep, and hstep must be < 0 u = atan(y,x); v = sqrt(x*x+y*y); h2 = Hstep/2.0; h3 = n*Hstep; split(u * n / twopi,intpu,fracpu); u = fracpu *twopi/n; z = (z-intpu*Hstep); split(z/h3,intpz,fracpz); z = z-intpz*h3; DE = -u; if (u-h2 > -z) DE = z-h2; else if (u+h2 < -z) DE = z+h2; DE = abs(DE) - Thick; v = abs(v - Position); v = abs(v - Wstep); DE = max(DE,v); return DE; }
Here is how I tried (and failed) to trace it: float trace(vec3 o, vec3 r) { float t = 0.0; for (int i = 0; i < 64; ++i) { float d = map(o + r * t); if (abs(d)<3.5) break; t += d * 0.08; } return t; }
Very blocky results:
|
|
|
Logged
|
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #9 on: May 24, 2015, 11:15:31 AM » |
|
Thinking... Instead of floor and frac what if you use Void split(float x, inout float a, inout float b) { a = round(x); b = x-a; } Try also thickness 0.1 position 2.0 Formula isn't perfect for all combinations but should work normally. Thanks for trying
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
TruthSerum
Guest
|
|
« Reply #10 on: May 24, 2015, 01:47:26 PM » |
|
I tried it with these parameter changes, but I could not improve the result FYI GLSL has only floor/fract, but not round. I implemented: float round(float x) { return floor(x + 0.5); }
|
|
|
Logged
|
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #11 on: May 25, 2015, 12:08:56 AM » |
|
Too bad I cannot help further at this time. I am sorry.
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
|
TruthSerum
Guest
|
|
« Reply #13 on: May 26, 2015, 05:58:22 PM » |
|
Now to compute normals
|
|
|
Logged
|
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #14 on: May 27, 2015, 12:31:28 PM » |
|
The problem is I don't remember exactly all the details now and assembly uses some different funcs. So try to disassemble the m3f The mb3d function has perfect normals and all actually. (see 1st post)
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
|