POV-Ray : Newsgroups : povray.binaries.images : media plus spline density equals art? : media plus spline density equals art? Server Time
28 May 2024 11:02:22 EDT (-0400)
  media plus spline density equals art?  
From: Kenneth
Date: 23 Feb 2022 18:05:00
Message: <web.6216bbb13a34b3664cef624e6e066e29@news.povray.org>
While playing with my recent animated 'smoke column' and its media, I had the
wild idea of substituting a SPLINE into the media density (actually a function
of the spline, which is the only way I could get the idea to work.) I really had
no clear idea of what the result would be, as it was just an experiment. Maybe
I was expecting the media to 'follow' the spline, but that didn't happen.
Instead, the result looked like some kind of...art. I have since been trying to
figure out what the spline is actually doing to the media-- but the 'rules'
I've come up with so far seem counter-intuitive.

In any case, I was pleasantly surprised! The key is to use very few media
samples and its aa_level of 1, to get clear and obvious shapes or planes. And to
offset the camera when looking into the media box.

The spline's values are just my arbitrary choices (after a bit of
experimenting-- to eliminate other choices that produced uninteresting results.)
Change the rand 'seed' value to get a different look, or vary the camera
position.

This is one of those coding situations where the art-like results outweigh the
need to know what's actually going on 'under the hood'. It's more fun to simply
play around with various values and colors, then let POV-ray figure it out ;-)

------------
#declare SSS = seed(13);
#declare MY_SPLINE_FUNC =
function{
     spline{
          linear_spline // try natural_spline instead
          0.0, <5*rand(SSS),5*rand(SSS),5*rand(SSS)>
          0.25, <5*rand(SSS),5*rand(SSS),5*rand(SSS)>
          0.5, <5*rand(SSS),5*rand(SSS),5*rand(SSS)>
          2.0, <5*rand(SSS),5*rand(SSS),5*rand(SSS)>
                  }
}

camera {
perspective
location <2, .2, -3>
look_at <2, 1.3,  0>
right  x*image_width/image_height
angle 55
}

// main light
light_source {
0*x  color rgb 1
translate <20, 40, -10>
}

// fill light
light_source {
0*x
color rgb .15*<.6,.7,1>
translate <-100, 40, -30>
}

//  background
plane{z, 10
     pigment{
          gradient y
          color_map{
                [0 rgb <.7,.9,1>]
                [1 rgb .2*<.5,.6,1>]
                   }
                scale 15
                   }
inverse
}

// media container
box{0,<4,2,4> translate <-.5,0,-.5>
pigment{rgbt 1}
hollow
interior{
     media{
          scattering{1, 5.0*<.4,.6,1> extinction 1.8}
          method 3
          intervals 1
          samples 3
          aa_level 1
          density{
   function{MY_SPLINE_FUNC(x).x + MY_SPLINE_FUNC(y).y + MY_SPLINE_FUNC(z).z}
                 }
          }
        }
rotate 30*y
}


Post a reply to this message


Attachments:
Download 'media_spline_art_1.jpg' (54 KB)

Preview of image 'media_spline_art_1.jpg'
media_spline_art_1.jpg


 

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