Open whitequill opened 4 years ago
I have tried to replicate this with a new scene (created in Blender 2.82 with Lux v2.3beta2): spectrum_test.zip
(1300 samples)
The result contains cyan, but compared to your reference image, it contains much less green, more yellow and some violet.
However, to do an actual check if the LuxCore result is correct or not, I think we need better reference material than a photo made with an unkown camera, light source, glass material, color transforms etc.
There might really be a problem with the WaveLength2IOR()
and WaveLength2RGB()
functions, but it could also be caused by some settings in the "RainbowColorsAndPrism" scene or in my testscene.
A good reference to this is on Minute Physics. https://www.youtube.com/watch?v=LKnqECcg6Gw
LuxCore works in linear color space, so this video isn't really related here (Lux will give you the right result when you mix two colors).
tl;dr - rainbows are cheap. make one and take a picture. :)
It looks significantly better. I completely agree you'd need better reference material to really get the colors right. You could probably get a full spectrum light, a prism and a white sheet of paper for reference. I really like how much its been improved. Or go outside with the prism and paper and the sun.
If you don't take a picture I'll take one when its a little warmer in a few weeks and I can post it here. I do realize it would take some setup sorry for being a little snarky.
this year has been crazy as we all know. I've still been thinking about this, just not had time between the pandemic and everything else.
While investigating another scene this weekend, I came to an understanding of the underlying mechanism for the incorrect prism colors.
The cause lies in the current Dispersion implementation. In this line, the wavelength is sampled based on the random value u0. Because new random values are chosen after every intersection, a ray may be assigned different wavelengths at the first and second surface of the glass, thus refracting each time with different refractive indices.
The most significant problem then is caused by the extreme ends of the spectrum: Purple, which is refracted most strongly, contains both red and blue RGB components. At the second surface, it may refract strongly again if a purple wavelength is again drawn, or weakly if a red wavelength is drawn. This will create a second red beam that will be directed more towards green or other end of the blue spectum.
I created another prism scene with a small laser to create a narrow spectrum with less overlap of the colors than in the examples shown previously. You can clearly see that two purple regions form as a result of the second red beam:
The situation can be "worked around" for demonstration by changing this line to r = 0.0f, giving the following result:
There will also be a third red beam from the inverse case (red at the first surface and pruple at the second)
Technically, this will also happen at all wavelengths, but only with similar wavelengths, smearing out everything a little. Red and Purple are just the wrap-around at the extreme ends und thus most prominent.
The only solution while retaining violet would be to make the wavelength fixed per sample, not random per ray iteration.
Still an issue I see! https://github.com/LuxCoreRender/BlendLuxCore/issues/926 I thought I was the first to notice it!
It's a pitty the fix gets rid of the violet. =(
System Information
Operating system and graphics card Windows 10 Professional 18362 GeForce GTX 1080
Software Version
Error message from Blender console
none
Short description of error
This is a spectrum. The spectrum from LuxCore is wrong. Where is cyan? Why is there violet between green and blue? Is this a color averaging RGB error?
A good reference to this is on Minute Physics. https://www.youtube.com/watch?v=LKnqECcg6Gw
Exact steps for others to reproduce the error
Rainbow and Colors prism downloaded from the LuxCoreRender downloads page.
This is with CPU rendering. Thank you for supporting the development!