POV-Ray : Newsgroups : povray.newusers : New User Question about Variable Density Fog : Re: New User Question about Variable Density Fog Server Time
2 Jul 2024 11:32:12 EDT (-0400)
  Re: New User Question about Variable Density Fog  
From: waggy
Date: 16 Apr 2011 18:00:00
Message: <web.4daa11278c9a2319726a3c10@news.povray.org>
> > Though it is painfully slow, a merge of a grid of boxes, each with its own ior,
> > does seem to work as expected.
>
> Sounds good.  How would you tie the file data to the box grid? Can you post your
> test code?  Variable ior would be really good, but I can live with variable
> scatter. :)
>
I always try to have my code output a valid POV-Ray include file, and sometimes
an entire scene file.  I've also used stand shell tools (grep,sed,awk) to
transform data similarly.  That said, POV-Ray can read something like a .csv
without too much trouble, just be sure to end each row with a comma.

My quick test POV-Ray scene (below) just uses an image for the IOR data.  [Note
I inverted the role of the source PNG's transmit component in the merged boxes
so it makes a sort of weird-lens-in-a-frame kind of thing.]

//----------------------------------
#version 3.7;

#include "stdinc.inc"

#declare pig_image =
pigment {
 image_map {
  png "povray_64.png"
  once
  }
}

box{<0,0,0>,<1,1,1>
pigment{pig_image}
}

#local image_width  = 64;
#local image_height = 64;

merge{
#local j=0.5;
#while(j<image_height)
   #local i=0.5;
   #while(i<image_width)
      #local image_color = eval_pigment(pig_image,
         <i/image_width,j/image_height,0.5>) ;
      box{<0,0,0>,<1,1,1>
         pigment{ Clear*(1-image_color.transmit)
                +Yellow*   image_color.transmit}
         interior{ ior 1+image_color.gray}
         scale 1.001 // Prevent coincident surfaces.
         translate <i,j,0>
      }
      #local i=i+1;
   #end
#local j=j+1;
#end

translate -0.5*<image_width,image_height,0>
scale <0.06,0.06,1>
translate -5*z
}//end union

plane{y,-2 pigment{checker Blue Gray50}}
sphere{0,100 pigment{color White} }
light_source{<-50,50,-50> color 1}
camera{location -10*z}
//----------------------------------


Post a reply to this message

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