POV-Ray : Newsgroups : povray.general : Help with macro(s) for simulating weather patterns : Re: Help with macro(s) for simulating weather patterns Server Time
29 Jul 2024 14:11:42 EDT (-0400)
  Re: Help with macro(s) for simulating weather patterns  
From: Alain
Date: 21 Apr 2012 15:04:22
Message: <4f9304b6@news.povray.org>

> Thanks very largely to the help I have received here (and thank you all _very_
> much for it), I have got stage one of the simulation into developement. The sim
> can be fed large scale images and convert them into a text file filled with
> numbers.
>
> Somewhere however, there is a bug in the coding which causes all the numbers in
> the generated file to be the same. :(
>
> Following is the snippet with all the relevant code. (Is code the right word?)
>
> I haven't had time to go through it and debug&  search the docs myself, I
> finished it in a hurry, and on top of that, I'm getting ready for return to
> studies, as well as possibly starting a new job. :(
>
> Regards
> D103
>
>

Your problem is that your image is still mapped from <0,0> to <1,1> and 
tilled to cover the whole plane.
As you iterate through your loop, you effectively sample the exact same 
point of your image every time.
If you add the "once" keyword, then all results would be zeros except 
for one.

2 possibilities:
1 - Scale your image and scan it in unit increments. Sample:
#declare ImgTraceObj = plane {
   -z, 0
   pigment {
     ColImg scale<Xres, Yres,1>
   }
}
OR
#declare ImgTraceObj = plane {
   -z, 0
   pigment {
     ColImg
   }
scale<Xres, Yres,1>}

As it's a plane (an infinite object) passing through the origin (point 
<0,0,0>), there is no differences between the two cases.

2 - Keep the image unchanged, but scan it in 1/Xres and 1/Yres increments.
Sample:
#declare TmpCol = eval_pigment(ColImg, <XCount/Xres, YCount/Yres, 0>);

For large images, this can introduce some location errors due to 
floating point rounding and presision errors.



Alain


Post a reply to this message

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