POV-Ray : Newsgroups : povray.windows : The question about depth image generation Server Time
8 Oct 2024 11:29:24 EDT (-0400)
  The question about depth image generation (Message 1 to 4 of 4)  
From: Hao
Subject: The question about depth image generation
Date: 15 Feb 2018 19:15:00
Message: <web.5a8621bc4c29b94a66fefcc00@news.povray.org>
I want to render the depth image of the scene. I follow the methods of :
'http://runevision.com/graphics/stereo/depthmap/'
This method is useful for some scenes. However, it is found that the color of
the rendered image changes when the "colors.inc" or other predefined inc files
are included. Could any one give me some suggestions?
The codes of 'http://runevision.com/graphics/stereo/depthmap/' are,

object {
  sphere{-z*20 10}
    texture {
      pigment {gradient -z}
      scale 40
      finish {ambient 1 diffuse 0}
      }

}
camera{
 perspective
 location <0,0,0>
 direction -z
}

Using this code, the color of the central pixel equal approximately about
255*(10/40)=64.
However, if the 'color.inc', 'functions.inc' or other inc files are included at
the begining of the file, the color of rendered image changes.

Does anyone know why?


Post a reply to this message

From: Kenneth
Subject: Re: The question about depth image generation
Date: 16 Feb 2018 00:00:00
Message: <web.5a8664d633e225a2a47873e10@news.povray.org>
Did you leave out a #version directive at the top of your scene file AND the
assumed_gamma setting for your scene?

(Also: in my 'resolution INI file', I have Display_Gamma=sRGB and
File_Gamma=sRGB... both of which are the defaults, I think.)

What I see is that there is NO difference between these two, placed at the
beginning of your scene:

#version 3.7;
global_settings{assumed_gamma 1.0}

and

#version 3.7;
global_settings{assumed_gamma 1.0}
#include "colors.inc"

....But there IS a difference between these two:

NO #version directive
NO assumed_gamma

and

NO #version directive
NO assumed_gamma
#include "colors.inc"

I also see a difference between these two:

#version 3.7;
NO assumed_gamma
#include "colors.inc"

and

#version 3.5;
NO assumed_gamma
#include "colors.inc"


The "colors.inc" file has this at the top:
#ifndef(Colors_Inc_Temp)
#declare Colors_Inc_Temp = version;
#version 3.5;
.....

This changes your scene's version number to 3.5, *if* you leave out a #version
directive in your scene. It looks like v3.5 of POV-ray used a different default
'gamma' value to apply to a scene's colors.


Post a reply to this message

From: clipka
Subject: Re: The question about depth image generation
Date: 16 Feb 2018 11:37:06
Message: <5a8708b2$1@news.povray.org>
Am 16.02.2018 um 05:57 schrieb Kenneth:

> The "colors.inc" file has this at the top:
> #ifndef(Colors_Inc_Temp)
> #declare Colors_Inc_Temp = version;
> #version 3.5;
> ......
> 
> This changes your scene's version number to 3.5, *if* you leave out a #version
> directive in your scene. It looks like v3.5 of POV-ray used a different default
> 'gamma' value to apply to a scene's colors.

Actually pretty much the very opposite happens.

The standard include files (including `colors.inc`) have the following
structure:

    #ifndef(Foo_Inc_Temp)
    #declare Foo_Inc_Temp = version;
    #version 3.5; // typical; value may differ
    ...
    #version Foo_Inc_Temp;
    #end

This structure is designed to reset the effective language version back
to whatever it was before the include file.


There is a problem with this construct however: In v3.7.0, the effective
language version defaults to v3.6.2 for backwards compatibility, but the
`version` keyword, when used as an expression, defaults to the actual
software version, i.e. 3.7.

Thus, when a scene has no `#version` statement of its own and includes
one of the standard include files, the last `#version` statement in that
file does not reset the effective language version back to the default
of v3.6.2, but rather sets it to the actual software version, which is
v3.7.0 in that case.


This behaviour has been changed in later versions.


Post a reply to this message

From: Kenneth
Subject: Re: The question about depth image generation
Date: 16 Feb 2018 12:35:06
Message: <web.5a87163133e225a2a47873e10@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:

> > This changes your scene's version number to 3.5, *if* you leave out
> > a #version directive in your scene...
>
> Actually pretty much the very opposite happens.
>
> The standard include files (including `colors.inc`) have the following
> structure:
>
>     #ifndef(Foo_Inc_Temp)
>     #declare Foo_Inc_Temp = version;
>     #version 3.5; // typical; value may differ
>     ...
>     #version Foo_Inc_Temp;
>     #end
>
> This structure is designed to reset the effective language version back
> to whatever it was before the include file.

Yep, I do understand that; but I didn't understand why the ending #version
statement was NOT changing it back (in the case when there was no #version
number in the scene file itself.) My only guess was, for some reason or other
the #version 'compatibility' was staying at 3.5. (Or maybe 3.62, as you
mentioned?) I didn't know how to explain that in detail :-)

BTW, I was running the examples in v3.7.1 beta 9, but adding #version 3.7 into
the scene instead (or not, to see the difference.) Just tried the scene using
#version 3.71 (or not); same behavior that I described. The other 'variable' was
assumed_gamma 1.0. Adding it to the scene -- even without a #version number--
fixed all the problems (no change in the gray color or gamma behavior, with or
without "colors.inc.") I think I understand that: The example code uses gradient
-z... which by default is using 'linear' rgb values... which agrees with
'linear' assumed_gamma 1.0 no matter what.


Post a reply to this message

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