|
From: Thorsten R. <tho...@sc...> - 2016-06-03 10:59:03
|
I'd like to ask for some help for generating a demo for a possible future scenery format/rendering strategy. The idea is that we move away from vectorized landclasses and encode the information on landclasses in a raster-image (in my terminology a meta-texture). This has a couple of advantages: 1) Generating an image seems to be much easier than vectorizing complex data structures 2) By avoiding any mesh subdivisions due to landclasses, the mesh vertex count can be cut (drastically?) 3) We get full control over how the transitions between landclasses look like 4) We can easily fit man-made landclasses into the rest of the scenery in a plausible way 5) Landclass editing by the end user can then be made with graphics software, no terragear runs are required I've done some tests with such a setup where I hand-edited a meta-texture. Here you can see three landclasses, one boundary requested sharp (but rounded), the second with a pixelized transition. In addition, we could also fade them over some distance into each other: http://www.science-and-fiction.org/FG/pics/terrain_textgen01.jpg Man-made landclasses would always be drawn 'on top' of the natural background. In that way, if you're in an area with red soil, the part that isn't irrigated or built will look red as it looks through. Here's agriculture embedded this way in the surrounding grassland: http://www.science-and-fiction.org/FG/pics/terrain_nextgen02.jpg Here's town embedded the same way and alpha-blended into the surroundings - see the 'holes' in the town texture through which the grassland is apparent: http://www.science-and-fiction.org/FG/pics/terrain_nextgen03.jpg Some technical details of the shader: The meta-texture uses a greyscale/alpha texture (turns out I get some residual bleeding of values between rgb, so I can't use all four channels) to encode 16 landclasses each for natural and man-made - written to the red color channel and the alpha channel in equal steps. Thus, a color value of 0.0 might encode glacier, 0.0625 rock, 0.125 herbtundra,... and so on, same for the man-made with the various agricultures, town, city, industrial,... We have a total of 32 landclasses (sixteen per channel) per region that way which should give decent visuals (we could possibly pack it somewhat more densely and try to use 25 and a 5x5 palette, but too densely, and the transition info is lost, so there's some optimum operation regime). The shader looks up the meta-texture and then runs a transition finder to cope with blurred landclass definitions (a color value of 0.5 might be because you want to encode the landclass with index 0.5, or a 50-50 mixture between landclasses 0.6 and 0.4 - the transition finder distinguishes these two cases and returns the landclass(es) to render and the mixing factor. A mapper then references a square on a palette of a 4x4 grid of landclass textures and draws that. Once the natural landclasses are drawn, the process is repeated for the man-made which are drawn on top. I plan to add full overlay texture as in the ALS shaders to avoid tiling and give details from close-up, but that's not coded in for now. Likewise, there's no solid concept for roads - maybe they can just be drawn as a separate layer on top of all else from a prepared texture, and we supply road textures only to the renderer within a LOD range and otherwise give it a blank alpha=0. I'd now like to study this for a more real setup. To this end I would need help from C++ coders and scenery people (and possible graphics designers). What I need is: 1) A test area - ideally an island, for which terragear is run to create a landclass-less mesh (except water at this stage) and at the same time produces the associated meta-texture (16 natural landclasses in r-channel, 16 man-made landclasses in alpha channel values) which encodes the landclasses. 2) A way to reference the meta-texture - for this, we need one of the photo-scenery strategies because the problem is the same - basically we want to be fire up FG and be able to see the terrain rendered showing the encoded landclasses in the classic renderer - the only difference in photoscenery is that we want to see the photo rendered instead: http://wiki.flightgear.org/Photoscenery I think for the demo it may be easiest to simply do the 'material' strategy, make the terrain one material per chunk and feed the right texture to the shader via the material definition. For the eventual strategy, I don't know whether the overlay (requiring patching) isn't more promising as it would give us the option to co-exist with the current terrain for a while to ease the transition. But if someone would look into this right now so that we can decide where to go would also be rather helpful. 3) Optionally someone who is good with graphics to create the man-made texture palette (this mainly includes cutting suitable holes in it where the natural ground is supposed to shine through). Anyone wanting to join in? I think there's plenty of potential here - and plenty of issues which need to be understood before this can really take off. Cheers, * Thorsten |