FlightGear Newsletter April 2014: Difference between revisions

Jump to navigation Jump to search
No edit summary
Line 165: Line 165:
Continue reading at [[Object oriented programming in Nasal]]...
Continue reading at [[Object oriented programming in Nasal]]...


===Orbital Rendering:Earthview ===
=== Orbital Rendering:Earthview ===
{{Conversational}}
<pre>
I have just pushed a first version of the Earthview orbital rendering engine. The textures for the planet are based on the NASA Visible Earth collection


http://visibleearth.nasa.gov
Earthview is an orbital rendering engine for Flightgear designed to get credible visuals when using spacecraft such as Vostok-1. It is based on projecting a simple textured sphere representing Earth into the scene using ray optics. Since there's only a single object in the field of view, performance is generally very good provided that there's enough texture memory available.


As far as I understand the terms of use which allow re-use, re-distribution and commercial use, this should be fine with GPL.
Textures are taken from the NASA Visible Earth project - at the highest resolution level, Earth can be rendered at 32768x65536 pixel (about 500 m per pixel) and clouds with half of that. Currently there is a much lower texture resolution distributed via GIT, a mode to make the GB-sized hires textures has yet to be determined.
To see the blue planet from high up, start FG using the ufo at a high altitude (around 10 million ft is quite good with the texture resolution provided), open the (currently minimalistic) GUI from the View menu, push start, wait for the textures to load and admire the view.


Space is grey up there because this is outside of the skydome, and the overall background color is defined fog-grey. As far as I understand, this is legacy code coming from a time when FG unloaded the skydome in poor visibility to get a few percent more performance out. We don't actually have to do this these days and if you want space black, there is a way. To quote Lauri who figured this out:
Combined with the ALS shader to render the atmosphere, visuals are generally rather compelling.


If you want to try to change the clear color to black, you must edit
[[File:Earthview for low Earth orbit.jpg|450px|Low orbit]] [[File:Earthview hig altitude.jpg|450px|High orbit]]
flightgear/src/Main/renderer.cxx around line  700. There are two
instances of following:
camera->setClearColor(toOsg(clearColor));
which should be changed to
camera->setClearColor(osg::Vec4(0.0, 0.0, 0.0, 0.0));


Without this, only a rim around Earth is rendered in proper colors.
A dedicated set of shaders for Earth and the cloudsphere is used to create additional effects such a enhanced specular water reflections, cloud shadows and dawnlight color changes:


Earthview responds to the weather visibility setting and typically 80-140 km visibility work best (won't affect any scenery loading because we're too far from the planet). Also, rendering in ALS manually tweaking Rayleigh and Mie constants gives a nice atmosphere effect.


NASA provides textures in /much/ higher resolution - in my highest resolution texture set I have the planet covered in 32768x16384 and the cloud layer in half of that. For such large textures, loading time is an issue (Earthview isn't excatly *cough* elegant) and pre-mipmapped compressed DDS is pretty much the only sane option - then that's 8 texture chunks a 176 MB each. It'd be nice to make higher resolution versions available for download, but I realize that's quite a bandwidth hog - if there's sufficient interest and someone knows a server... the textures are there.
[[File:Earthview cloud shadows.jpg|450px|Cloud shadows in Earthview]] [[File:Earthview specular water reflections.jpg|450px|Specular water reflections and cloud shadows in Earthview]]


Provided you have the texture memory, performance should actually be pretty high - there's just two textured spheres in the scene, and even on my old computer I get a solid 60 fps.
A long standing problem in Flightgear's atmosphere definition has now been addressed and JSBSim spacecraft should now be able to reach any orbital altitude within their capabilities (previously flight was restricted to be below 150 km altitude).


Enjoy!
* Thorsten
</pre>
=== FlightGear/Oculus Rift Experiments ===
=== FlightGear/Oculus Rift Experiments ===


1,360

edits

Navigation menu