POV-Ray : Newsgroups : povray.binaries.images : Another SSS technique (28k jpg) : Re: Another SSS technique (28k jpg) Server Time
1 Aug 2024 16:23:42 EDT (-0400)
  Re: Another SSS technique (28k jpg)  
From: stbenge
Date: 12 Aug 2008 18:10:31
Message: <48a20a57@news.povray.org>
Blue Herring wrote:
> stbenge wrote:
>> Okay, here goes.
> 
> Thanks for the explanation, I'm not sure what you were worried about, 
> this is very clear and understandable :).  Very clever, this is already 
> making the gears turn in my head.  I'm quite curious about the nuts and 
> bolts of how you actually construct the 3d density pigment.  Any details 
> you are able to share would be most welcome.

You could view the source I posted in p.b.scene-files to see exactly how 
it was done, or you could look at the code below as an example. It uses 
the gradient pattern, and is clipped by a boxed pattern.

/* Begin Code */

// Renders colored static inside a cubic region 2x2x2 units large.
// There are 10x10x10=1000 'cells'

// a good test object
#declare obj=
union{
  plane{y,-.5}
  sphere{0,.5}
}

// number of cells
#declare incre=1/9;

// cleaner code is reusable code :)
// I should have done it this was for fast_prox.inc...
#macro grad(gDir)
  pigment_pattern{
   gradient gDir
   scale 2
   translate gDir
  }
#end

object{obj
  pigment{
   // wrapping them inside 'boxed' is a good way
   // to contain the infinitely-repeating gradients
   boxed
   pigment_map{
    [0 rgb 1]
    [1/256
     grad(z)
     pigment_map{
      #declare Z=0;
      #while(Z<=1)
       [Z
        grad(y)
        pigment_map{
         #declare Y=0;
         #while(Y<=1)
          [Y
           grad(x)
           pigment_map{
            #declare X=0;
            #while(X<=1)
             [X
              rgb<rand(R),rand(R),rand(R)>
             ]
             #declare X=X+incre;
            #end
           }
          ]
          #declare Y=Y+incre;
         #end
        }
       ]
       #declare Z=Z+incre;
      #end
     }
    ]
   }
  }
}

/* End Code */

Sam


Post a reply to this message

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