POV-Ray

The Persistence of Vision Raytracer (POV-Ray).

This is the legacy Bug Tracking System for the POV-Ray project. Bugs listed here are being migrated to our github issue tracker. Please refer to that for new reports or updates to existing ones on this system.

Tasklist

FS#286 - reflection exponent other than 1 causes black artifacts when reflecting negative brightness

Attached to Project: POV-Ray
Opened by Paul (OJD) - Friday, 19 April 2013, 08:08 GMT
Last edited by William F Pokorny (wfpokorny) - Sunday, 29 January 2017, 13:15 GMT
Task Type Possible Bug
Category Backend → Texture/Material/Finish
Status Tracked on GitHub
Assigned To Christoph Lipka (clipka)
Operating System All
Severity Low
Priority Normal
Reported Version 3.70 RC7
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

[EDIT: Original title was “radiosity causing black patches when using emission less than 0”]

see attached image for reference.

mountain on left has emission set to -.13 and black patches show up, when emmission set to 0 or greater no patches

changing max_trace or any radiosity settings has no effect

setting no_radiosity on mountain fixed problem as a temp fix

code sample ...

#version 3.7;

#default { finish { ambient 0 } }
#declare rad_lvl = 4;

global_settings {
  assumed_gamma 1
  max_trace_level max(5,rad_lvl*3)
  adc_bailout .007
  ambient_light 0
  radiosity {
   pretrace_start 64/max(image_width,image_height)
   #if(rad_lvl)
    pretrace_end max(2,int(8/rad_lvl))/max(image_width,image_height)
   #else
    pretrace_end 32/max(image_width,image_height)
   #end
   count pow(rad_lvl+1,2)*10
   nearest_count 1
   #if(rad_lvl) error_bound 1/rad_lvl #end
   low_error_factor max(.4,(8-rad_lvl)/10)
   recursion_limit 1
   gray_threshold .25
   brightness 1
   max_sample 1
   normal on
   media off
   always_sample off
   minimum_reuse min(.008,8/max(image_width,image_height))
   maximum_reuse .1
   adc_bailout .02
  }
}

#declare sunC = rgb <1, 1, .9925>; // actual D65 standard illuminant
#declare SkyC = rgb <.3195, .5745, .8805>;
#macro GammaAdj(C,G) rgb <pow(C.red,G),pow(C.green,G),pow(C.blue,G)> #end

light_source {
  50000*y
  sunC*1.06
  area_light <-300, 0, -300>, <300, 100, 300>, 3, 3
  rotate <-28, 0, 14>
  adaptive 0
  circular
}

 sphere { 0, 1
  texture {
   pigment{
    gradient y
    pigment_map{
     [.07 GammaAdj(SkyC,.5)]
     [.2 average pigment_map { [.5 GammaAdj(SkyC,.75)][1 wrinkles turbulence .65 octaves 5 lambda 3 omega .9 color_map { [.2 rgb 1][.5 SkyC] } scale <10, .1, 1>] }]
     [.4 GammaAdj(SkyC,1.15)]
     [.5 GammaAdj(SkyC,1.35)]
    }
    rotate -75*y scale <1, 1, 100>
   }
   finish { diffuse .72 }
  }
  scale 100000
  inverse
 }


#declare Cam_pos = Cam_pos + <0, 20, -40>;
#declare Cam_lkt = Cam_lkt + <0, 10, 50>;
camera {
  location Cam_pos
  direction <0,0,1>
  right 1.33*x
  up y
  sky <0,1,0>
  #if(Cam_agl) angle Cam_agl #end
  look_at Cam_lkt
}

#macro sinai(HillQ)
 #local F = function { pattern { granite poly_wave 4 turbulence .01 lambda 2.1 omega .9 scale 5 translate <.2, 0, 18.08> scale <2, 1, 3> } }
 #local N = function { pigment { crackle ramp_wave turbulence .3 lambda 2.2 omega .76 color_map {[0 rgb 0][1 rgb 1] } scale .07 translate <-.15, -.12, .13> } }
 height_field {
  function HillQ, HillQ { F(x,y,z) + N(x,y,z).grey/47 }
  water_level .05
  clipped_by { box { <0, .05, .3>, <1, 1, 1> } }
  translate <-.5, -.05, -.5>
  rotate 20*y
  texture {
   pigment{ crackle color_map { [0 rgb <161, 107, 71>/255][.25 rgb <193, 132, 93>/255][.35 rgb <218, 163, 123>/255][.45 rgb <212, 153, 112>/255][.55 rgb <222, 166, 125>/255][.65 rgb <236, 178, 124>/255][.75 rgb <220, 154, 102>/255][.85 rgb <160, 121, 103>/255] } turbulence .75 lambda 3 omega .7 scale .1 }
   finish{ diffuse albedo .56 emission -.13 specular .25 roughness .02 brilliance 1.5 metallic 1.3 }
   normal { crackle poly_wave .7 turbulence .4 omega .8 scale <.007, .03, .007> }
  }
  rotate 12*y
  scale <2400, 2000, 3000>*1.5
  translate <1900, 0, 1900>
  scale <-1,1,1>
  no_radiosity
 }
#end


sinai(1600)
plane { y,0 pigment { rgb <1, 1, 1> } }

//courtyard gating not included due to size of code and many external files needed. add anything around <0,0,0> to try to reproduce effect of error
   bug.bmp (2.25 MiB)
This task depends upon

Comment by Paul (OJD) - Friday, 19 April 2013, 08:17 GMT

to duplicate issue, remove no_radiosity from sinai macro... sorry

Comment by Paul (OJD) - Friday, 19 April 2013, 08:28 GMT

version 3.7.0.RC7.msvc10-sse2.win32

winXP home SP3
Intel 4400 dual core
500mb

Comment by Christoph Lipka (clipka) - Friday, 19 April 2013, 12:37 GMT

Can you please provide initial settings for Cam_pos, Cam_lkt and Cam_agl? Thanks.

Comment by Christoph Lipka (clipka) - Friday, 19 April 2013, 12:56 GMT
//courtyard gating not included due to size of code and many external files needed. add anything around <0,0,0> to try to reproduce effect of error

Can't reproduce with just "anything around <0,0,0>"; please provide a scene that does show the problem without us having to guess what we might or might not have to add.

Comment by Paul (OJD) - Friday, 19 April 2013, 20:27 GMT

#ifndef(Cam_pos) #declare Cam_pos = 0; #end
#ifndef(Cam_lkt) #declare Cam_lkt = 0; #end
#ifndef(Cam_agl) #declare Cam_agl = 0; #end

thanks for the quick reply Christoph. Just too much to include to duplicate the image submitted so I'll duplicate the issuse with a simple scene and repost later today.

Comment by Paul (OJD) - Friday, 19 April 2013, 22:24 GMT

brilliance < 1.4 or emission > = 0 on first cylinder does not seem to duplicate the effect.
any exponent < = 1 in second cylinder does not seem to duplicate the effect.
multiple renders show black circles show up in random locations and sometimes do not show

povray.ini set to default at install
rendered at 640x480 no AA

global_settings {
  radiosity {
   pretrace_start .1
   pretrace_end .01
   error_bound .3
   recursion_limit 1
  }
}

light_source{
  500*y
  1
  rotate <-28, 0, 14>
}

camera {
  location <0, 7, -7>
  look_at <0, 3, 0>
}

background { rgb <.3, .5, .8> }
plane { y,0 pigment { rgb <1, 1, 1> } }

cylinder { <-1, 0, 0>, <-1, 3, 0>, .4 scale <1, 1, 10> rotate 55*y translate 5*z
 texture {
  pigment{ rgb .7 }
  finish{
   emission -.15
   brilliance 2
  }
 }
}

cylinder { <2.5, 0, 0>, <2.5, 3, 0>, .1
 texture {
  pigment { rgb .7 }
  finish {
   reflection {
    .2
    exponent 1.1
   }
  }
 }
}
Comment by Christoph Lipka (clipka) - Saturday, 20 April 2013, 14:25 GMT
  • Field changed: Summary (radiosity causing black patches when using emission less than 0 → reflection exponent other than 1 causes black artifacts when reflecting negative brightness)
  • Field changed: Details
  • Field changed: Status (Unconfirmed → Investigating)
  • Field changed: Category (Radiosity → Texture/Material/Finish)
  • Task assigned to Christoph Lipka (clipka)

The problem is not limited to radiosity, nor to negative emissions, as can be demonstrated with the following scene; there is a general problem when anything with a negative brightness is reflected in a surface with almost any exponent other than 1, causing the resulting image regions to be pitch black even if other properties of the reflecting surface would normally boost its brightness back to positive values:

light_source{
  500*y
  rgb 1
  rotate <-80, 60, 0>
}

light_source{
  500*y
  rgb -0.001
  rotate <-80, -60, 0>
}

camera {
  location <0, 3, -7>
  look_at <0, 1, 0>
}

background { rgb <.3, .5, .8> }
plane { y,0 pigment { rgb 1 } finish { reflection { 0.2 exponent 1.1 } } }

cylinder { <0, 0, 0>, <0, 1, 0>, 1
 texture {
  pigment{ rgb 1 }
  finish{
   diffuse 1.0
   ambient 0
   emission 0
  }
 }
}

exponent values that are the inverse of a natural number (such as 1/2, 1/3, etc.) appear to be safe. I suspect this is an inherent problem of the math involved, rather than an outright bug.

Note that reflection exponents other than 1.0 are anything but realistic; same goes for negative values for emission (although some particularly vivid yet still realistic colours may require individual colour components to be set to negative values, which will lead to similar problems with a non-1 reflection exponent).

Comment by Paul (OJD) - Sunday, 21 April 2013, 08:21 GMT

thanks for looking into it Christoph.

I have been using v 3.62 for this project and descided to move up to 3.7. In adjusting lighting and textures to fit the new version, I went off on a tangent playing with the new features and seeing what effects would result from radical settings.

The new crackle has be pulling my hair out as it is definitely not backwards compatible with setting the version. It seems to have a different starting point in the pattern or something as using crackle as a pattern in a function has different results from 3.62

Thanks to you all for the great work. Radiosity looks awesome in 3.7.

Comment by Simon (infoised) - Monday, 22 April 2013, 15:00 GMT

There's a conceptual question how to interpret negative light. pow(color,exponent) has no meaning for negative color and noninteger exponent (trace.cpp::ComputeLightedTexture) and returns NaN, which breaks everything. You could either copy the sign, such as pow(fabs(color),exponent)*(color>0?1:-1), or just zero out the negative components, like color>0?pow(color,exponent):0. The second option makes a bit more sense, if this feature is meant to make the bright objects reflect, but ignore darker reflections.

The choice is completely arbitrary, as this feature is completely unphysical and breaks the linearity of light transport - multiplying all the lights by some factor changes the behavior of the reflective surface. For natural scenes, this is not needed anyway, povray internally uses floating point (high dynamic range), so bright objects can be made realistically bright.

Comment by William F Pokorny (wfpokorny) - Sunday, 29 January 2017, 13:15 GMT
  • Field changed: Status (Investigating → Tracked on GitHub)

Now tracked on github as issue #223.

Loading...