POV-Ray : Newsgroups : povray.general : Transparent media for volume rendering Server Time
4 Aug 2024 18:24:01 EDT (-0400)
  Transparent media for volume rendering (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Rob Smallshire
Subject: Transparent media for volume rendering
Date: 11 Feb 2003 11:50:04
Message: <web.3e4928b37b9552ea35ea56ad0@news.povray.org>
I am a geologist and software engineer trying to use POV-Ray to visualise
volumetric data encoded in binary df3 files.  I have a C++ program which
generates multiple df3 files - one df3 volume for each object in my
simulation - and also generates the .pov scene files for each of these and
a top level file to combine these into a single scene and set up a camera.
My own work is inspired by Paul Bourke's work at:

http://astronomy.swin.edu.au/~pbourke/povray/df3/

When rendering a scene containing only a single df3 media volume everything
works fine, but when I try to combine multiple df3 media volumes into a
single scene I run into problems.  The media volumes nearest to the camera
seem to obscure those behind. This even happens when large parts of the
volume are empty (i.e. have zero values) Note that several volumes may
overlap in space.

Each of my volumes is created in its own scene file containing code like the
following:

box {
0 , 1
  texture {
    pigment {
      rgbft 1
    }
  }
  interior {
    media {
      intervals 300
      samples 1, 20
      emission <0.005, 0.005, 0.005>
      absorption <0,0,0>
      scattering { 1,<0,0,0> }
      confidence 0.9999
      variance 1/900
      method 3
      density {
        density_file df3 "St_Bees_1.df3" interpolate 0
        density_map {
          [0 rgb 0 ]
          [1 rgb <1,0.0509804,0> ]
        }
      }
    }
  }
  hollow
  no_shadow
  scale <2400,1800,1900>
  translate <-53.0267,-1586.02,-750.003>
}

Each of these files is then #included into a top-level file which sets up
the camera.  Am I using the wrong parameters on my media to allow for
transparency? The effect I'm looking for is one of transparent glowing fog
with a density proportional to the value in my df3 files.  This works great
except when combining multiple volumes!

Any suggestions welcome.

Many thanks for your help,

Rob


Post a reply to this message

From: Tom Melly
Subject: Re: Transparent media for volume rendering
Date: 11 Feb 2003 12:27:31
Message: <3e493283@news.povray.org>
"Rob Smallshire" <rob### [at] mvecom> wrote in message
news:web.3e4928b37b9552ea35ea56ad0@news.povray.org...
>
> Each of my volumes is created in its own scene file containing code like the
> following:
>
> box {
> 0 , 1
>   texture {
>     pigment {
>       rgbft 1
>     }
>   }


Are the boxes the same for each media? (same position, same dimensions).

If so, it looks like there might be a bug in povray ("looks" - these things
often turn out to have a reasonable explanation).

Looking into your problem, I found that if I had two co-incident spheres with
media, the second sphere cancelled out the first sphere's media.

The solution was to make one of the spheres a slightly different size.

Here was the code I played with (change the radius of the second sphere to 1 to
see the problem - oh, and btw, if you have a lot of media-shapes, don't forget
to set max_trace_level suitably high):

camera {
  location  <4.0, 0.0,0 >

  look_at   <0.0, 0.0,  0.0>
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
}

// ----------------------------------------

sphere{
  0, 1
  pigment{rgbf 1}
  hollow
  interior{
    media {
      emission <0.1,0,0>
      method 3
      density{agate scale 1 density_map{[0.5 rgb 0][0.5 rgb 1]}}
    }
  }
}

sphere{
  0, 1.001 // change this to 1 to see the problem
  pigment{rgbf 1}
  hollow
  interior{
    media {
      emission rgb<0,0,0.1>
      method 3
      density{wrinkles scale 1 density_map{[0.5 rgb 0][0.5 rgb 1]}}
    }
  }
}


Post a reply to this message

From: Warp
Subject: Re: Transparent media for volume rendering
Date: 11 Feb 2003 13:15:58
Message: <3e493dde@news.povray.org>
Rob Smallshire <rob### [at] mvecom> wrote:
> The media volumes nearest to the camera
> seem to obscure those behind.

  Have you already tried increasing max_trace_level in global_settings?

  When there are only fully transparent objects with no reflection nor
refraction (as media containers), max_trace_level should be at least
twice the number of objects plus 1 (if you are using, for example, boxes
as media containers). This is because the ray may have to go through
that amount of surfaces.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Tom & Lu Melly
Subject: Re: Transparent media for volume rendering
Date: 11 Feb 2003 13:44:34
Message: <3e494492@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message
news:3e493dde@news.povray.org...
>
>   Have you already tried increasing max_trace_level in global_settings?
>

Hey, Warp, did you see my post? Does the behaviour of multiple media
containers seem odd to you?


Post a reply to this message

From: Tom & Lu Melly
Subject: Re: Transparent media for volume rendering
Date: 11 Feb 2003 13:47:49
Message: <3e494555@news.povray.org>
"Tom Melly" <tom### [at] tomandlucouk> wrote in message
news:3e493283@news.povray.org...

btw if you are using multiple identical media containers, you should know
that the approved alternative (iirc) would be to have one container with
multiple media statements - ie. rather than

object{O1
    interior{
        media{M1}
    }
}

object{O1
    interior{
        media{M2}
    }
}

you should have

object{O1
    interior{
        media{M1}
        media{M2}
    }
}

You can also have multiple density statements in a single media-statement,
but the effect is different - see docs for details.


Post a reply to this message

From: Tom Melly
Subject: Re: Transparent media for volume rendering
Date: 12 Feb 2003 08:21:55
Message: <3e4a4a73$1@news.povray.org>
"Tom Melly" <tom### [at] tomandlucouk> wrote in message
news:3e493283@news.povray.org...

> If so, it looks like there might be a bug in povray ("looks" - these things
> often turn out to have a reasonable explanation).
>

I don't know enough (i.e. "anything") about pov internals to know if this is the
case, but there might indeed be a reasonable explanation if your containers are
co-incident.

Basically, Pov may get confused as to whether it's inside or outside a container
(and therefore whether to render the media) when co-incident containers are
used.

As a general rule-of-thumb, it's best to avoid co-incident surfaces at all times
(they are a definite no-no if the surfaces have a visible pigment).

BTW I don't know which of your media params are necessary and which are not, but
they are *VERY* slow. Certainly for testing I would remove or adjust them for
quicker rendering time.


Post a reply to this message

From: Rob Smallshire
Subject: Re: Transparent media for volume rendering
Date: 12 Feb 2003 08:40:05
Message: <web.3e4a4db764ac950035ea56ad0@news.povray.org>
>Are the boxes the same for each media? (same position, same dimensions).

In the general case the boxes are in different positions but intersect in
3-D with varying amounts of overlap.  The boxes are unlikely to have
exactly the same position and dimensions and this is not the case in any of
my examples.

The problem seems to manifest itself where the boxes overlap in 3-space,
although it could also be where they overlap on the image plane - its
difficult to tell which. I'll try to resolve this one and report back.

Thanks for the tip about max_trace_level - I'll try this too.

Regards,

Rob Smallshire


Post a reply to this message

From: Rob Smallshire
Subject: Re: Transparent media for volume rendering
Date: 12 Feb 2003 10:25:04
Message: <web.3e4a66e764ac950035ea56ad0@news.povray.org>
> > Have you already tried increasing max_trace_level in global_settings?

> Thanks for the tip about max_trace_level - I'll try this too.

I've now tried increasing max_trace_level and it makes no difference.

By the way I have my light set to media_interaction off and
media_attenuation off.  Is this the right thing to do?

Rob


Post a reply to this message

From: Tom Melly
Subject: Re: Transparent media for volume rendering
Date: 12 Feb 2003 11:01:46
Message: <3e4a6fea$1@news.povray.org>
"Rob Smallshire" <rob### [at] mvecom> wrote in message
news:web.3e4a66e764ac950035ea56ad0@news.povray.org...
> > > Have you already tried increasing max_trace_level in global_settings?
>
> > Thanks for the tip about max_trace_level - I'll try this too.
>
> I've now tried increasing max_trace_level and it makes no difference.
>
> By the way I have my light set to media_interaction off and
> media_attenuation off.  Is this the right thing to do?
>
> Rob

"media_interaction off" iirc will mean that scattering and absorbing media won't
work (although emitting media will be okay). I'd take it out or turn it on.
"media_attenuation off" should be okay though.


Post a reply to this message

From: Tom Melly
Subject: Re: Transparent media for volume rendering
Date: 12 Feb 2003 11:30:20
Message: <3e4a769c$1@news.povray.org>
"Rob Smallshire" <rob### [at] mvecom> wrote in message
news:web.3e4928b37b9552ea35ea56ad0@news.povray.org...

Could you email an actual scene file you are using (minus the df3 files) to
df3### [at] tomandlucouk ?

(assuming you haven't solved the problem)


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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