POV-Ray : Newsgroups : povray.text.scene-files : Snow macro WIP code Server Time
23 Dec 2024 10:43:50 EST (-0500)
  Snow macro WIP code (Message 1 to 4 of 4)  
From: Christoph Hormann
Subject: Snow macro WIP code
Date: 28 Nov 2000 12:32:24
Message: <3A23EC29.85B864CA@gmx.de>
This is the code for my Snow image posted in p.b.i. It's *very* WIP so
not  flexible and universal at all.

You will need a font file and a heightfield to render it as posted, the
macro should also work with other objects.

Christoph

//  BEGIN POV code
//   
//  Snow macro WIP
//  
//  Christoph Hormann (28. Nov. 2000)
//  chr### [at] gmxde   
//  http://www.schunter.etc.tu-bs.de/~chris/

#version unofficial MegaPov 0.6; 
   
#include "colors.inc"        
    
camera {                            
  location    <8.0, -8.0, 5.0>*2  
  direction   z
  sky         z  
  up          z  
  right       1.33333*x                  
  look_at     <0.0, 0.0, 0.0>  
  angle       38
}

  
light_source {   
  <20, -40, 28>
  color rgb 1.4
}   
  
#declare T_Snow_01=  
texture {
  pigment { color White }
  finish { 
    ambient 0.1
    diffuse 0.7
    brilliance 0.8
    specular 0.4 
    roughness 0.02
  }
  normal {
    granite 0.2
    scale 0.3
  }
}


#macro Snow_02 (Object, Step, StartP, EndP)

  blob {
   threshold 0.6  
   
   #local Cnt_X = StartP.x;
   
   #while (Cnt_X <= EndP.x)  
     
     #local Cnt_Y = StartP.y;
     #while (Cnt_Y <= EndP.y)    
       
       #local Norm = <0, 0, 0>;              
       #local Pos = trace ( Object, <Cnt_X, Cnt_Y, 1000>, <0, 0, -1>, Norm
); 
       
       #local Pos = <Pos.x, Pos.y, Pos.z + Step>; 
       
       #if ((Norm.x != 0) | (Norm.y != 0) | (Norm.z != 0))
         sphere { Pos, Step*3, 1 }   
       #end
        
       #local Cnt_Y = Cnt_Y + Step;
     #end
     
     #local Cnt_X = Cnt_X + Step;
   #end 
   
   texture {
     T_Snow_01
   }
  }
     
#end  

   
#declare Tx1=   
texture {   
     pigment {   
       color rgb <0.9, 0.72, 0.5> 
     } 
     finish { diffuse 0.65 ambient 0.1 }    
}        
        
#declare Part_1=
union {
  cylinder { < 0, 0, 0>,   < 0, 0, 2.0>, 0.2 }     
  sphere { < 0, 0, 0> 1 
    scale <1,1,0.2>
    translate 1*z
  } 
  
  sphere { < 0, 0, 2.0>, 0.4 }   
}


#declare Obj_X=
union { 
  superellipsoid { 
    <0.7, 0.1> 
    translate <4.0, -3.0, 0.0>
  } 
  
  union {
  
    box { <-2, -0.3, 1>, < 2, 0.3, 1.4> }   
    box { <-2, -0.3, 0>, <-1.6, 0.3, 1.2> }
    box { <1.6, -0.3, 0>, < 2, 0.3, 1.2> } 
    
    scale 1.3
    translate <4.0, -3.0, 0.0>
  }
  
  cylinder { <-2.5, -2, 0.5>,   < 5, -7, 0.0>, 0.3 }     
  
  cylinder { <-3.5, -6, 0.0>,   < 6, -8, 0.0>, 0.5 } 

  box { <-2, -2, 0>, < 2, 2, -1.2> translate <-2.5, -1.5, 0.0> }
  box { <-0.4, -0.4, 0>, < 0.4, 0.4, 0.5> translate <-3.0, 2.0, 0.0> }
  
  object { 
    text { 
      ttf 
      "f:\winnt\fonts\bgothm.ttf" 
      "SNOW"           
      0.2, 0  
    }
    scale 3.6
    rotate 90*x
    translate <-2.85, 1.6, 0.2>   
  }    
  
  object { Part_1 scale 1.3 translate <-2.5, -2, 0.0> }
  
  object { Part_1 scale 1.5 translate <0.5, 4, 0.2> }
  
  torus
  {
    1.3,
    0.3 
    rotate 90*x
    scale <2.3, 2.3, 1>  
    
    translate <6.5, -2.6, 0.08> 
  }   
  
  
  torus
  {
    1.5,
    0.3 
    scale <1, 3, 1>  
    
    translate <9.4, -2.6, 0.1> 
  }  
       
  texture { Tx1 }     
  
  translate <-2.0, 0.0, 0.0> 
}       
     
  
#declare Obj_Y=
object {
   height_field {
     png "G:\RAY\maps\Fantasy1.png"  
     water_level 0.0
     smooth
   }                                 
   rotate    <-90, 0, 0 >      
        
   scale     <  2, 2, -0.1 > 
   translate < -1,-1, 0 >   
   scale 22         
   translate <  0, 0, -1.9 >  
   rotate 45*z  
   
   texture { 
     object { box {<-22, -12, -10>, <12, 22, 10>}   
       texture { T_Snow_01 } 
       texture { Tx1 }      
     } 
   }   
} 
         
         
object { Obj_X }     
object { Obj_Y }     

Snow_02 (
  union { 
   object { Obj_Y }
   object { Obj_X }   
  }, 0.15, <-22, -12, 0>, <12, 22, 0>
)         
     
//  END POV code


Post a reply to this message

From: Defective
Subject: Re: Snow macro WIP code
Date: 28 Nov 2000 14:29:57
Message: <t0v72t0quk2t6n1eeein0ug7duhllh1hmj@4ax.com>
On Tue, 28 Nov 2000 18:32:25 +0100, Christoph Hormann
<chr### [at] gmxde> blathered:

>
>This is the code for my Snow image posted in p.b.i. It's *very* WIP so
>not  flexible and universal at all.
>
>You will need a font file and a heightfield to render it as posted, the
>macro should also work with other objects.
>
>Christoph
>

>>> code snipped <<<

Christoph,

How about a clear description of what the 3 arguments to your macro
do?



Defective O-O

http://members.home.com/redundant/Defective/
(yes, I know that's the wrong membername...ran out of space at
http://members.home.com/defective/)


Post a reply to this message

From: Christoph Hormann
Subject: Re: Snow macro WIP code
Date: 28 Nov 2000 15:16:42
Message: <3A2412A4.19806004@gmx.de>
Defective wrote:
> 
> Christoph,
> 
> How about a clear description of what the 3 arguments to your macro
> do?
> 

Oh come on, it isn't really that difficult:

Snow_02 (Object, Step, StartP, EndP)

Object       - The object the snow is fallen on
Step         - The distance between the 'traces'
StartP, EndP - Points of the box the snow is simulated in

But remember this is not meant to be ready for use.

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Defective
Subject: Re: Snow macro WIP code
Date: 29 Nov 2000 00:47:43
Message: <ns592tkgd4aqvifmt3g2r9ejbjj4tfcv8q@4ax.com>
On Tue, 28 Nov 2000 21:16:36 +0100, Christoph Hormann
<chr### [at] gmxde> blathered:

>
>Oh come on, it isn't really that difficult:

Be gentle with me...was experimenting with it with my first coffee of
the day.

>
>Snow_02 (Object, Step, StartP, EndP)
>
>Object       - The object the snow is fallen on
>Step         - The distance between the 'traces'
>StartP, EndP - Points of the box the snow is simulated in

OK...  explains why it acted so odd on my test render...

>
>But remember this is not meant to be ready for use.

But has much potential...



Defective O-O

http://members.home.com/redundant/Defective/
(yes, I know that's the wrong membername...ran out of space at
http://members.home.com/defective/)


Post a reply to this message

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