POV-Ray : Newsgroups : povray.advanced-users : light output image difference between v3.7 and v3.8 Server Time
21 Dec 2024 21:47:21 EST (-0500)
  light output image difference between v3.7 and v3.8 (Message 1 to 6 of 6)  
From: Warren
Subject: light output image difference between v3.7 and v3.8
Date: 16 Oct 2018 14:35:01
Message: <web.5bc62f08b2463bce20df21d60@news.povray.org>
Hi/Hello

I have a system that build textures for a video game under Ubuntu v18.04 . All
the textures are made with povray and some bash scripts help me to run povray in
command line and then sort the generated textures in directories after a command
line tool : 'image magic' (with mogrify and/or convert binaries) applies some
modification to the images generated with povray.

Bash >> run povray for image A >> apply some modification to the image A with
image magick (if needed only) >> then it runs bash again (bourne again shell
'again' == "bash again" (joke inside :-) ) ) to move the texture(s) in a
destination folder where all textures are sorted by their kind in sub
directories (building or enemy ship or grass tile texture, etc..). I use mainly
orthographic camera because of the tiles textures system for games.

When I had povray in stable version 3.7 everything went perfectly I had the
texture I wanted (after some tries of image magick that I had never used before
, it took some time to be perfect. But since I setup povray 3.8 (I will put the
output of 'povray --version' below for details), some texture differs from
precedent renders. For example I generate some buildings , and for the need of
my game I will render the building itself and then its shadow with the same
scene, but for the 'shadow' rendering I will use the 'no_image' keyword and a
statement of a gray plane to cast the shadow. So I have a picture of the
building's shadow with (initially) two grays, a dark one for the shadow and a
lighter one that was exposed to the light source (I set the source light as far
as needed to not have several grays for one part (shadow part / to light exposed
plane part). And then after that I use image magick with commands that set the
colour to (RedGreenBlueAlpha hexadecimal) #00000093 for the shadow and #XXXXXXff
(which is completely transparent due to ff alpha channel.(I picked the colour of
the shadow only once then everything is run automatically I don't need to come
back to it).

The problem is that the resulting shadow surroundings contains some
irregularities like some mid transparent black pixels that I had not before.
Before the shadow texture was cropped with image magick and it kept only the
image shadow, now the texture image is a little bigger because of the mid
transparent black pixels. And after some analyze of the just rendered (but not
modified shadow texture that povray made), I saw with the color picker (in GIMP)
with the broadly speaking following options : 'don't select only clicked
adjacent pixels but all image pixels' and 'color selected threshold = 0' I see
that there are a lot of scattered pixels selected outside of the shadow telling
me that the light exposed plane is not uniform , and that doesn't look like a
wave of gradient grays that you'd normally expect if the light source was nearer
(angle between light and plane).

Here are the commands used with image magick to convert shadow (note the operand
before opaque that is not the same : + or - ):

//If color not equal to #cacacaff set color to #00000093 (this is the shadow)
mogrify -alpha set -channel RGBA -fill '#00000093' +opaque '#cacacaff'
bld_23_shadow.png >> ../../../../../errors_$1.txt 2>&1

//If color equal to #cacacaff change it to #cacacaff which is fully transparent
mogrify -alpha set -channel RGBA -fill '#cacaca00' -opaque '#cacacaff'
bld_23_shadow.png >> ../../../../../errors_$1.txt 2>&1

//Crop the image
mogrify -trim +repage bld_23_shadow.png >> ../../../../../errors_$1.txt 2>&1

All error messages are outputed to a file: errors_*.txt, I didn't see any errors
in it all was fine.

I used both 3.7 and 3.8 for the version statement and forced the default value
of ambient to 0.1 when I used 3.8 version but nothing changed.

Here is the output of 'povray --version':

POV-Ray 3.8.0-alpha.9861167.unofficial

This is an unofficial version compiled by:
 Antoine FAURE <www.ant01.fr>
 The POV-Ray Team is not responsible for supporting this version.

Copyright 1991-2018 Persistence of Vision Raytracer Pty. Ltd.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Built-in features:
  I/O restrictions:          enabled
  X Window display:          enabled (using SDL)
  Supported image formats:   gif tga iff ppm pgm hdr png jpeg tiff openexr
  Unsupported image formats: -

Compilation settings:
  Build architecture:  x86_64-pc-linux-gnu
  Built/Optimized for: x86_64-pc-linux-gnu (using -march=native)
  Compiler vendor:     gnu
  Compiler version:    g++-8 8
  Compiler flags:      -pipe -Wno-multichar -Wno-write-strings
-fno-enforce-eh-specs -Wno-non-template-friend -s -O3 -ffast-math -march=native
-pthread


Post a reply to this message

From: clipka
Subject: Re: light output image difference between v3.7 and v3.8
Date: 16 Oct 2018 16:58:10
Message: <5bc650e2$1@news.povray.org>
What command-line / INI settings are you using?

Also, a minimalistic sample scene or at least output images (ideally the
results of both a v3.7 and v3.8 render of exactly the same scene) would
come in handy.


Post a reply to this message

From: Warren
Subject: Re: light output image difference between v3.7 and v3.8
Date: 17 Oct 2018 12:50:02
Message: <web.5bc7652b873e3cc220df21d60@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> What command-line / INI settings are you using?
>
> Also, a minimalistic sample scene or at least output images (ideally the
> results of both a v3.7 and v3.8 render of exactly the same scene) would
> come in handy.

Hi,

Here is the bash script file (notify the $1 symbol is the width of a logical
tile square in the game that I carry in each bash script as first parameter, so
here I render a 256*128 image if $1 == 64. If not $1 is shipped at the top of
the bash arborescence files povray doesn't render at all. As you will see I do
not use any 'ini' file here):

#!/bin/bash
# First parameter : size of a unit square in the 'Mercenaries' game in pixels
(like 64 for example)
echo "  generate 'cylindrical container' (ideal for bonuses) textures to
sprites/buildings/new directory at $(date +%Hh:%Mmin:%Ssec)" >>
....../../../../../errors_$1.txt 2>&1
#
let "img_width = $1 * 2"
let "img_height = $1"
#
povray +IcylindricalBonusContainer.pov +Obld_23_contBonus.png +W${img_width}
+H${img_height} +a0.3 +UA Declare=RendShadow=0 +GFbonusContRenderImg.povlog
#
let "img_widthShadow = $1 * 4"
let "img_heightShadow = $1 * 2"
#
povray +IcylindricalBonusContainer.pov +Obld_23_shadow.png +W${img_widthShadow}
+H${img_heightShadow} +a0.3 +UA Declare=RendShadow=1
+GFbonusContRenderShadow.povlog
#
mogrify -alpha set -channel RGBA -fill '#00000093' +opaque '#cacacaff'
bld_23_shadow.png >> ../../../../../errors_$1.txt 2>&1
mogrify -alpha set -channel RGBA -fill '#cacaca00' -opaque '#cacacaff'
bld_23_shadow.png >> ../../../../../errors_$1.txt 2>&1
mogrify -trim +repage bld_23_shadow.png >> ../../../../../errors_$1.txt 2>&1
#
#Here, there should be 'mv' command to move the generated files.

Below is a simplified scene of the image:
#include "../../../../includes/povrayVersion.inc"

global_settings{assumed_gamma 1.0}

camera{
    orthographic
    location <0,20,0>
    look_at 0
    direction -y
    sky z
       #if( RendShadow )
            up 2*z
            right 4*x
       #else
            up z
            right 2*x
       #end
   }


light_source{<10,20,10>*100000 color srgb 1}

union{
   object{CylindreExt texture{tDanger} translate -0.9*x}
   object{CylindreExt texture{tDanger} translate 0.9*x}
   object{CylindreCentre texture{tMetal} }
      #if( RendShadow )
          no_image
      #end
  }

#if( RendShadow )
    plane{y, 0 pigment{color srgb 1 } }
#end


The included 'povrayVersion.inc' file contains only the following (nothing was
deleted) I tried both 3.7 and 3.8 versions but that gave the same not wanted
results:

//For all the tiles '*.pov' files, in order to quick change the povray version
used for generate the textures
//This file is included in all pov files
#version 3.8;

#default{ finish{ ambient 0.1 } }

Povray 3.8 output a warning message that tells , it found a directive (#include)
before a '#version' directive and that it could do something wrong for default
values, I don't know if it has something to do with the unexpected images.

That system allows me to easily change the #version directive by
modifying only that file (there are others techniques like a common ini file the
same way but 'included' in bash files or the following technique (if you ever
are aware of ubuntu command line):

find -type f -name "*.pov" -exec sed 's%#version 3.7%#version 3.8%g' -i {} \;

>> find all pov file and execute sed command that replace etc ...


And finally the two files: the one just after the povray render and the one
after the image magick modifications:

http://www.ant01.fr/filesAnt01/debug/justPovrayRendered.png

http://www.ant01.fr/filesAnt01/debug/shadowImgAfterMogrify.png

PS: I said in the first post I used the color picker with the threshold and an
other option, but actually, that's the 'magick wand'.


Post a reply to this message

From: clipka
Subject: Re: light output image difference between v3.7 and v3.8
Date: 20 Oct 2018 19:44:46
Message: <5bcbbdee$1@news.povray.org>
Am 17.10.2018 um 18:44 schrieb Warren:
> And finally the two files: the one just after the povray render and the one
> after the image magick modifications:
> 
> http://www.ant01.fr/filesAnt01/debug/justPovrayRendered.png
> 
> http://www.ant01.fr/filesAnt01/debug/shadowImgAfterMogrify.png

That's obviously dithering we're seeing here.

Digging a bit deeper, apparently I accidently forced dithering on in one
of the recent changes, even to the point that it can't be turned off
(nor switched to a different mode, for that matter).

Gotta fix this.

Maybe


Post a reply to this message

From: Jim Holsenback
Subject: Re: light output image difference between v3.7 and v3.8
Date: 21 Oct 2018 06:36:26
Message: <5bcc56aa$1@news.povray.org>
On 10/20/18 7:44 PM, clipka wrote:
> Am 17.10.2018 um 18:44 schrieb Warren:
>> And finally the two files: the one just after the povray render and the one
>> after the image magick modifications:
>>
>> http://www.ant01.fr/filesAnt01/debug/justPovrayRendered.png
>>
>> http://www.ant01.fr/filesAnt01/debug/shadowImgAfterMogrify.png
> 
> That's obviously dithering we're seeing here.
> 
> Digging a bit deeper, apparently I accidently forced dithering on in one
> of the recent changes, even to the point that it can't be turned off
> (nor switched to a different mode, for that matter).
> 
> Gotta fix this.
> 
> Maybe
> 

lol ... please do. i saw this issue too but hadn't gotten around to 
eliminating my scene as the issue


Post a reply to this message

From: Warren
Subject: Re: light output image difference between v3.7 and v3.8
Date: 21 Oct 2018 09:00:01
Message: <web.5bcc7810873e3cc220df21d60@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 17.10.2018 um 18:44 schrieb Warren:
> > And finally the two files: the one just after the povray render and the one
> > after the image magick modifications:
> >
> > http://www.ant01.fr/filesAnt01/debug/justPovrayRendered.png
> >
> > http://www.ant01.fr/filesAnt01/debug/shadowImgAfterMogrify.png
>
> That's obviously dithering we're seeing here.
>
> Digging a bit deeper, apparently I accidently forced dithering on in one
> of the recent changes, even to the point that it can't be turned off
> (nor switched to a different mode, for that matter).
>
> Gotta fix this.
>
> Maybe

Ok. I will stay tuned ;-)
For the instance, I have two binaries under Ubuntu 18.04 :
'povray3-7' and 'povray3-8'
I have a symbolic link ('povray') for povray3-7 in the same directory so I can
easily change which binary to run.


Post a reply to this message

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