POV-Ray : Newsgroups : povray.binaries.images : Generating Good Skies : Re: Generating Good Skies Server Time
7 Aug 2024 15:17:33 EDT (-0400)
  Re: Generating Good Skies  
From: Abe
Date: 3 Feb 2006 15:30:00
Message: <web.43e3bada85aa7b8ffc69adc50@news.povray.org>
Mike Kost <con### [at] povraytashcorpnet> wrote:
> Sebastian H. wrote:
>
> > Mike Kost wrote:
> >> http://povray.tashcorp.net
> >
> > Your sky sphere tutorial is really helpful.
> > I'll try it out on the weekend. Good work.
> >
> > Sebastian
>
> Thanks - I'm glad it's helpful.
>
> I've started using a series of Python scripts to automate the whole process,
> so what I'm doing now has advanced beyond my tutorial. Something new to
> write-up when it settles down, I guess.
>
> Mike

How about letting POV do the work? I was able to do a reasonable facsimile
of the sampling process in POV sdl.

#declare Pigment_img=pigment{image_map{png "skygrad.png" interpolate 0}}

#declare Ximg_dim=48;
#declare Yimg_dim=270;

#declare Cmap_dim=30; //number of color map entries
#declare Xsamp=5;  //averageing horizontally across the image
#declare Sample_bias=2; //bias the number of samples towards the bottom (>1)
or top (<1) of the image


#macro GetColor(SampleP, GradientFunc)
 #local SamplePX=SampleP.x;
 #local SamplePY=SampleP.y;
 GradientFunc(SamplePX, SamplePY, 0)
#end

#declare SkyColorMap=
color_map{
  #declare i=0;
  #while (i<Cmap_dim)
   [pow(i/(Cmap_dim), Sample_bias)
     #declare j=0;

     #declare Color_vector=(
     #while (j<Xsamp) //loop to average over several horizontal samples
       #declare XSamplePoint=(.5+int(Ximg_dim*j/Xsamp))/Ximg_dim;
       #declare YSamplePoint=pow((.5+int(Yimg_dim*i/Cmap_dim))/Yimg_dim,
Sample_bias);

       +GetColor(<XSamplePoint, YSamplePoint>,
function{pigment{Pigment_img}})

       #declare j=j+1;
     #end
     )/Xsamp;

     color rgb Color_vector
     ]
   #declare i=i+1;
  #end
}

Abe


Post a reply to this message

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