POV-Ray : Newsgroups : povray.binaries.images : media plus spline density equals art? Server Time
5 Nov 2024 22:22:03 EST (-0500)
  media plus spline density equals art? (Message 1 to 8 of 8)  
From: Kenneth
Subject: media plus spline density equals art?
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


 

From: Bald Eagle
Subject: Re: media plus spline density equals art?
Date: 23 Feb 2022 19:00:00
Message: <web.6216c9b64d044a471f9dae3025979125@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
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.

I'd say that what you're doing is making a series of concentric cube-shaped
shells that are colored by the value of the function and the pigment map.

I'll bet if you move the camera around - perhaps animate it - that will become
obvious.


Post a reply to this message

From: Thomas de Groot
Subject: Re: media plus spline density equals art?
Date: 24 Feb 2022 02:22:45
Message: <62173245$1@news.povray.org>
Op 24/02/2022 om 00:03 schreef Kenneth:
> 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 ;-)
> 

Yes, absolutely. If you blockchain this image (properly scaled up to 
room size of course) you will become a millionaire in no time! ;-)

Fun playing around like this isn't it?  I don't do this often enough...

-- 
Thomas


Post a reply to this message

From: William F Pokorny
Subject: Re: media plus spline density equals art?
Date: 24 Feb 2022 08:36:57
Message: <621789f9$1@news.povray.org>
On 2/23/22 18:03, Kenneth wrote:
> 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 ;-)

I'm a fan of geometric images and quite like yours. I too just try 
things to see what happens :-).

---
That said, forgive me for using your scene as a lesson in how the 
POV-Ray pattern mechanisms work. Magic is fine until it acts against 
what you want to do.

What you are seeing is the default wave modification code acting on the 
function values - before being using in a default map.

In the attached MediaPlusSplineLessons.jpg image:

The top row uses POV-Ray's default 0-1 pattern value clamping and wave 
modification (ramp_wave et al) strategy. This why you see what you see.

The middle row is the povr branch's new function_interval (-1 to 1) 
pattern value clamping and wave modification (ramp_wave et al) strategy.

The bottom row makes use of povr's raw_wave which just passes the 
density { function{} } value around the pattern and wave modification 
code and into the map code.

All three are using default density_map / color_maps of:

density_map {
     [0 rgb 0]
     [1 rgb 1]
}

In the middle and bottom rows using function_interval and raw_interval 
this default map itself causes some clamping to 0 and 1. This the third 
yellow value where shown. In all cases with yellow text the right most 
value is the density{} 'color' value passed back to media{} where the 
default map is used.

---
Column 1 is your original function {spline{}}.
Column 2 modified the spline to return +-values centered around 0.0.
Column 3 uses a function always returning +0.5.
Column 4 uses a function always returning -1.5.
Column 5 uses a function always returning +1.5.

---

For column two if I use:

         raw_wave
         density_map {
             [-13 rgb <+0.1,+0.1,+1.0>]
             [+13 rgb <+0.1,+1.0,+0.1>]
         }
         }

I get the attached MediaPlusSpineLessonAltMap.png image.

Bill P.


Post a reply to this message


Attachments:
Download 'mediaplusspinelessonaltmap.png' (59 KB) Download 'mediaplussplinelessons.jpg' (87 KB)

Preview of image 'mediaplusspinelessonaltmap.png'
mediaplusspinelessonaltmap.png

Preview of image 'mediaplussplinelessons.jpg'
mediaplussplinelessons.jpg


 

From: Kenneth
Subject: Re: media plus spline density equals art?
Date: 26 Feb 2022 22:20:00
Message: <web.621ae9c14d044a474cef624e6e066e29@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:
>
> ...forgive me for using your scene as a lesson in how the
> POV-Ray pattern mechanisms work. Magic is fine until it acts against
> what you want to do.

Ha! Yes, certain values for the spline produce completely bland media. I have
since been trying to 'tease-out' an understanding of the spline's behavior, to
get *somewhat* more expected results.

>
> What you are seeing is the default wave modification code acting on the
> function values - before being using in a default map....
> [snip]

Thanks for the analysis. I'm not sure I understand the fine points yet, but as I
do more tests, things are becoming a bit clearer. And I completely forgot about
using my own color_map for the media; that adds even more 'art-like'
possibilities!

Yes, I finally started to realize that the color gradations and repetitions I
was seeing were due to a default 'ramp wave' behavior. As an experiment, I tried
triangle_wave and sine_wave instead (in the media density)-- which produce
additional interesting effects.

Meanwhile in official POV-ray, I have come up with at least two visually-based
'explanations' (rules?) about the spline/media interactions, that I am 99% sure
about:

1) The spline's index values correspond to the position and extent of 'blocks'
or 3-D cubes of media behavior-- with the blocks' patterns based in some way on
the vector values at those indices. I am still not sure *how* the vector values
are being interpreted though.

2) As the individual vector values go past 1.0, they start to produce what looks
like an increasing 'frequency' of the ramp wave behavior. This is sort of like
what Bald Eagle mentioned as being 'concentric shells'.

I am curious to know if this 'fits in' with your own analysis.

For the attached image examples-- and using an orthographic camera-- I modified
some of the scene values to produce a clearer understanding of what's going on.
The first image uses my original 3-D spline values; the second is a different
2-D variation.

(BTW, I also ran a moving-camera animation of my original scene; I might post
that to p.b.animations, just as an interesting if odd visual experiment.)


Post a reply to this message


Attachments:
Download 'media_spline_art_2_orthographic.jpg' (164 KB)

Preview of image 'media_spline_art_2_orthographic.jpg'
media_spline_art_2_orthographic.jpg


 

From: William F Pokorny
Subject: Re: media plus spline density equals art?
Date: 27 Feb 2022 04:21:37
Message: <621b42a1$1@news.povray.org>
On 2/26/22 22:18, Kenneth wrote:
> William F Pokorny <ano### [at] anonymousorg> wrote:
>>
>> ...forgive me for using your scene as a lesson in how the
>> POV-Ray pattern mechanisms work. Magic is fine until it acts against
>> what you want to do.
> 
> Ha! Yes, certain values for the spline produce completely bland media. I have
> since been trying to 'tease-out' an understanding of the spline's behavior, to
> get *somewhat* more expected results.
> 
>>
>> What you are seeing is the default wave modification code acting on the
>> function values - before being using in a default map....
>> [snip]
> 
> Thanks for the analysis. I'm not sure I understand the fine points yet, but as I
> do more tests, things are becoming a bit clearer. And I completely forgot about
> using my own color_map for the media; that adds even more 'art-like'
> possibilities!
> 
> Yes, I finally started to realize that the color gradations and repetitions I
> was seeing were due to a default 'ramp wave' behavior. As an experiment, I tried
> triangle_wave and sine_wave instead (in the media density)-- which produce
> additional interesting effects.
> 
> Meanwhile in official POV-ray, I have come up with at least two visually-based
> 'explanations' (rules?) about the spline/media interactions, that I am 99% sure
> about:
> 
> 1) The spline's index values correspond to the position and extent of 'blocks'
> or 3-D cubes of media behavior-- with the blocks' patterns based in some way on
> the vector values at those indices. I am still not sure *how* the vector values
> are being interpreted though.
> 
> 2) As the individual vector values go past 1.0, they start to produce what looks
> like an increasing 'frequency' of the ramp wave behavior. This is sort of like
> what Bald Eagle mentioned as being 'concentric shells'.
> 
> I am curious to know if this 'fits in' with your own analysis.
> 
> For the attached image examples-- and using an orthographic camera-- I modified
> some of the scene values to produce a clearer understanding of what's going on.
> The first image uses my original 3-D spline values; the second is a different
> 2-D variation.
> 
> (BTW, I also ran a moving-camera animation of my original scene; I might post
> that to p.b.animations, just as an interesting if odd visual experiment.)
> 

I'm interested in seeing the animation.

I like too your images. You dug much deeper into what the actual values 
back from the function (spline) were in relation to image than did I. I 
thought only about the rough ranges of values.

Rules look good to me(1).

Bill P.

(1) - Lesser quirks and detail to be had - especially in the official 
POV-Ray code - but another day...


Post a reply to this message

From: jr
Subject: Re: media plus spline density equals art?
Date: 27 Feb 2022 05:40:00
Message: <web.621b54524d044a47ed36e5cb6cde94f1@news.povray.org>
hi,

"Kenneth" <kdw### [at] gmailcom> wrote:
> ...
> Instead, the result looked like some kind of...art. ...

I completely missed the image (not shown in Quick Overview page), my eyes must
have glazed over when I saw the code.  :-)

art, yes.  a fine abstract.


regards, jr.


Post a reply to this message

From: Kenneth
Subject: Re: media plus spline density equals art?
Date: 27 Feb 2022 10:30:00
Message: <web.621b98d84d044a474cef624e6e066e29@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
>
> I completely missed the image (not shown in Quick Overview page), my eyes must
> have glazed over when I saw the code.  :-)
>
> art, yes.  a fine abstract.
>

Thanks. Here's another view, of the entire media box and using my
originally-posted code-- with two different media samples.

Due to the color of the media and that of the two light_sources, the 2nd image
reminds me of translucent rubber-- like a big pencil-mark eraser ;-) It also
shows a better 3-D view of the strangely-interacting spline values. The lights'
shadows within the media add a lot to the effect.


Post a reply to this message


Attachments:
Download 'media_spline_art_3.jpg' (73 KB)

Preview of image 'media_spline_art_3.jpg'
media_spline_art_3.jpg


 

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