POV-Ray : Newsgroups : povray.newusers : Media woes Server Time
23 Feb 2025 18:39:56 EST (-0500)
  Media woes (Message 1 to 5 of 5)  
From: Bald Eagle
Subject: Media woes
Date: 19 Feb 2025 18:30:00
Message: <web.67b66943b239df5d1f9dae3025979125@news.povray.org>
Can someone tell me why this virtually identical scene to that in the docs
doesn't show the 2 media spheres?

#version 3.8;
global_settings {assumed_gamma 1.0 }

camera {
 location <0, 10, -20>
 right x*image_width/image_height
 up y
 look_at <0, 0, 0>
}

light_source {<100, 50, -100> rgb 1}


#declare BS = 1;
plane {z,  2 texture {pigment {checker rgb 0, rgb 1 scale BS} finish {diffuse
1}} }

plane {y, -2 texture {pigment {checker rgb 0, rgb 1 scale BS} finish {diffuse
1}} }

// show all permutations of solo and mixed media

// Emitting, Absorbing, Scattering
// 15 combinations
// 5 across, 3 down

sphere {0, 1
 hollow
 pigment {rgbt 1}
 interior {
  media {
  emission 1
   density {
    spherical
    density_map {
     [0 rgb 0]
     [0.4 rgb <1,0,0>]
     [0.8 rgb <1,1,0>]
     [1 rgb 1]
    }
   }
  }
 }
 translate -x*2
}

sphere {0, 1 texture {pigment {rgb 1} finish {emission 1}} }

sphere {0, 1
 pigment {rgbt 1}
 hollow
 interior {
  media {
  absorption 1
   density {
    spherical
    density_map {
     [0 rgb 0]
     [0.4 rgb <1,0,0>]
     [0.8 rgb <1,1,0>]
     [1 rgb 1]
    }
   }
  }
 }
 translate x*2
}


Post a reply to this message

From: Kenneth
Subject: Re: Media woes
Date: 20 Feb 2025 01:00:00
Message: <web.67b6c41d2d33f923e83955656e066e29@news.povray.org>
This plane needs to be made 'hollow' for the media to appear:
      plane {z,  2... }

That's because the spheres are located 'inside' it. (The same effect could be
achieved by using 'inverse' instead.)

Whereas, the plane{y, -2...} doesn't need the hollow keyword, as the spheres are
'outside' it.

Personally, I have always wondered why a z-plane doesn't have it's 'outside'
facing the -z direction by default, rather than the other way around. I suppose
that there are old and deep reasons for this.


Post a reply to this message

From: Bald Eagle
Subject: Re: Media woes
Date: 20 Feb 2025 11:45:00
Message: <web.67b75b792d33f9235e04e68c25979125@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> This plane needs to be made 'hollow' for the media to appear:
>       plane {z,  2... }
>
> That's because the spheres are located 'inside' it. (The same effect could be
> achieved by using 'inverse' instead.)
>
> Whereas, the plane{y, -2...} doesn't need the hollow keyword, as the spheres are
> 'outside' it.
>
> Personally, I have always wondered why a z-plane doesn't have it's 'outside'
> facing the -z direction by default, rather than the other way around. I suppose
> that there are old and deep reasons for this.

Aha.
I snoozed and forgot that a plane is actually a half-space with an inside and an
outside...
So I needed a hollow plane, as ridiculous as that first sounds.
I also didn't quite know that any overlapping container needed to be hollow as
well.

I was actually starting to make some helper macros to make using media easier,
and keep track of all of the recommendations that Alain has offered over the
years.

Thanks, Kenneth!

- BW


Post a reply to this message

From: Kenneth
Subject: Re: Media woes
Date: 20 Feb 2025 17:45:00
Message: <web.67b7b02a2d33f923e83955656e066e29@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Kenneth" <kdw### [at] gmailcom> wrote:
> >
> > Personally, I have always wondered why a z-plane doesn't have it's 'outside'
> > facing the -z direction by default, rather than the other way around. I
> > suppose that there are old and deep reasons for this.

Hmm, not so deep as I thought. In the documentation for a plane:

"...most planes are defined with surface normals in the direction of an axis
[meaning the positive direction, which is not specifically mentioned.]"

"By definition the normal vector points to the outside of the plane."

So all of the three (simple) x-y-z planes have their 'outsides' in the positive
directions of the axes. That's logically consistent-- but has to be taken into
account when media is used *inside* the planes. It's a subtle "Gotcha!"

>
> I also didn't quite know that any overlapping container needed to be hollow as
> well.
>

Yeah, this situation has tripped me up in the past as well, when using planes.
We don't usually run into such problems with typical media-filled objects, or
even CSG constructs that have the proper 'master' hollow keyword.


Post a reply to this message

From: Kenneth
Subject: Re: Media woes
Date: 22 Feb 2025 19:25:00
Message: <web.67ba69d32d33f923e83955656e066e29@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> This plane needs to be made 'hollow' for the media to appear:
>       plane {z,  2... }
>
> That's because the spheres are located 'inside' it. (The same effect could be
> achieved by using 'inverse' instead.)
>
> Whereas, the plane{y, -2...} doesn't need the hollow keyword, as the spheres
> are 'outside' it.
>

I just discovered something interesting, that I didn't know until now.

Given your enclosed 'universe' of two planes, where the media spheres (and
camera) are inside one plane (z) but outside the other (y):

If I add 'hollow' to the z-plane as mentioned, the media shows up. HOWEVER, if I
also 'inverse' the y-plane-- thus making the enclosed space 'inside' from *both*
plane's perspectives-- the media disappears again. Apparently, the space is now
sort of a mix of hollow and non-hollow. I have to add 'hollow' to the inverted
y-plane as well, to get the media to reappear.

Naively, I would have assumed that the z-plane's sole 'hollow' would have
sufficed to make the space 'safe for media' (ha), and that it would somehow
override the non-hollow y-plane space. But not so!

I'm not so sure that using planes that enclose small media objects is a good
idea anyway, but for a different reason: AFAIU, every camera-ray/pixel shot into
such a scene would have to be tested for the presence of media-- not just by
testing the small spheres themselves, but over the entire camera view. Lots of
unnecessary computational overhead, in other words. But I could be wrong(?)


Post a reply to this message

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