Title: A vector running derivative for a multi-scaled box. Post by: eiffie on December 15, 2011, 06:34:59 PM After reading Syntopia's excellent post on using dual numbers to create a multi-scale box ...
http://www.fractalforums.com/new-theories-and-research/dual-numbers-for-creating-distance-estimators/ (http://www.fractalforums.com/new-theories-and-research/dual-numbers-for-creating-distance-estimators/) I decided to dust off an old script that used a vector derivative for doing same. (When dual numbers become standard types I will abandon this quest.) The idea is simple and I am sure others have tried it and I'm hoping they can explain it to me! I simply changed all the scalars to vectors so the code looks much the same (in glsl). Code: const vec3 minRadius=vec3(0.25,0.25,0.25); The code above "works" but it raises more questions. First what should the return value be for a signed and scaled sphere? Should dz really be initialized to vec3(1.0) or normalize(vec3(1.0))? I assumed if I rotate z I must also rotate dz. This isn't true and creates a worse estimate. Why? If we now have an idea of how the function is changing in each dimension can we use the ray march direction to look only at the change in the direction we are marching??? Has anyone tried this and can give their insight? Here's the output... http://www.youtube.com/watch?v=mmmRg-oVOoM Title: Re: A vector running derivative for a multi-scaled box. Post by: Syntopia on December 16, 2011, 05:11:19 PM Well, I'm surprised that works! Now, if only we could get to know why :-)
Quote I assumed if I rotate z I must also rotate dz. This isn't true and creates a worse estimate. Why? Your 'dz' vector doesn't seem to be directional - it is certainly not a gradient of length(z). If I use the normalized dz vector as color, it seems to point in the same directions at all points in the Mandelbox - only the length changes. Quote If we now have an idea of how the function is changing in each dimension can we use the ray march direction to look only at the change in the direction we are marching??? I've also thought about this. David Makin has some comments about why a four point method is beter than a two point directional method here: http://blog.hvidtfeldts.net/index.php/2011/09/distance-estimated-3d-fractals-v-the-mandelbulb-different-de-approximations/ Title: Re: A vector running derivative for a multi-scaled box. Post by: eiffie on December 16, 2011, 05:31:58 PM Good insite. It may only work because length(vec3(1.0)) is already greater than 1.0 so dividing by length(dz) at the end is just a big enough fudge factor. I definitely need to experiment with it more!
Title: Re: A vector running derivative for a multi-scaled box. Post by: eiffie on December 20, 2011, 04:48:23 PM In keeping with my origin "logic" :) of keeping a running derivative in each dimension seperately the return value should be: return length(z/dz); |