POV-Ray : Newsgroups : povray.programming : fog flag to fade to sky_sphere/background color Server Time
28 Mar 2024 18:30:27 EDT (-0400)
  fog flag to fade to sky_sphere/background color (Message 1 to 6 of 6)  
From: scott
Subject: fog flag to fade to sky_sphere/background color
Date: 29 May 2013 11:51:39
Message: <51a6240b$1@news.povray.org>
Would there be much interest in adding a flag to the fog object that 
uses the scene background colour (eg from sky_sphere or background) as 
fog_color rather than a constant? This would be useful to make objects 
in the scene automatically fade into the background colour.

I think trace.cpp could be be modified to achieve this (I haven't tested 
it yet). In TraceRay fog would not be applied if no object is 
intersected - ie just the colour from ComputeSky is used. If an object 
is found then the result from ComputeSky is passed to ComputeFog and 
that colour is used as the fog colour (rather than the colour from the 
fog object).

Do you think this is a good idea, or any issues with the above way of 
patching POV?


Post a reply to this message

From: Samuel Benge
Subject: Re: fog flag to fade to sky_sphere/background color
Date: 29 May 2013 13:10:01
Message: <web.51a63582b45608983048e5b80@news.povray.org>
scott <sco### [at] scottcom> wrote:
> Would there be much interest in adding a flag to the fog object that
> uses the scene background colour (eg from sky_sphere or background) as
> fog_color rather than a constant?

A while back I wrote an SDL version of something similar to what you're talking
about, sans background support (which wouldn't have made much sense). Using it
is... not very easy. Every object taking part in the fog has to have its texture
wrapped in a special macro. The camera position needs to be tracked. Creating
and/or converting sky pigments requires special macros. It could easily become a
nightmare when trying to combine it with other scene-management-intensive
activities like texture baking.

So yeah, I'd be interested :)


Post a reply to this message

From: scott
Subject: Re: fog flag to fade to sky_sphere/background color
Date: 30 May 2013 03:09:38
Message: <51a6fb32$1@news.povray.org>
>> Would there be much interest in adding a flag to the fog object that
>> uses the scene background colour (eg from sky_sphere or background) as
>> fog_color rather than a constant?
>
> A while back I wrote an SDL version of something similar to what you're talking
> about, sans background support (which wouldn't have made much sense). Using it
> is... not very easy. Every object taking part in the fog has to have its texture
> wrapped in a special macro. The camera position needs to be tracked. Creating
> and/or converting sky pigments requires special macros. It could easily become a
> nightmare when trying to combine it with other scene-management-intensive
> activities like texture baking.

I first tried to implement a similar effect using media, but you have to 
manually "translate" whatever pigment you've used on the sky_sphere into 
a density map, and getting it to match up (so that objects towards 
infinity appear the same colour as the sky_sphere) is not trivial. Also 
rendering time takes a much bigger hit than with a simple fog.

> So yeah, I'd be interested :)

Thinking about it a bit more it would probably be more flexible if you 
could just use a pigment object for the fog color, then if you want you 
can just use the same one for sky_sphere, or something different (eg if 
you have a cloud layer that you don't want to fade to). That sounds a 
bit more work to implement though.

I'll see if I can have a go at implementation of the first idea, but 
last time I tried to compile the source with Visual Studio Express I 
remember getting atlbase.h errors (I'm pretty sure I got it to work in 
the past with VSexpress so I'll spend some more time with it over the 
weekend).


Post a reply to this message

From: scott
Subject: Re: fog flag to fade to sky_sphere/background color
Date: 3 Jun 2013 05:55:32
Message: <51ac6814$1@news.povray.org>
> I'll see if I can have a go at implementation of the first idea, but
> last time I tried to compile the source with Visual Studio Express I
> remember getting atlbase.h errors (I'm pretty sure I got it to work in
> the past with VSexpress so I'll spend some more time with it over the
> weekend).

I only got half an hour or so over the weekend but I did find out it 
wasn't going to be trivial to compiler under the latest VSexpress. The 
main error is that shared_ptr is used *a lot* and VS doesn't know if it 
means boost::shared_ptr or std::shared_ptr. I think I just need to go 
through and prefix all the shared_ptr occurances with "boost::". There 
are also apparently some missing files (toFloat.h, b44ExpLogTable.h, 
initializer_list) - need to investigate those further...


Post a reply to this message

From: scott
Subject: Re: fog flag to fade to sky_sphere/background color
Date: 5 Jun 2013 06:02:07
Message: <51af0c9f$1@news.povray.org>
On 03/06/2013 10:55, scott wrote:
>> I'll see if I can have a go at implementation of the first idea, but
>> last time I tried to compile the source with Visual Studio Express I
>> remember getting atlbase.h errors (I'm pretty sure I got it to work in
>> the past with VSexpress so I'll spend some more time with it over the
>> weekend).
>
> I only got half an hour or so over the weekend but I did find out it
> wasn't going to be trivial to compiler under the latest VSexpress.

Got it working :-) I'll write a few lines to help anyone else wanting to 
compile with VSexpress and post it here in a separate thread. Once I get 
a decent test scene I'll post some images to p.b.i.


Post a reply to this message

From: scott
Subject: Re: fog flag to fade to sky_sphere/background color
Date: 7 Jun 2013 09:32:12
Message: <51b1e0dc$1@news.povray.org>
>> Would there be much interest in adding a flag to the fog object that
>> uses the scene background colour (eg from sky_sphere or background) as
>> fog_color rather than a constant?
>
> A while back I wrote an SDL version of something similar to what you're talking
> about, sans background support (which wouldn't have made much sense). Using it
> is... not very easy. Every object taking part in the fog has to have its texture
> wrapped in a special macro. The camera position needs to be tracked. Creating
> and/or converting sky pigments requires special macros. It could easily become a
> nightmare when trying to combine it with other scene-management-intensive
> activities like texture baking.
>
> So yeah, I'd be interested :)

Sample images are in p.b.i


Post a reply to this message

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