Title: Boolean operation on a point (vector)? Post by: tryptophan on October 26, 2013, 10:44:43 PM I'm wondering if there is way to do an boolean intersection on a formula using the point position (vector) rather than the distance (float). Basically I would like to cut just a sphere out of a formula before the distance estimate is calculated.
thanks Keith Title: Re: Boolean operation on a point (vector)? Post by: DarkBeam on October 27, 2013, 10:35:07 AM I think you are mixing what cannot be mixed!
A "sphere" is defined by the distance of its surface because it is a "surface" (lol) How can you ever "subtract" this from a "formula"... and what you mean? :) Title: Re: Boolean operation on a point (vector)? Post by: tryptophan on October 27, 2013, 06:00:34 PM Yeah I thought I was approaching it from the wrong angle. Basically I have a formula that continues in all directions infinitely (I call it spherical) and after the distance estimate I am using a boolean intersection using a sphere to "cut" the infinitely repeating fractal so only a sphere of it is left. I am then mixing that DE with another. My problem is that because I am cutting the sphere after the orbit trap calculations it is coloring areas where the the fractal no longer exists (ie where the other formula exists).
I tried another approach where I used an if statement to test if the point was within a certain radius but I couldn't seem to get to work but I think that is the way I would have to do it? If it is is possible? cheers Keith Title: Re: Boolean operation on a point (vector)? Post by: ker2x on October 28, 2013, 08:44:07 AM I don't understand, you want to do CSG ? http://en.wikipedia.org/wiki/Constructive_solid_geometry
Title: Re: Boolean operation on a point (vector)? Post by: eiffie on October 28, 2013, 05:13:53 PM It sounds like you have to orbit trap both formulas then choose which trap to color with by testing which formula you hit.
Title: Re: Boolean operation on a point (vector)? Post by: tryptophan on October 28, 2013, 05:40:15 PM Thanks I am using an intersection now but I'm trying to figure out a way not to. Ah thanks Effie I was just typing my formula now. Here is the formula:
Code: par int ColorIterations 2 100 20 val This formula basically blends two formulas an infinitely repeating spherical formula and an IFS but in the line: Code: d = max(sdSphere(p2,sMoonSize),0.25*length(sP.xyz)/fat); What I would like to do is modify the "Spherical" formula so it stops at a certain radius rather than use a boolean. I've tried something like: Code: float dist = length(p); in the beginning of the "Spherical" iteration and it does work and does stop the formula from continuing beyond a set size but it doesn't draw properly. I'm not sure... Title: Re: Boolean operation on a point (vector)? Post by: tryptophan on October 28, 2013, 05:46:49 PM Now though because the boolean is done after the orbit test it will still color the IFS (with Spherical orbit traps) where the Spherical doesn't appear outside of the "globe" radius. It does work perfectly where the Spherical formula doesn't exist within the formula itself. I'll post some images.
Title: Re: Boolean operation on a point (vector)? Post by: tryptophan on October 28, 2013, 06:29:42 PM Sorry it wasn't working. So Eiffie I do have two orbit trap formulas but I'm not sure how to test which surface was hit in the renderer?
Title: Re: Boolean operation on a point (vector)? Post by: eiffie on October 28, 2013, 06:49:47 PM Here is what I do...
float d1=max(InfiniteFractalDE,SphereDE); float d2=OtherThingyDE; float mn=min(d1,d2); if(abs(mn-d1)<0.0001){//you hit the InfiniteFractal inside the sphere orbitTrap=InfiniteFractalOrbitTrap; }else orbitTrap=OtherThingiesOrbitTrap; I hope the technical jargon isn't too much :) Title: Re: Boolean operation on a point (vector)? Post by: tryptophan on October 28, 2013, 06:58:17 PM Sweet!!! I understand! Thanks Effie again for the amazing help.
cheers Keith Title: Re: Boolean operation on a point (vector)? Post by: cKleinhuis on October 28, 2013, 07:04:09 PM I was about to answer as well but it seems to be settled, i talked about basic de combinations in the tutorial4 of chaostube along with the axolotl script and a sweet smooth min function dont want to spam around so you gotta find it yourself i think it might be of help
Title: Re: Boolean operation on a point (vector)? Post by: tryptophan on October 28, 2013, 07:07:51 PM Thanks I'll check it out asap. For sure. |