calculate star colors using Planck's law#6210
calculate star colors using Planck's law#6210sturnclaw merged 6 commits intopioneerspacesim:masterfrom
Conversation
sturnclaw
left a comment
There was a problem hiding this comment.
Two questions:
- Is the table comprised of RGB color values or CIE values? I'm seeing a comment in the source shader indicating these values are actually in the CIE colorspace.
- Have you considered precomputing a table of color values over the expected temperature range for stars (using perhaps an exponential mapping to preserve detail) rather than fully computing the Planck brightness every time the color of the star is requested?
src/galaxy/SystemBody.cpp
Outdated
| vector3d( 0.000002f, 0.000001f, 0.000000f ) // 830 nm | ||
| }; | ||
|
|
||
| Color SystemBody::GetColor() const |
There was a problem hiding this comment.
This should be computed and cached at body creation time, rather than recomputed (potentially) multiple times every single frame. 48 exp()s and 96 pow()s per call is not cheap enough for the current call frequency.
There was a problem hiding this comment.
I don't know where all bodies are created
Calling this method each time after initializing body temperature looks ugly for me
I just copy-pasted it and it seems to be actually RGB: note the red channel between 370 and 500 nm - it has red because this part of spectrum is bluish-purple
Yes, I'll do it soon after fixing step 4 in #6136 |
|
Nice idea I think and I'm interested to see results 👍 |
|
A little visible test done and I think class M stars look a bit too much yellow? Please remember that there are no stars in the sky who look really green for the human eye even when the radiation maximum is at green wavelengths. |
Where did you see green stars? |
|
@Mc-Pain Status? |
Rebased onto master [9de1f0a] Tonight I'll collect the color data from different temperatures by aligning Sol's temperature. |
|
@sturnclaw Do you have this in your "ready to review PRs"-queue? |
|
I do now! |




Small improvement to derive star colors from temperature