Hackathon Proposal: WS3.0 Effects: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 33: | Line 33: | ||
** flightgear/src/Airports/AirportBuilder.cxx | ** flightgear/src/Airports/AirportBuilder.cxx | ||
** add a line to the STG file - [ICAO].icao | ** add a line to the STG file - [ICAO].icao | ||
==Adding Trees== | |||
Details of sub-project to add trees to WS3.0. | |||
===Background=== | |||
* FG has the concept of a Material - how a particular type of land (a landclass) is rendered by the simulator (e.g. texture, Effect, tree density, roughness). | |||
** The materials are defined in a set of XML files in fgdata/Materials. Different regions (defined by lon/lat) can define different materials. So a forest in Norway contains different trees than one in Brazil. | |||
** See fgdata/Docs/README.materials for the XML format information | |||
** See [[Howto:Editing tile textures and materials]] | |||
** See Materials/default/global-summer.xml for a good rundown of the different landclasses. | |||
* The materials are built into a SGMaterialLibrary (simgear/simgear/scene/material/matlib.cxx). | |||
* In the old scenery, the terrain consists of a triangular mesh that describes both the shape (elevation) of the terrain and the landclass of the terrain. Each triangle of the terrain mesh as a single landclass (e.g. "EvergreenBroadCover"). | |||
* In the WS3.0 scenery, the terrain mesh only contains shape (elevation) information. The landclass of the terrain is provided by the texture. Each triangle can contain bits of multiple landclasses. | |||
=== How Trees are grown - old scenery === | |||
Trees are generated in the Old scenery as follows: | |||
# simgear/simgear/scene/tgdb/obj.cxx SGLoadBTG(const std::string& path, const simgear::SGReaderWriterOptions* options) loads a "BTG" file. | |||
## line 113 created a SGTileDetailsCallback. This is a callback that will generate more detail for the tile when the viewpoint gets within range. This avoid having to create trees for tiles that might be 100km away and which we never get any closer to. | |||
## line 118 creates a PagedLOD which will call the FGTileDetailsCallback when the viewer gets within range. | |||
# simgear/simgear/scene/tgdb/SGTileDetailsCallback.hxx readNode(const std::string&, const osgDB::Options*) does the actual work to generate the details for a tile such as forests, random objects, lights, and it called by the PagedLOD object above. | |||
## line 138 calls generateRandomTileObjects to create the forest, buildings and buildings | |||
## generateRandomTileObjects (line 976) builds a set of OSG nodes and makes various calls to generate the random feature based on |
Revision as of 22:36, 14 November 2020
Title: | WS 3.0 Effects
|
Potential mentors: | Stuart |
Intro: | (short intro) |
Interested Parties: | merspieler |
Status: | n/a |
Summary: | n/a |
Background: | Currently we have some of the pieces required for WS3.0:
... but the WS3.0 scenery in FG is basically a dark gray blob. The bit that's missing is having the scenery pick up material definitions and therefore Effects and shaders. This hackathon idea is to apply material definitions to that scenery and perhaps develop a shader that will use the landclass texture to generate some plausible texturing. |
Details: | n/a |
Ideas: | |
Required skills: | C++ |
Learning Opportunities: | * Materials
|
Notes: |
References
|
Useful resources:
- Virtual Planet Builder
- World Scenery 3.0 roadmap
- How the VPB is rendered in FlightGear: https://sourceforge.net/p/flightgear/simgear/ci/cbd8e3acc4eab6724b5be32f64eeeb0530e207ed/
- How trees are created at the moment:
- simgear/scene/tgdb/obj.cxx
- simgear/scene/tgdb/SGTileGeometryBin.cxx
- simgear/scene/tgdb/SGTileDetailsCallback.cxx
- simgear/scene/tgdb/VPBTechnique.cxx
- Runtime Airport building
- flightgear/src/Airports/AirportBuilder.cxx
- add a line to the STG file - [ICAO].icao
Adding Trees
Details of sub-project to add trees to WS3.0.
Background
- FG has the concept of a Material - how a particular type of land (a landclass) is rendered by the simulator (e.g. texture, Effect, tree density, roughness).
- The materials are defined in a set of XML files in fgdata/Materials. Different regions (defined by lon/lat) can define different materials. So a forest in Norway contains different trees than one in Brazil.
- See fgdata/Docs/README.materials for the XML format information
- See Howto:Editing tile textures and materials
- See Materials/default/global-summer.xml for a good rundown of the different landclasses.
- The materials are built into a SGMaterialLibrary (simgear/simgear/scene/material/matlib.cxx).
- In the old scenery, the terrain consists of a triangular mesh that describes both the shape (elevation) of the terrain and the landclass of the terrain. Each triangle of the terrain mesh as a single landclass (e.g. "EvergreenBroadCover").
- In the WS3.0 scenery, the terrain mesh only contains shape (elevation) information. The landclass of the terrain is provided by the texture. Each triangle can contain bits of multiple landclasses.
How Trees are grown - old scenery
Trees are generated in the Old scenery as follows:
- simgear/simgear/scene/tgdb/obj.cxx SGLoadBTG(const std::string& path, const simgear::SGReaderWriterOptions* options) loads a "BTG" file.
- line 113 created a SGTileDetailsCallback. This is a callback that will generate more detail for the tile when the viewpoint gets within range. This avoid having to create trees for tiles that might be 100km away and which we never get any closer to.
- line 118 creates a PagedLOD which will call the FGTileDetailsCallback when the viewer gets within range.
- simgear/simgear/scene/tgdb/SGTileDetailsCallback.hxx readNode(const std::string&, const osgDB::Options*) does the actual work to generate the details for a tile such as forests, random objects, lights, and it called by the PagedLOD object above.
- line 138 calls generateRandomTileObjects to create the forest, buildings and buildings
- generateRandomTileObjects (line 976) builds a set of OSG nodes and makes various calls to generate the random feature based on