Extracting temperature corresponding a given RGB value in a blackbody object

173 views
Skip to first unread message

mehdi parvizi mosaed

unread,
Jun 24, 2015, 9:45:27 AM6/24/15
to pb...@googlegroups.com
Hi,
I would like to extract a given temperature corresponding extracted RGB value in PBRT, but I cannot find a suitable algorithm to do this. I found an algorithms like follow:
  1. Integrate Planck's formula against the CIE XYZ colour matching functions (available as part of PBRT in 1nm increments)
  2. Convert from XYZ to linear sRGB (do not perform gamma correction yet)
  3. Render as normal

Here is a small sample of linear sRGB radiance values for different Blackbody temperatures:

1000K: 1.81e-02, 1.56e-04, 1.56e-04
2000K: 1.71e+03, 4.39e+02, 4.39e+02
4000K: 5.23e+05, 3.42e+05, 3.42e+05
8000K: 9.22e+06, 9.65e+06, 9.65e+06
It's clear from the range of values that we need some sort of exposure control and tone-mapping.


I encountered a serious challenge when I was applying the mentioned algorithm. I extracted all RGB values corresponding their temperatures, and made a given lock-up table like above, but it doesn't work at all because some RGB values are out of my range completely. For example, I have a range between 7 and 8 for R value, and my extracted R value is 20. I have implemented various methods like normalizing RGB values or using nearest neighborhood method, but they didn't work too. I will appreciate it if you let me know what I should do to solve this problem.

Best Regards,
Mehdi

Matt Pharr

unread,
Jun 24, 2015, 12:23:33 PM6/24/15
to pb...@googlegroups.com
Basically you're trying to find the blackbody color temperature that most closely matches a given spectral distribution expressed in RGB?

The traditional approach would be to convert RGB to a SPD and then find the blackbody temperature in kelvin that peaks at the same wavelength as your SPD.  Lots more discussion here: https://en.wikipedia.org/?title=Color_temperature.

Thanks,
Matt


--
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 http://groups.google.com/group/pbrt.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages