POV-Ray : Newsgroups : povray.binaries.images : Sphere_sweep: gradient along a curve. : Re: Sphere_sweep: gradient along a curve. Server Time
30 Jul 2024 00:24:12 EDT (-0400)
  Re: Sphere_sweep: gradient along a curve.  
From: Robert McGregor
Date: 14 Feb 2014 17:25:01
Message: <web.52fe96b9a5ee4db891114470@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> Your experiments are the best hair simulations I have seen so far. One
> way or another, it would be worthwhile to see if this could be used for
> Poser Hair exports through Poseray: If the /lines/ there could be
> exported as splines, sphere_sweeps would be an easy matter. Hmm, would
> need also an automatic sphere_sweep builder for so many hairs... ;-)
>
> I believe that render speed is not really an issue if the final result
> is astounding.

Thank you sir! Inspired by your suggestion to try this with Poser dynamic hair,
I exported a quick hair test from Poser 8 to OBJ and wrote a little program to
parse the hair guide vertices into multidimensional SDL arrays suitable for use
with sphere_sweeps and spline sweeps.

Here's a quick test of just the hair guides themselves. The Poser model had
three hair groups: HairLEFT (red), HairRIGHT (blue), and HairFRONT (green).
Currently each group is split into a separate include file, with data written
as:

// Group 0: HairLEFT, 59 hair guides, 30 nodes each:
#declare ncGuides = 59;
#declare ncNodes  = 30;
#declare aVec     = array[ncGuides][ncNodes];

#declare aVec[0][0] = <0.0327691 ,0.513711, -0.0512924>*SCALE;
#declare aVec[0][1] = <0.0327671 ,0.519569, -0.0500553>*SCALE;
#declare aVec[0][2] = <0.0327291 ,0.525429, -0.0488221>*SCALE;
#declare aVec[0][3] = <0.0319841 ,0.531257, -0.0476847>*SCALE;
// . . .
#declare aVec[0][27] = <0.00653295 ,0.658367, -0.0168579>*SCALE;
#declare aVec[0][28] = <0.00346087 ,0.658094, -0.0117261>*SCALE;
#declare aVec[0][29] = <0.000394785 ,0.657737, -0.00659484>*SCALE;

Using this array structure it's easy to loop through the sweeps:

   #include "HairStrands1.inc"
   #local j=0;
   #while (j<ncGuides)
      sphere_sweep {
         cubic_spline
         ncNodes,
         #local i=0;
         #while(i<ncNodes)
            aVec[j][i], Interpolate(i+1/ncNodes,0,1,Rad_Tip,Rad_Base,1)
            #local i=i+1;
         #end
         texture { ... }
      }
      #local j=j+1;
   #end

All that remains now is to interpolate between these and see if I can get a nice
head of hair...
-------------------------------------------------
www.McGregorFineArt.com


Post a reply to this message


Attachments:
Download 'poserhairguidestospheresweeps.jpg' (283 KB)

Preview of image 'poserhairguidestospheresweeps.jpg'
poserhairguidestospheresweeps.jpg


 

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