|
![](/i/fill.gif) |
Mac nous apporta ses lumieres en ce 06/10/2006 15:55:
> I have this code and need to make the ball look like raindrops playing with
> sor and iors:::
>
>
////////////////////////////////////////////////////////////////////////////////#include
> "colors.inc"
> #include "textures.inc"
> #include "glass.inc"
> #include "metals.inc"
> #include "golds.inc"
> #include "stones.inc"
> #include "woods.inc"
> #include "shapes.inc"
> #include "shapes2.inc"
> #include "functions.inc"
> #include "math.inc"
> #include "transforms.inc"
>
> #declare Camera_0 = camera {/*ultra_wide_angle*/ angle 75 // front view
> location <0.0 , 2.75 ,-3.0>
> right x*image_width/image_height
> look_at <0.0 , 2.75 , 0.0>}
> #declare Camera_1 = camera {ultra_wide_angle angle 90 // diagonal view
> location <2.0 , 2.5 ,-3.0>
> right x*image_width/image_height
> look_at <0.0 , 1.0 , 0.0>}
> #declare Camera_2 = camera {ultra_wide_angle angle 90 // right side view
> location <3.0 , 1.0 , 0.0>
> right x*image_width/image_height
> look_at <0.0 , 1.0 , 0.0>}
> #declare Camera_3 = camera {ultra_wide_angle angle 90 // top view
> location <0.0 , 3.0 ,-0.001>
> right x*image_width/image_height
> look_at <0.0 , 1.0 , 0.0>}
> camera{Camera_0}
>
> global_settings { assumed_gamma 1.0 }
> // sun
> light_source{<1500,2500,-2500> color White}
> // sky
> plane{<0,1,0>,1 hollow
> texture{ pigment{ bozo turbulence 0.76
> color_map { [0.5 rgb <0.20, 0.20, 1.0>]
> [0.6 rgb <1,1,1>]
> [1.0 rgb <0.5,0.5,0.5>]}
> }
> finish {ambient 1 diffuse 0} }
> scale 100000}
> // fog
> fog{fog_type 2.5
> distance 25
> color Navy/Blue
> fog_offset 0.10
> fog_alt 10.0
> color Gray
> turbulence 0.75}
>
> //plane
> plane { y, 0
> texture {
> pigment { rgbf <0.8, 0.4, 0.2> }
> normal {
> bumps .6
> scale <.75, .25, .25>
> rotate <0, 45, 0>
> }
> finish { caustics .10 }
> }
> }
>
> #declare Random_1 = seed (11153); // use: "rand(Random_1)"
> #declare Random_2 = seed (1553) ; // use: "rand(Random_2)"
>
> #declare Ball_1 =
> sphere{<0,0,0>,0.25 scale <1,1,1> rotate<0,0,0> translate<0,0,0>
> texture{pigment{color rgb<1,0.65,0>}
> finish {ambient 0.15 diffuse 0.85 phong 1}}}
>
> #declare Ball_1 =
> sphere {
> <0,.5,0>,.5
> translate <1.0,0,-1.3>
> material { M_Glass }
> interior { ior 1.5 }
>
> photons { // photon block for an object
> target 1.0
> refraction on
> reflection on
> }
> }
>
> #declare Ball_2 =
> sphere {
> <0,.2,0>, .2
> translate <1.0,0,-1.3>
> material { M_Glass }
> interior { ior 3.5 }
>
> photons {
> target 1.0
> refraction on
> reflection on
>
> }
> }
>
> union{
> #declare Nr = -10; // start
> #declare EndNr = 10; // end
> #while (Nr< EndNr+1)
>
> object{Ball_1 translate<Nr*0.5,0 + 8 * rand(Random_1) ,0>}
>
> object{Ball_2 translate<Nr*0.5,0 + 5 * rand(Random_2) ,0>}
>
> #declare Nr = Nr + 1;
> #end
>
> rotate<0,0,0>
> translate<0,0,4>} // end of union
>
> #declare ball = sor {
> 7,
> <0.000000, 0.000000>
> <0.13, 0.00>
> <0.62, 0.54>
> <0.21, 0.82>
> <0.19, 0.96>
> <0.28, 1.0>
> <0.46, 1.0>
> open
> }
>
>
>
>
>
>
>
>
>
>
>
Water's ior is 1.3333, or 4/3. 1.5 (for Ball_1) is OK for glass. Diamond's ior
is about 2.5 and is the largest for natural substances. The ior of 3.5 for
Ball_2 is prety extreem and un-natural!
Add some dispersion, it helps add realism.
If you want photons caustics, you need to add a photons block in the
global_settings.
--
Alain
-------------------------------------------------
Fighting for peace is like screwing for virginity.
- public toilet wall, The Bayou, Baton Rouge , LO
Post a reply to this message
|
![](/i/fill.gif) |