Photon mapping: rpict fatal - command line error at -ap

Hello all,

I am testing a simple room using photon mapping.
I had been able to use mkpmap (with global photons 10k and caustic photons 50k) to generate .cpm and .gpm, and to use rpict to generate .hdr last week.
However, today I repeated this process with a different room model, and during photon mapping it comes with a rpict error. Then I rerun the photon mapping process with the old model, which is the one I used last week without any problems, it comes with the same error message:

I repeated the process with the same model in DIVA, in which global photons are 20k and caustic photons are 200k, and DIVA generated a .hdr file without error.
Radiance version: Radiance 5.4a
The light source is sunlight.

I am wondering the reason behind it and what is the best way to fix the error in the command line.

Any inputs will be appreciated!

Update: in terms of photon mapping in DIVA, I didn’t find.cpm and .gpm files, or any files recording photon mapping process in the temp folder, so I am not sure if it works well even though an .hdr image generated.

It seems like something is going wrong in the Windows compilation of the photon map options processing. My first guess is that something changed in how or where the atoi() stdlib function is defined, but I have no way to know. Perhaps @Mingbo could investigate this for us. (The atoi() call is used in many places, but I’m looking at its use in src/rt/pmapopt.c in particular.) I’m not sure what else would cause this issue. It doesn’t happen on my Unix version, and I don’t have access to a Windows machine, nor do I know how the github build machine is configured.

-Greg

1 Like

Thank you for the reply!
Last week when I did the first run I accidentally saved the output files in the Radiance binary folder. Although later on I moved them out, I am not sure if some issue may be triggered by this action. I will try to reinstall Radiance to see if it helps :slight_smile:

Sounds unlikely, but worth a try in case you are not accessing version 5.4a after all, but something earlier.

@Greg_Ward you are right. I reinstalled Radiance 5.4a and then Radiance 5.3, the error remains:

Hi Deedee, hi Greg,

I hope had a good start to the new year. All the best and let’s hope for a better one.

I think I fixed a bug in the bias compensation parameter parsing several weeks ago, which should have been checked in. I’ll look into it by monday and let you know. Greg, do the current unit tests also cover bias compensation?

Best regards,

–Roland

1 Like

Hi Roland,

The current unit tests use rad to run mkpmap and rpict, which only passes two arguments to -ap, so is not using bias compensation. I don’t even have a way to specify bias compensation in rad, although it looks like it would be easy to add as another (optional) argument to PGMAP and PCMAP variables.

How does bias compensation work? I see that it specifies and min and max bandwidth, but I’m not sure what that does during rendering. Is it explained, somewhere?

Happy to be out of 2020!
-Greg

P.S. Correction to the above – two arguments are supported for bias compensation in rad; it just isn’t documented. Will fix the man page.

Another postscript. Is it possible that changes you made since August to the photon-mapping routines might have (slightly) increased the brightness of the results? I seem to be getting above-threshold differences in my photon-mapping unit test.

Hi Greg,

I’ll check the revisions from August, although I don’t remember making any changes to the density estimation code itself.

Bias compensation is documented – albeit briefly – in section 3.2.2 of the PDF manual, and also in the rpict manpage. Basically a statistically “optimal” bandwidth is chosen between the specified minimum and maximum.

“Optimal” is relative here in the sense that it minimises bias at the expense of noise. Bias (which is unknown without the actual solution on hand) is estimated using the central limit theorem. I published the details and rationale behind the approach in a 2003 paper in Computer Graphics Forum.

I agree though, that the section in the PDF manual could be extended, though my original intent was to omit superfluous details.

Hope this helps. Will keep you posted,

–Roland

Hi Roland, Hi Greg,

Thank you so much for your quick feedback!
Happy New Year :slight_smile: Hope 2021 is better than 2020

I tried to run under DIVA\Radiance (an older version Radiance), the error still remains:

Given that yesterday there was .hdr generated from the photon mapping function via DIVA4Rhino toolbar, I am unsure if it went correctly.
Below is a comparison between an hdr image without photon mapping(left) and an hdr image with photon-mapping(right). Both are from DIVA4Rhino.It seems the right image has some blurring on the walls and may be caused by high bandwidth.

However, DIVA doesn’t help a lot regarding this issue since it is crashed when the view direction is facing downward, so I expect to directly work with Radiance if possible.
Unfortunately, I don’t have a Mac or Linux on my side. I will try to ask someone to help to test it on a Mac.

The last question I have is that is there a way in the command line to automatically run rpict once mkpmap is finished?
I tried something below, but it seems not to work in this way:


Does Radiance include arguments to execute two or more programs one by one automatically, or I should create external scripts to do that (if so, I can work with Python)?

Unfortunately, I have limited experience with Radiance and I am new to photon mapping.

Many thanks for all the inputs!

  • Di

Did you try running rpict using a single sampling parameter (rather than two) with the -ap option? Does this run without generating an error? If so, then perhaps you are somehow accessing and older version of rpict that does not support the new parameter. What does “rpict -version” give you?

The “rad” program I mentioned earlier may be used to control the photon mapping and rendering process. Or, you can create a batch file or script using whatever interpreter you like. Radiance is designed to be programmable in this way.

Hi Deedee,

if you specify multiple commands on the command line (mkpmap and rpict in this case), you have to separate them with a semicolon ( ; ) or double ampersand (&&), the latter of which is preferable as it will only run rpict if mkpmap succeeds.

Also, bias compensation on global photons doesn’t really make sense with -ab 1, as the ambient bounce effectively filters the high frequency components that bias compensation attempts to preserve in the global photon map. I suspect the patches you get in your HDRs may be sporadic noise introduced by bias compensation in the ambient component. This is acceptable in (typically) high-frequency caustics, but objectionable in low frequency diffuse illumination. I would therefore only use bias compensation with your caustic photon map, and a fixed bandwidth for the global one.

Bias compensation in conjunction with global photons really only makes sense if visualising them directly with -ab -1. But this combination is typically used for debugging, as it shows you the raw global photon distribution; the quality will usually be too low unless you use a very large number of global photons.

Hope this helps rather than confuses. The fact is that RADIANCE tolerates many parameter combinations, including some that don’t (or rarely) make sense. :wink:

–Roland

2 Likes

Hi Greg,

Thanks for your suggestions!

If I understand correctly, I tried running rpict only for globalpmap, and the error remains as shown below:

Regarding rpict version, for the two versions of Radiance that I have:

  • Radiance 5.3
    C:\Radiance>rpict -version
    RADIANCE 4.1a lastmod Tue Nov 09 13:21:50 2010 by ajakubiec on PDA-JAKUBIEC
  • Radiance 5.4a
    C:\Radiance>rpict -version
    RADIANCE 4.1a lastmod Tue Nov 09 13:21:50 2010 by ajakubiec on PDA-JAKUBIEC

When I installed the above versions of Radiance, there was a message popping out:

Does it mean it isn’t installed correctly?

Thank you!

Yes, this clearly indicates that you are accessing an older version of Radiance when you think you are using 5.4a. This explains the error message, since bias compensation was only introduced by @Dr_Roland_Schregle recently.

The pop-up error message even indicates the problem. I don’t know what is needed to reduce the length of your PATH variable or what the limit is under Windows, so we’ll have to see if anyone else can help you with that.

1 Like

Thanks for sorting this out, Greg. I wasn’t able to reproduce the error with the current pmap parsing code in the CVS, so I concur Deedee is using a version that didn’t support pmap yet.

As for the deviation in the HDR lighting levels, I checked the density estimate code, and the last (significant) changes there are at least 2 years old. I’ll look into this again a bit deeper and rerun the tests. We should maybe consider adding a test for bias compensation, though it is a rarely used option. Perhaps one of the tests from the CGF paper might come in handy.

Best regards,

–Roland

1 Like

Hi Greg,

Thank you!
I will try to install rpict with a proper version and test again.
I am curious about why in the first time, which is also the only time, rpict run without producing errorl? Would you mind to direct me to find which version of rpict is currently used?
My questions are so basic :sweat_smile: I really appreciate your time and great support!

Hi Roland,

Thank you for your input and the test! They are great information for me and I will definitely adjust my runs according to your suggestions once I solve the error :sweat_smile:

Roland,

I did just add a bias compensation test to the suite by adjusting the photon-mapping test already in there. I wouldn’t worry too much about the over-threshold difference in the new results. Assuming nothing is really wrong, I simply updated the reference output to match the HEAD results.

Hi Greg,

if it’s noise we shouldn’t be too concerned, unless it’s really bias – then we’d have a problem.

Have a good 1st week in the new year everyone,

–Roland

Hi Greg, Hi Roland,

Thanks for your consistent help to identify the problem! I really appreciate :slightly_smiling_face:

Finally, the error is solved by running Radiance, including rpict from 2015, in a different Windows laptop.
image
(the first error in the below screenshot may be because I didn’t save all input files(.vf, .oct, .cpm, .gpm) directly under Radiance. Instead, I saved them into a subfolder under Radiance. I am not super sure if this is the reason but after I removed them out the error is disappeared)

This is a screenshot of the downwards hdr generated:

However, I haven’t figured how to install Radiance properly in the previous laptop. The previous laptop is a refurbished one, and it may have some system deficiency. I am wondering if there were any cases before regarding the improper installation of Radiance caused by a refurbished laptop. If this is the case I will consider to get a better laptop :smiley:

But at least it runs for now, for the next step I will try to adjust the bias compensation.