Is it possible to get the sun color from the sky material somehow?
I’m trying to match the diffuse color of a directional shadow caster light (the Sun) with the sky material sun color (i.e. warm golden light at sunrise and sunset versus cool white light at noon) so I can create dynamic “time of day” lighting and shadow simulations.
Line 21 - I report the sphere’s reflectionProbe._renderTargetTexture to console… but just once… and it’s mostly black at that time.
In real time, and using Cedric’s interesting idea, Integra will probably want to sample some pixel colors about… what? Every 5 minutes? (dependent upon many factors). Interesting.
BJS.Tools.createCCDchip() (Same as RTT/imageBuffer-work, you say? yeah, I guess so).
I tried Cedrics approach to color the scene fog. Used a small reflection probe, actually 4 pixels should be fine, too. Sometimes the fog lights up though.
var rp = new ReflectionProbe("skyReflection", 16, scene)
rp.renderList.push(skyBox);
pixels = rp.cubeTexture.readPixels(0,0)
// i take the first pixel of the reflection probe texture for fog color.
// since pixels are stored as buffer array, first pixel are first 4 values of array [r,g,b,a....]
scene.fogColor = new Color3(pixels[0]/255, pixels[1]/255, pixels[2]/255)
hope it helps some other people.
Edit: Maybe it is necessary to assign the cubeTexture to some object material in the scene. My reflection probe texture was only updating, when this object was visible. Assigning the cubeTexture to scene.environmentTexture does not seem to be enough.
I am then able to do: scene.environmentTexture = envReflectionProbe.cubeTexture;.
Also remember that this will affect PBRMaterials lighting and their reflections. You may want to tweak material.environmentIntensity (default is 1.0) if, like me, you are mixing PBR and non PBR materials which react differently to light and you had changed it previously.