Spectral scene for pbrt

378 views
Skip to first unread message

krupi...@gmail.com

unread,
Mar 26, 2019, 5:08:40 PM3/26/19
to pbrt
Hi! Im trying to create a simple spectral raytracer and have pbrt as a reference as a beginning. I still not very familiar with spectral rendering. I mean I understand more or less different aspects of spectral rendering - we haven't rgb but we have SPD and we have different rays based on wavelength (i hope i understand this :) ), but I can't find any true spectral scenes for pbrt.

Also second small question. How people create that scenes? Is it very hardcore and only guys like Weta digital do this?

Thanks!

Regards, Nikita.

Trevor Black

unread,
Mar 26, 2019, 7:57:42 PM3/26/19
to pbrt

I'm going to jump into the ring here since I just spent an extremely long time on a similar endeavor, see:



You should go and download the additional scenes for pbrt if you haven't already:


Once you have that locally, navigate to
pbrt-v3-scenes/spds

which holds the Spectral Power Distributions (S P D-s)
As an example, look to metals/Au.eta.spd which holds the spectral information for Gold

It looks like this:
298.757050 1.795000
302.400421 1.812000
306.133759 1.822625
309.960449 1.830000
313.884003 1.837125
317.908142 1.840000
322.036835 1.834250
326.274139 1.824000
330.624481 1.812000
335.092377 1.798000
339.682678 1.782000
344.400482 1.766000
349.251221 1.752500
...

In all of the .spd files in the scene folder the syntax is pretty simple:
  • # is for comments
  • the left column is a wavelength (in nm)
  • the right is a power value.

This defines the spectral information for a single "color" (note the quotation marks).
This spd file can be used anywhere that a color would typically be used in a .pbrt file

e.g. to create a point light at the origin with a yellow-ish white color, you could do:

LightSource "point" "Color I" [10 10 8]

OR, taking advantage of excess spectral information:

LightSource "point" "Spectrum L" "Fluorescent-Light.spd"


NOTE: I've only told you how to define a single color as a spectral density. And, they are relatively easy to manufacture, again, left side wavelength, right side power.

However, to the best of my research there does not exist a standardized means of producing a texture using spectral information. By which I mean that jpg has RGB channels, png has RGBA channels, but I was unable to find a photo format that had (e.g.) 100-200-300-400-500-600-700nm wavelength channels.
Ideally you'd be able to define what the wavelengths for all texels would be at the top of the file.
You could probably have some fun hacking one together.

But--and this is a problem for both film and games--the majority of asset tools are RGB (and many still use 8 bit RGB), so I don't know of any asset creation tools that will let you spit out spectral info. So, ultimately, most dense spectral information you have will be from YOUR choice of using a .spd in your scene.

Typically, a scene will only use a .spd for the scene lighting, and, often, that can be reduced to tristimulus color (RGB) with little to no radiometric distortion (the rgb value and spd value look similar). With extremely notable (and storied!) exception of fluorescent lights because they have spurious spds.

Subsurface scattering in general, and skin in particular, can be high spectral specificifity when it comes to reflection and refraction, so if you intend to render humans a complete spectral renderer can be a notable win.

It's worth pointing out that rendering humans is NOT the specific reason that Weta decided to use spectral rendering.

In terms of how production renderers use spectral rendering (or don't) look to the ACM Special Issue on Production Rendering (warning: paywall)


which was curated and edited by one Matt Pharr care of Nvidia ;)

Lastly, and sorry for going on too long. My recommendation is that you just attempt exercise 5.2 in the book. It's why it's there. I learned a shocking amount just ripping apart the Spectrum classes.


For possible directions see:



Wilie et al. Hero Wavelength Spectral Sampling 2014

Nikita Krupitskas

unread,
Apr 1, 2019, 5:39:39 AM4/1/19
to pb...@googlegroups.com
Hi Trevor! Thanks for that large and awesome response! It's really very great. So you aborted your attempt because you think that spectral representation is not very comfortable to work with?
Also, I have a huge amount of questions, is it a proper place to ask them? I mean questions about spectral rendering.

ср, 27 мар. 2019 г. в 02:57, Trevor Black <trevorda...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "pbrt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pbrt+uns...@googlegroups.com.
To post to this group, send email to pb...@googlegroups.com.
Visit this group at https://groups.google.com/group/pbrt.
For more options, visit https://groups.google.com/d/optout.

Wenzel Jakob

unread,
Apr 1, 2019, 5:45:07 AM4/1/19
to pb...@googlegroups.com
Hi Nikita,

this is a reasonable place to ask your questions :). Also, here are some other resources that you may find useful, mainly for generating spectral content:


This paper comes with a database of measured materials, for which spectral information is available. There is a header file implementation of the plugin that is easily adapted to PBRT.


This is a heuristic method for generating spectral curves with a specific RGB value (essentially what you would need to use a “legacy” RGB texture in a spectral renderer).
A number of other methods for tackling this problem also exist (they are cited in the prior works section).

Best,
Wenzel

Haarm-Pieter Duiker

unread,
Apr 2, 2019, 2:04:14 AM4/2/19
to pb...@googlegroups.com
Here are a couple of example scenes using spds
for material inputs. This is really just demonstrating syntax. Nothing too interesting wrt actual rendering going on, but maybe that's helpful.

The corresponding rendered images are here:

Those scenes were created using the PBRTForMaya plugin, from the above linked repo. The source Maya scenes are here:

This assumes that you have .spd files to use already. The pbrt example scenes are a great starting point for that.

Trevor: Mitsuba has support for rendering out EXRs with different channels set to represent different spectral wavelengths. Thanks Wenzel! Would be great to see the same functionality supported in PBRT.

HP






Nikita Krupitskas

unread,
Apr 2, 2019, 5:34:13 AM4/2/19
to pb...@googlegroups.com
Haarm-Pieter Duiker, thanks for that info! I've opened this two .exr in renderdoc, but both of them have some weird highlights. Trying attach png.
So I'm curious why it isn't mainstream? Like we have lot of materials; Spectral rendering allows us to get more accurate picture and get some new light effects like diffraction, dispersion, interference, iridescence, or chromatic extinction and Rayleigh scattering in participating media. Is it just because of development complexity? Like uber complex scenes are complex and spd give even more complexity? :) 

вт, 2 апр. 2019 г. в 09:04, Haarm-Pieter Duiker <li...@duikerresearch.com>:
issues.png

Trevor Black

unread,
Apr 2, 2019, 12:39:36 PM4/2/19
to pbrt
I didn't make the reason I stopped working on my spectral renderer clear.

What I was attempting to do was let PBRT determine at runtime what type of spectrum to use.
The goal was to define in the .pbrt file what kind of spectrum e.g.:
Spectrum "SampledSpectrum" "Wavelengths" 300 700 "Samples" 60

PBRT is top-to-bottom designed with compile-time spectrum resolution.

Trying to get runtime spectrum resolution was difficult, but rewarding, until it stopped being both.
But, pushing through adversity is a virtue, so I would have pushed through and completed it, if not for,
well, there doesn't exist a lot of prior art where people would resolve spectrum specifics at runtime.

And, more to the point, entire scenes and possibly entire movies will be created with a single characteristic spectrum resolution (rather than single frames).
So, It's always worth killing some time and locking down the spectrum resolution at compile time, than losing 20-40% performance (due to virtual tables) for a flexibility that you're not like to use.

That's when I dropped the project.

@Nikita

The photos he posted have the same highlights. If I had to guess, they're probably fireflies.

Why isn't it mainstream?
It isn't mainstream because it isn't mainstream.
Artists just aren't familiar with spectral rendering.
Artists don't often deal with wavelength and spectral power, rather they tend to deal with hue, saturation, and brightness.
Hue, saturation, and brightness are 3 dimensional coordinates, so there does not exist a 1-1 correspondence between these qualities and power spectrum.
If an artist wants to increase the brightness of a spectrum, but hold the saturation and hue constant, there isn't a "correct" way to do this.
Likewise for any configuration.
Any manipulation in the HSB space would require:
Spectrum -> XYZ -> HSB <-> HSB (manipulation) -> XYZ -> Spectrum
where every -> step is one-way and information is lost.

It's definitely possible to generate tools that work with spectral power, but it would require the artists to learn a very different way of interacting with color.

Trevor

To unsubscribe from this group and stop receiving emails from it, send an email to pb...@googlegroups.com.

To post to this group, send email to pb...@googlegroups.com.
Visit this group at https://groups.google.com/group/pbrt.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "pbrt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pb...@googlegroups.com.

To post to this group, send email to pb...@googlegroups.com.
Visit this group at https://groups.google.com/group/pbrt.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "pbrt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pb...@googlegroups.com.

To post to this group, send email to pb...@googlegroups.com.
Visit this group at https://groups.google.com/group/pbrt.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "pbrt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pb...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages