POV-Ray : Newsgroups : povray.binaries.images : iso-sphere-sweep - second example Server Time
16 Aug 2024 22:18:13 EDT (-0400)
  iso-sphere-sweep - second example (Message 9 to 18 of 18)  
<<< Previous 8 Messages Goto Initial 10 Messages
From:
Subject: Re: iso-sphere-sweep - second example
Date: 7 Jan 2002 02:48:52
Message: <1jki3ukgeslbtpk84r1ua1hcn1gfc8q1q3@4ax.com>
On Sat, 05 Jan 2002 04:33:15 +0100, Tor Olav Kristensen <tor### [at] hotmailcom>
wrote:
> I could not spot any non-connected cylinder
> ends in that image, so I thought that maybe
> the source code below could be of interest
> for you.

Thank You.

> But maybe you have figured this out already...

Yes, Your method is similiar to one of those tested by me. I have tested
different modifications and optimizations to speed up rendering time.

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)&_((x+y)*.7,z,.1)&_((x+y+2)*.7,z,.1)&_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message

From:
Subject: Re: iso-sphere-sweep - second example
Date: 7 Jan 2002 02:53:01
Message: <3qki3uc1n7nupbvvab0uqosu7t8ip4af1a@4ax.com>
On Sun, 6 Jan 2002 14:52:05 -0600, "Batronyx" <bat### [at] alliancecablenet>
wrote:
> If you and Tor just put your heads together

Sorry, afaik my head is only as good as his neck. ;-)

ABX


Post a reply to this message

From:
Subject: Re: iso-sphere-sweep - second example
Date: 7 Jan 2002 03:23:13
Message: <hkmi3uohm1kvft1tc25933vhtrk74vfigs@4ax.com>
On Mon, 07 Jan 2002 03:30:11 +0100, Tor Olav Kristensen <tor### [at] hotmailcom>
wrote:

> But one thing that would be nice is if we had a utility
> for converting a POV iso-surface to a mesh.
> I have never looked into a problem of this kind before,
> so I don't know how difficult that would be.

http://www.cs.tut.fi/~warp/TesselationPatch/

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)&_((x+y)*.7,z,.1)&_((x+y+2)*.7,z,.1)&_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message

From:
Subject: Re: iso-sphere-sweep - second example
Date: 7 Jan 2002 03:25:24
Message: <bpmi3uop1dpvr2menm6nnngsvoj09f50ha@4ax.com>
On Sat, 05 Jan 2002 04:38:26 +0100, Tor Olav Kristensen <tor### [at] hotmailcom>
wrote:
> This might render faster because of the use of
> the internal sphere function

Yes, segments with internal sphere function render faster, I checked.

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)&_((x+y)*.7,z,.1)&_((x+y+2)*.7,z,.1)&_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message

From:
Subject: Re: iso-sphere-sweep - second example
Date: 7 Jan 2002 12:27:16
Message: <89mj3uc9iimul4952m7ld1tmr37lc8a24h@4ax.com>
On Sat, 05 Jan 2002 04:33:15 +0100, Tor Olav Kristensen <tor### [at] hotmailcom>
wrote:

> I thought that maybe
> the source code below could be of interest
> for you.

What do you think about below ?
I separated rounded endcaps into another function.

#macro f_sphere_sweep_linear_segment(A,B,R)
  #local D=(B-A)+0*x;
  #local T=transform{
    translate -A
    Reorient_Trans(vnormalize(D),y)
    scale <1,1/vlength(D),1>
  }
  #local O=-vtransform(0*x,T);
  #local Ox=O.x;
  #local Oy=O.y+.5;
  #local Oz=O.z;
  #local V=vtransform(x,T)+O;
  #local Xx=V.x;
  #local Xy=V.y;
  #local Xz=V.z;
  #local V=vtransform(y,T)+O;
  #local Yx=V.x;
  #local Yy=V.y;
  #local Yz=V.z;
  #local V=vtransform(z,T)+O;
  #local Zx=V.x;
  #local Zy=V.y;
  #local Zz=V.z;
  function{
    "test.txt"
    (abs(
      #if(Xy!=0) +Xy*x #end
      #if(Yy!=0) +Yy*y #end
      #if(Zy!=0) +Zy*z #end
      #if(Oy!=0) -Oy   #end
    )-.5)
    |
    f_sphere(
      #if(Xx!=0) +Xx*x #end
      #if(Yx!=0) +Yx*y #end
      #if(Zx!=0) +Zx*z #end
      #if(Ox!=0) -Ox   #end
      ,0,
      #if(Xz!=0) +Xz*x #end
      #if(Yz!=0) +Yz*y #end
      #if(Zz!=0) +Zz*z #end
      #if(Oz!=0) -Oz   #end
      ,
      R
    )
  }
#end

ABX


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: iso-sphere-sweep - second example
Date: 8 Jan 2002 19:21:44
Message: <3C3B8CAD.125BADB5@hotmail.com>

> 
> On Sat, 05 Jan 2002 04:33:15 +0100, Tor Olav Kristensen <tor### [at] hotmailcom>
> wrote:
> 
> > I thought that maybe
> > the source code below could be of interest
> > for you.
> 
> What do you think about below ?
> I separated rounded endcaps into another function.
> 
> #macro f_sphere_sweep_linear_segment(A,B,R)
>   #local D=(B-A)+0*x;
>   #local T=transform{
>     translate -A
>     Reorient_Trans(vnormalize(D),y)
>     scale <1,1/vlength(D),1>
>   }
>   #local O=-vtransform(0*x,T);
>   #local Ox=O.x;
>   #local Oy=O.y+.5;
>   #local Oz=O.z;
>   #local V=vtransform(x,T)+O;
>   #local Xx=V.x;
>   #local Xy=V.y;
>   #local Xz=V.z;
>   #local V=vtransform(y,T)+O;
>   #local Yx=V.x;
>   #local Yy=V.y;
>   #local Yz=V.z;
>   #local V=vtransform(z,T)+O;
>   #local Zx=V.x;
>   #local Zy=V.y;
>   #local Zz=V.z;
>   function{
>     "test.txt"
>     (abs(
>       #if(Xy!=0) +Xy*x #end
>       #if(Yy!=0) +Yy*y #end
>       #if(Zy!=0) +Zy*z #end
>       #if(Oy!=0) -Oy   #end
>     )-.5)
>     |
>     f_sphere(
>       #if(Xx!=0) +Xx*x #end
>       #if(Yx!=0) +Yx*y #end
>       #if(Zx!=0) +Zx*z #end
>       #if(Ox!=0) -Ox   #end
>       ,0,
>       #if(Xz!=0) +Xz*x #end
>       #if(Yz!=0) +Yz*y #end
>       #if(Zz!=0) +Zz*z #end
>       #if(Oz!=0) -Oz   #end
>       ,
>       R
>     )
>   }
> #end

It looks good.

Are all the ifs for speeding up the rendering in cases
where the line segments lies in planes parallel to either
the x, y, or z-planes ?

I'm not sure if I understand why you have decided to make
all the spheres for the joints in separate functions.

Is it because you are assembling it all "later on" with
the & operator ?


If you fetch my TransformFunction() macro from this thread:

"How to transform and blob together iso-shapes in v3.5"
(1. Oct. 2001 to povray.general)
http://news.povray.org/povray.general/18830/
news://news.povray.org/3BB8D35B.BB527254%40hotmail.com

and my ReorientMatrix() macro from this thread:

"Re: Rotations..." (7. Aug. 2001 to povray.general):
http://news.povray.org/povray.general/16859/108164/
news://news.povray.org/3B700B1D.3DF5ED5F%40hotmail.com

- then the code below will render a line segment with
rounded end caps (slightly faster than the code above).


#macro LineSegmentFunction(pA, pB, R)

  #local vD = pB - pA;
  #local lD = vlength(vD);

  TransformFunction(
    function {
      f_sphere(
        x,
        select(y, y, select(y - lD, 0, y - lD)),
        z,
        R
      )
    },
    transform {
      ReorientMatrix(y, vD)
      translate pA
    }
  )

#end // macro LineSegmentFunction


If there is anyone that wants an example that shows how
to use this code, then try this. (Just Remember to include
the functions.inc file to get access to the internal
f_sphere() function.)


#declare p0 = <-1, 0, -2>;
#declare p1 = <1, 1, 3>;
#declare R = 0.3;

//sphere { p0, R*1.4 pigment { color Yellow } }
//sphere { p1, R*1.4 pigment { color Green } }

//#declare SSA_Fn = f_sphere_sweep_linear_segment(p0, p1, R)
#declare SSB_Fn = LineSegmentFunction(p0, p1, R)

isosurface {
//  function { SSA_Fn(x, y, z) }
  function { SSB_Fn(x, y, z) }
  contained_by { sphere { <0, 0, 0>, 6 } }
  pigment { color White }
}

background { color rgb <0, 1, 2>/4 }

light_source { <1, 1, -1>*100, color rgb <1, 1, 1> }

camera {
  location <1, 1, -4>*2
  look_at <0, 0, 0>
}


Tor Olav


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: iso-sphere-sweep - second example
Date: 8 Jan 2002 19:49:23
Message: <3C3B9327.4956B625@hotmail.com>

> 
> On Mon, 07 Jan 2002 03:30:11 +0100, Tor Olav Kristensen <tor### [at] hotmailcom>
> wrote:
> 
> > But one thing that would be nice is if we had a utility
> > for converting a POV iso-surface to a mesh.
> > I have never looked into a problem of this kind before,
> > so I don't know how difficult that would be.
> 
> http://www.cs.tut.fi/~warp/TesselationPatch/

I had a quick look at it.

- And noticed that Warp actually can write
nice looking code also.

;)


Looks Interesting.
Hopefully somebody will soon scare away the bug within.


Tor Olav


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: iso-sphere-sweep - second example
Date: 8 Jan 2002 20:08:07
Message: <3C3B9789.3427C7BF@hotmail.com>
Batronyx wrote:
> 
> "Tor Olav Kristensen" <tor### [at] hotmailcom> wrote in message
> 
> > I am afraid that the images made with Softy 3d are meshes,
> > not iso-surfaces.
> 
> ... he says -- as if I didn't know.

Sorry. 

I have just had a second look at it. And now I noticed
something that I did not notice last time I looked:

All the shapes are made of spheres and a kind of sphere
sweeps, all blobbed together.

You may be right: Maybe something similar could be done
with POV-Ray's iso-surfaces. Now somebody have to find
a "blobbable" function of e.g. a cubic spline sphere
sweep (or something similar).


> The ability to vary the mesh resolution is
> nice too. Of course, that wasn't the point.
> 
> >
> > And doing some of the shapes shown at Softy 3D's gallery
> > page with iso-surfaces requires a LOT of thinking.
> 
> A utility would be helpful here. In fact, one just exactly like
> Softy3D with isosurface syntax output instead, would be useful. It's a shame
> that Softy3D costs so much.
> 
> That was the point: Softy3D results at POV prices. :)

How much does it cost ?


> > But one thing that would be nice is if we had a utility
> > for converting a POV iso-surface to a mesh.
> 
> They would certainly render faster as meshes. However, if you leave them as
> iso-surfaces, you can use displacement maps to make the finer details really
> stand out. It would take a lot of triangles to capture that level of detail.
> It's is the same song with a new verse: memory vs. speed.
> 
> > I have never looked into a problem of this kind before,
> > so I don't know how difficult that would be.
> 
> Warp has looked into it. As recently as Dec. 24, he favored the marching
> triangles algorithm. ("Re: isosurface -> mesh?" p.g)

Yes I have just looked at it.
It is a pity that there is a bug though.


> In the long run, I suppose you are right though; it probably really isn't worth
> the effort to duplicate Softy3D functionality. Sure there is the "Gee whiz"
> factor, but how practical is it?
> It was just an idea.

But Softy3D is not scriptable, is it ?

Maybe some (like me) prefer a text interface to modelling.

That would be a good enough reason to implement something
like this with POV-macros.


Tor Olav


Post a reply to this message

From: Hugo
Subject: Re: iso-sphere-sweep - second example
Date: 9 Jan 2002 08:27:48
Message: <3c3c4554$1@news.povray.org>
I downloaded Warps tesselation patch (btw, I wonder if Warp is on
vacation?)... Ehm, this is for MegaPOV 0.6a and written in C... Not useable
without a compiler, or with Pov3.5... Is the results any better than the
tesselation macros written in SDK in year 2000  ... if you remember?  Except
speed, probably.

Btw, is there a "marching cubes" algoritm available in SDK?  Or a "delauney
triangulation" algoritm... For my personal use.


Tor Olav wrote:
> Maybe some (like me) prefer a text interface to modelling.

I do... :o)


Hugo


Post a reply to this message

From: Batronyx
Subject: Re: iso-sphere-sweep - second example
Date: 9 Jan 2002 22:51:22
Message: <3c3d0fba@news.povray.org>
"Tor Olav Kristensen" <tor### [at] hotmailcom> wrote in message
news:3C3B9789.3427C7BF@hotmail.com...
>
> Batronyx wrote:
> >
> > "Tor Olav Kristensen" <tor### [at] hotmailcom> wrote in message
> >
> > > I am afraid that the images made with Softy 3d are meshes,
> > > not iso-surfaces.
> >
> > ... he says -- as if I didn't know.
>
> Sorry.

Just razzin' ya! :)

> I have just had a second look at it. And now I noticed
> something that I did not notice last time I looked:
>
> All the shapes are made of spheres and a kind of sphere
> sweeps, all blobbed together.
>
> You may be right: Maybe something similar could be done
> with POV-Ray's iso-surfaces. Now somebody have to find
> a "blobbable" function of e.g. a cubic spline sphere
> sweep (or something similar).

Which is the direction, I thought you and ABX were heading.

> >
> > That was the point: Softy3D results at POV prices. :)
>
> How much does it cost ?

Last time I looked, ( this is from memory; accuracy not guaranteed) about 49 EU
or 75 USD

>
> But Softy3D is not scriptable, is it ?
[snip]
> Maybe some (like me) prefer a text interface to modelling.

No it isn't scriptable, so the utility would just be a way to get a good start.
I find modeling utilities convenient to start with, and fine tune things later
with the text interface. Particularly for meshes, pathces, and splines. Oddly
enough, I don't use them for scene layout though, just specific objects.

> > It was just an idea.

> That would be a good enough reason to implement something
> like this with POV-macros.

Kind of like the idea I'm about to post. Maybe some will find it useful.


--
light_source{0,1}#macro c(J,a)sphere{0,1pigment{rgb z}scale a translate J+O}
#end#macro B(R,V,O)c(0,4)intersection{c(V,R)difference{c(-z*4x+10)c(-z*4.1x+
10)c(0<7.5,45,5>)}}#end B(12,0z*25)B(8y*4<0,12,50>)          // Batronyx ^"^


Post a reply to this message

<<< Previous 8 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.