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.


FS#165 - photon problem: image of projected image_map is clipped at the corners

Attached to Project: POV-Ray
Opened by Corvin Zahn (corvin) - Thursday, 23 September 2010, 10:34 GMT
Last edited by Christoph Lipka (clipka) - Thursday, 21 June 2012, 22:57 GMT
Task Type Definite Bug
Category Backend → Photons
Status Closed
Assigned To Christoph Lipka (clipka)
Operating System All
Severity Low
Priority Normal
Reported Version 3.6
Due in Version 3.70 RC4
Due Date Undecided
Percent Complete 100%
Votes 0
Private No



I have a problem with photons. The following stripped down code simulates a
slide projector:

#include "colors.inc"
global_settings {
  #if (1)   // switch photons on/off
    photons { count 1000000 }
camera { location <0, 0, 200> sky<0,1,0> look_at <0,200,-200> angle 90 }
// projection screen
plane { z, -200 texture { pigment { White } finish{ diffuse 1 ambient 0.1} } }
// slide
polygon {
  5, <0,0,0>, <1,0,0>,<1,1,0>,<0,1,0>,<0,0,0>
  pigment { image_map {jpeg "s7_0.9_320.jpg" interpolate 2 filter all 1.0 } }
  translate <-0.5, 0.2, -0.3>
  photons { target refraction on reflection off collect off }
// projector lamp
light_source { <0, 0, 0>  color <1,1,1> }


A point light source projects through a image_map onto a screen.

Without photons the projected image is ok:

With photons the left and right bottom corners of the image will be clipped:

The size of clipped corners depends on the y-offset in the translate command.

The povray Version is:
Persistence of Vision™ Ray Tracer Version 3.6.1 (Debian (x86_64-linux-gnu-g+
+ 4.3.3 @ x86_64-pc-linux-gnu))
(the 3.7 beta has the same problem)

I posted this question in the general news group and got an answer by Christian Froeschlin,
who could reproduce the problem and suggested as workaround to divide the slide into small stripes


This works, but doesn’t explain the problem.

Does anyone have an idea, whats wrong?

Many thanks,

This task depends upon

Closed by  Christoph Lipka (clipka)
Thursday, 21 June 2012, 22:57 GMT
Reason for closing:  Fixed
Additional comments about closing:  no news, so I guess the fix was effective
Comment by Grimbert Jérôme (Le_Forgeron) - Saturday, 21 May 2011, 17:13 GMT

I tried it with a 3840x1200 jpeg in 3.7RC3: not only the corners are gone (well, dark), but the image is went from "clear" to "out of focus" when adding photons.
(adding more photons provide more focus)

Could the corners be related to the angle of the photon shooter ?

Comment by Christoph Lipka (clipka) - Sunday, 22 May 2011, 00:39 GMT

As for the out-of-focus effect, that's actually inevitable unless you shoot at least one photon per "slide" pixel (i.e. 4,608,000 photons in your test case); even then you'll still get sampling artifacts of one type or another due to the photons not hitting every pixel right in the center.

Comment by Grimbert Jérôme (Le_Forgeron) - Monday, 11 July 2011, 16:21 GMT
// slide
#if (0)
polygon {
  5, <0,0,0>, <1,0,0>,<1,1,0>,<0,1,0>,<0,0,0>
		box { < -1,-1,0>/20*clock,<1,1,0>+<1,1,0>/20*clock 

(and "once" in the image_map)

The corners come back for a value of clock at 0.8 (but not for 0.75!)

Using <0,-1,0>/20*clock does not give such a good result (at all: at clock 1, corners are still missing)

Using < -1,0,0> (and < 1,0,0>) instead of < -1,-1,0> (and <1,1,0>) neither. The black corners extend beyond the image_map with once, so it seems irrelevant to image_map and more specifici to the photon code.

Comment by Grimbert Jérôme (Le_Forgeron) - Sunday, 14 August 2011, 20:07 GMT

I think I found something, in ShootingDirection::compute() (photons.cpp)

The code computes the radius of the bounding box, and then use the cone from the lighsource to the disc of same radius at the center of the bounding box.

Issue: the sphere at the center of the bounding is larger than the cone (part of the sphere is out of the cone). This comes especially stronger when the light source is inside the sphere!

This explains the round corner of shadow with the demo scene. (still that old story of apparent radius)

	light   dist         ctr
	* ------------------ +
	     ---___          |
	           ---___    | rad

It should be something like:

	light   dist         ctr
	* ------------------ +
	     ---___         /|
	           ---___  / | rad
Comment by Grimbert Jérôme (Le_Forgeron) - Monday, 15 August 2011, 07:31 GMT

Corrected with #5470 for 3.7 line of release, as long as the lightsource is not inside the bounding sphere.
The radius computation performed by ShootingDirection::compute() in photons.cpp is adjusted as : rad /= sin(acos(rad/dist)); (as long as rad < dist)

The issue of rad >= dist (before the adjustement) would need a redesign to not use a shooting cone...

Comment by Christoph Lipka (clipka) - Thursday, 25 August 2011, 12:09 GMT
  • Field changed: Task Type (Possible Bug → Definite Bug)
  • Field changed: Percent Complete (0% → 100%)
  • Task assigned to Christoph Lipka (clipka)

change #5479 should address all remaining issues.

Comment by Grimbert Jérôme (Le_Forgeron) - Thursday, 25 August 2011, 12:37 GMT

Agreed, #5479 is far better and answers all considered issues.