POV-Ray : Newsgroups : povray.binaries.images : Snow macro test [~30k] : Re: Snow macro test [~30k] Server Time
1 Aug 2024 00:24:27 EDT (-0400)
  Re: Snow macro test [~30k]  
From: [GDS|Entropy]
Date: 18 Feb 2009 04:21:44
Message: <499bd328@news.povray.org>
"Thomas de Groot" <tDOTdegroot@interDOTnlANOTHERDOTnet> wrote in message 
news:499bcb5a@news.povray.org...
>
> This macro looks very promising indeed. Good work. I am looking forward to
> the final result. It would be an excellent contribution to the
> Object-Collection.
>

Well I hope it turns out well, I think that it will. :-D
It really started as a desire to place a 2d patch of grass everywhere but 
the space occupied by an object, then to cover a mountian with trees that 
stopped at the water level, and now it has kinda blown up from there. Hells, 
2 nights ago I didn't even know how to trace(), and the week before not even 
how to test within boundaries. This has mutated into an attempt to learn SDL 
hard and fast.

Even with icicles the macro parses in 1 second. I think I might have a bead 
on a solution to the bounding box estimation issue, which will allow my 
icicles to blob with the main snow coating and compress the separate icicle 
macro into the snow macro with only maybe 10 more lines of code...IF the 
estimation works..

There is an optimization that occurs to me while writing this, which would 
be to only place objects which are visible to the camera, ignoring those in 
places such as behind the object...but I'll save that for once the icicle 
dilemma has been satisfactorily resolved.

> It would be interesting to compare this with the already existing snow
> macros (Gilles Tran, Tim Nikias). The length of you code suggests 
> something
> far more compact tha either of those mentioned.

Feel free to compare them, the core of mine is about 28-29 lines in povray 
(ignore wordwrap in your reader, see below).
The vector array is just a random array of vectors, and if you were to use a 
min/max rand function based upon the bounding box of your object, you can 
decrease the number of failed tests.
Here is the core section of the snow macro, minus the icicles:

#macro 
snowTest(ctr,vectorArray,testVector,testObject,radVal,strVal,useInterior)
 #local vectorA = min_extent(testObject);
 #local vectorB = max_extent(testObject);
 blob {
 #local i=0;
 #while (i<ctr)
  #if (((vectorArray[i].x <= vectorB.x) & (vectorArray[i].x >= vectorA.x)) & 
((vectorArray[i].y <= vectorB.y) & (vectorArray[i].y >= vectorA.y)) & 
((vectorArray[i].z <= vectorB.z) & (vectorArray[i].z >= vectorA.z)))
   #if (inside(testObject,vectorArray[i]))
    sphere {
     trace (testObject,vectorArray[i],testVector), radVal, strVal
     texture {
      SnowTex0
     }
    }
   #end
  #end
 #set i=i+1;
 #end
 #if (useInterior)
  interior {
   fade_distance 2
   fade_power 3
   ior 1.45
   caustics 1.0
  }
 #end
 }
#end

I haven't seen either of their methods, but recognize Gilles artistic work 
as some of the best.

Note I have attached an image showing pseudo-bounding boxes which I am 
testing against, and a *partial* fix to the icicle problem. I still need to 
"shimmy" the icicles down and out a tad.
Here is the code for the diameter fluctuation of the icicles, btw: 
radVal+((cos(k)*atan(0.125*sqrt(abs(k))))-RRand(RsA, 0.25, 0.5))

Any ideas that you might have would be great.
In fact, a modification of the above core would combine really well with 
your moss texture....maybe give it a try?

ian


Post a reply to this message


Attachments:
Download 'snottySnownut.jpg' (42 KB)

Preview of image 'snottySnownut.jpg'
snottySnownut.jpg


 

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