POV-Ray : Newsgroups : povray.newusers : How do I add color to "sphere_sweep"? : Re: How do I add color to "sphere_sweep"? Server Time
6 Oct 2024 02:09:40 EDT (-0400)
  Re: How do I add color to "sphere_sweep"?  
From: Mike Williams
Date: 12 Aug 2009 06:42:44
Message: <IDs45ZEaypgKFwCp@econym.demon.co.uk>
Wasn't it Alex who wrote:
>* In the documentation, I cannot really find any info on the first
>parameter of the spline function (-.25, 0.00, etc.). What does is do?
>With sphere_sweep I don't need to define these values...

You do if you're using cubic_spline mode of sphere_sweep.

A cubic spline can only be calculated between the second and
next-to-last of the control points, so a phantom point needs to be added
at each end.

If you really don't have such extra points in your sphere_sweep, then I
guess that means that you're using linear_spline mode. In that case
using cones and cylinders, with spheres at the nodes for neat joins, is
more efficient than hundreds of spheres.

>* I am also worried about efficiency, as I am modelling many objects of
>this kind: let's say 10000 "hyperstreamtubes" (a sphere_sweep object
>with variable width), with each these consisting of 100 points. Here
>you can see an example: http://www.exploredti.com/gallery/gof_2.htm

Sphere_sweeps are inherently not very efficient, because the algorithm
is quite complicated. You may well find that lots of simpler objects
render faster. Lots of simpler objects will bound better when you have
long strings like in that example.

However, lots of simple objects will always give you rounded edges. If
you want spiky edges like in that example, you might consider something
like the SweepSpline macro

See the bottom section of http://www.econym.demon.co.uk/isotut/more.htm

SweepSpline produces a mesh2 object which renders very quickly, but if
you've got lots of detail it may take a while to parse. You can save the
parsed mesh2 object to a file (see comments at the top of
sweepspline.inc) and skip the parse phase next time.

To colour a sweepspline along its length, use uv_mapping, like this:

object {
  SweepSpline(USpline, VSpline, WSpline, Upoints, Vpoints, Filename)
  texture {
    pigment { uv_mapping
      function{u}
      colour_map {...}
    }
  }
}

where the colour_map specifies the colours to be used along the length.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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