Re: [Flightgear-devel] Moonlight reloaded
I suspect the difference in light intensity (dynamic range) doesn't fit in an 8-bit 3-component color. It sure doesn't, but I think you're thinking way too complex. We don't want to render physical light intensity, we want to render perceived light intensity, and there the Weber Fechner law is relevant, and that says that we roughly want to render the log of the physical light intensity. For instenace, full daylight has 10,000 lux, and a very dark overcast day has 100 lux - yet if you multiply the sun (rgb) = (1,1,1) which works fine for a sunny day with 0.01, you don't get an overcast day - 0.6 is more the factor you need, i.e. every factor 10 reduction in luminous flux is about -0.2 from the base light. A full moon has about 0.1 - 1 lux, so we get (rgb) values of ~(0.1..0.2) in the light vector - which works visually just fine (I've been using vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight * scattering; for the pics) - which gives imo a decent visual appearance. For the same reason, I don't see why we shouldn't be able to render sun glare with 8bit colors. All it takes is to store the light intensity in a separate variable and post-process the rgb output with a light-intensity dependent filter. My problem is not coming up with the filter, my problem is rather to determine if I should be blinded by the sun or if it's obscured by a panel. Btw. - I noticed that yesterday - are we by any chance doing any rendering tricks at night? Immediately after dusk, the moonlight renders fine, but after a while when it gets really dark, it suddenly snaps to a circle of illumination around me and everything else is pitch black. Is there any old code assigning a trivial ambient and diffuse material to faraway scenery to speed up rendering hidden somewhere, or should I look for a very exotic shader bug? Cheers, * Thorsten -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Moonlight reloaded
On Sun, Nov 11, 2012 at 1:41 PM, Renk Thorsten thorsten.i.r...@jyu.fiwrote: I suspect the difference in light intensity (dynamic range) doesn't fit in an 8-bit 3-component color. It sure doesn't, but I think you're thinking way too complex. We don't want to render physical light intensity, we want to render perceived light intensity, and there the Weber Fechner law is relevant, and that says that we roughly want to render the log of the physical light intensity. For instenace, full daylight has 10,000 lux, and a very dark overcast day has 100 lux - yet if you multiply the sun (rgb) = (1,1,1) which works fine for a sunny day with 0.01, you don't get an overcast day - 0.6 is more the factor you need, i.e. every factor 10 reduction in luminous flux is about -0.2 from the base light. A full moon has about 0.1 - 1 lux, so we get (rgb) values of ~(0.1..0.2) in the light vector - which works visually just fine (I've been using vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight * scattering; for the pics) - which gives imo a decent visual appearance. You need to do High Dynamic Range rendering to accurately capture these differences and the eye's ability to adapt to them. Basically, you do all the rendering in floating point and at the end convert the values to RGB colors with a mapping operator. We don't do that yet. Tim -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Moonlight reloaded
You need to do High Dynamic Range rendering to accurately capture these differences and the eye's ability to adapt to them. Basically, you do all the rendering in floating point and at the end convert the values to RGB colors with a mapping operator. We don't do that yet. I'm currently rendering scenes illuminated between 10.000 lux and 0.1 lux (i.e. a range of 100.000 in luminous flux) just fine without High Dynamic Range. I'm entirely happy with the visual impression of light reduction under overcast skies or with self-shading of fog. The trick is that I do the log before rendering, High Dynamic Range does it after rendering. I can do so, because my scene is dominated by a single light source which is either sun or moon, so I never need to compare the strength of different light sources. I'm not happy with high light intensity situations like looking directly into the sun, but that's because I haven't done it, not that I couldn't do it - I have the scheme worked out, but since I don't know when I'm looking into the sun, I can't implement it. We're not trying to solve the general problem, so we don't need the general solution to get the job done. We just need a particular solution for a particular job which covers 99% of the situations you can encounter in flight, and that happens to be way cheaper. Also, note that High Dynamic Range isn't accurate either - beyond Weber Fechner, the details of light perception happen to be really messy and once we are in simulating the details of the visual cortex, adding higher accuracy doesn't really help you :-) * Thorsten -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Moonlight reloaded
If you need any information about the moon's position and/or phase, just let me know. It should be trivial to extract these values from the ephemeris code. Thanks, that was what I was hoping for :-) It depends a bit on if Fred wants to do anything with the moon - my scheme would be fine with the angle of the moon above the horizon and the moon phase (or, as Curt explained, equivalently the relative angle between sun and moon) as properties. I think I have a brightness curve of moonlight as a function of phase somewhere, so from there I'd be good. However, if we want directional moonlight in Rembrandt, then I guess the info has to flow to the shader in a more direct way (like gl_LightSource[1].position) - in which case I'd use it from there. * Thorsten -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Moonlight reloaded
Hi Thorsten, De: Renk Thorsten thorsten.i.r...@jyu.fi À: FlightGear developers discussions flightgear-devel@lists.sourceforge.net Envoyé: Samedi 10 Novembre 2012 13:34:30 Objet: Re: [Flightgear-devel] Moonlight reloaded If you need any information about the moon's position and/or phase, just let me know. It should be trivial to extract these values from the ephemeris code. Thanks, that was what I was hoping for :-) It depends a bit on if Fred wants to do anything with the moon - my scheme would be fine with the angle of the moon above the horizon and the moon phase (or, as Curt explained, equivalently the relative angle between sun and moon) as properties. I think I have a brightness curve of moonlight as a function of phase somewhere, so from there I'd be good. However, if we want directional moonlight in Rembrandt, then I guess the info has to flow to the shader in a more direct way (like gl_LightSource[1].position) - in which case I'd use it from there. Don't wait for me. Anyway, sun direction and colors are given to shader via normal uniforms that are updated here (in Rembrandt mode only) : http://gitorious.org/fg/flightgear/blobs/next/src/Viewer/renderer.cxx#line1570 Moon equivalent should go the same way. I just don't have an idea on own to balance sun light and moon light without knowing the time of day or having test on the light direction. I suspect the difference in light intensity (dynamic range) doesn't fit in an 8-bit 3-component color. I was also thinking about replacing sun values by the one from the moon during night in the C++ code, without telling to the shaders. I didn't ponder on the cons of that approach thought. Regards, -Fred -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Moonlight reloaded
Interesting, looks good. So effectively it glows... On Fri, Nov 9, 2012 at 9:19 PM, Renk Thorsten thorsten.i.r...@jyu.fiwrote: I was toying with this for a while, but now I have a reasonably cheap solution to render moonlight effects: http://www.flightgear.org/forums/viewtopic.php?f=47t=14755start=195#p170250 Now, all I need is the info about the current moon phase and if the moon is above the horizon which is *somewhere* to set the moonlight strength paramater, and we're good to go. Anyone knows how to get at this info? Cheers, * Thorsten -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Moonlight reloaded
On Fri, 9 Nov 2012 10:49:30 +, Renk wrote in message e495a106ff5f31448739e79d34138c191e161...@mbs1.ad.jyu.fi: I was toying with this for a while, but now I have a reasonably cheap solution to render moonlight effects: http://www.flightgear.org/forums/viewtopic.php?f=47t=14755start=195#p170250 Now, all I need is the info about the current moon phase and if the moon is above the horizon which is *somewhere* to set the moonlight strength paramater, and we're good to go. Anyone knows how to get at this info? ..chk down $YOUR.GIT-ROOT/simgear/simgear/ephemeris Disclaimer: my tree was last updated Feb 21'st. -- ..med vennlig hilsen = with Kind Regards from Arnt Karlsen ...with a number of polar bear hunters in his ancestry... Scenarios always come in sets of three: best case, worst case, and just in case. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Moonlight reloaded
Interesting, looks good. So effectively it glows... Not really - unlike glowing stuff, it is actually obscured by cloud cover for instance. * Thorsten -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Moonlight reloaded
Just a quick note for now, because I've got a lecture coming up in about 30 minutes... If you need any information about the moon's position and/or phase, just let me know. It should be trivial to extract these values from the ephemeris code. Cheers, Durk On 09 Nov 2012, at 13:25, Renk Thorsten wrote: Interesting, looks good. So effectively it glows... Not really - unlike glowing stuff, it is actually obscured by cloud cover for instance. * Thorsten -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Moonlight reloaded
Hi Thorsten, One more tidbit of info on phase of the moon. The phase of the moon is proportional to the relative location of the sun and the moon in the sky; more specifically the angle between them. For example, a full moon will be rising precisely when the sun is setting -- in this case they are nearly 180 degrees opposite in the sky and you see the entire reflection of the sun light off the moon. When the moon is straight up in the sky at the same time the sun is setting, it will be a 1/2 moon. When the moon is almost in the same place in the sky as the sun (near zero degrees) then you either don't see the moon, or you may see an extremely thin sliver. You may recall seeing a very thin sliver of moon just above the horizon right after sunset -- the sun and moon are very close together in the sky and it's really hard to see the moon until the sun drops below the horizon. FlightGear positions the sun and moon in their correct 'relative' positions in the sky, and then we illuminate the moon sphere from the sun, and that automatically gives us the correct phase/orientation of the moon in the sky visually. So that's a pretty cool way to get the correct moon in the sky (I think), we don't do anything fancy, just copy nature's design. :-) I don't know off hand if the direction (vectors) of sun moon illumination are available in the property tree. But if they were or could be made available, then your task is simply to compute the angle between these two vectors. That angle is proportional to the amount of the moon that is visibly illuminated to us. 180 degrees = full moon, 90 degrees = 1/2 moon, 0 degrees = no moon. Of course these values are rarely 180 or 0 degrees exactly -- that would correspond to an eclipse which so far has been beyond the scope of our rendering methods to properly display. But now with Rembrandt maybe we can begin to cast the earth's shadow onto the moon? What do you think Fred? :-) Curt. On Fri, Nov 9, 2012 at 7:08 AM, Durk Talsma wrote: Just a quick note for now, because I've got a lecture coming up in about 30 minutes... If you need any information about the moon's position and/or phase, just let me know. It should be trivial to extract these values from the ephemeris code. Cheers, Durk On 09 Nov 2012, at 13:25, Renk Thorsten wrote: Interesting, looks good. So effectively it glows... Not really - unlike glowing stuff, it is actually obscured by cloud cover for instance. * Thorsten -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel -- Curtis Olson: http://www.atiak.com - http://aem.umn.edu/~uav/ http://www.flightgear.org - http://gallinazo.flightgear.org -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Re: [Flightgear-devel] Moonlight reloaded
Hi Curt, But now with Rembrandt maybe we can begin to cast the earth's shadow onto the moon? What do you think Fred? :-) It should be just a matter of rendering two spheres inside an FBO and using the resulting shadow map when rendering the moon sphere to show moon eclipses, or altering the sun light with a shadow map lookup to render sun eclipses. Regards, -Fred -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel