Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Rendering realistic satellite view style terrain with OpenGL

  1. #1

    Question Rendering realistic satellite view style terrain with OpenGL

    Hi, all.

    I've accidently stumbled across this interesting forum when I was looking for the techniques of rendering satellite view style terrain, and I've found some quite nice tutorials on how to draw the texture manually. My goal however is to achieve that solely by shader code, as my terrain is actually a whole Earth-sized planet and I allow viewing it from as close as about 30km altitude. Obviously such a huge landmass with camera so close to the surface would require tons of pre-rendered textures, which is lots of work and huge amount of memory to waste on textures.

    Hence I'm looking for a generic way of rendering per pixel based on the pre-generated data I already have, which is biomes and elevation.
    I have the following biomes: Ice, Tundra, Taiga, Shrubland, Temperate Desert, Temperate Forest, Grassland, Desert, Tropical Forest and Savanna.
    Basically I have height per pixel, as result of having elevation per vertex. Also, since camera is as high as ~30 km, I don't need to render details like trees or vegetation.

    The goal is more or less a render as described in this tutorial: https://www.cartographersguild.com/s...ad.php?t=10768

    So the questions are:

    Can I make it without having to sample from textures?
    If I have to sample from textures, how would I create the textures in a first place? I've tried to look for ready satellite view packs and found nothing I could use.
    Do I have enough attributes to be able to render terrain? (Biome type and elevation)

    Thanks in advance,
    Denis.

  2. #2
    Guild Expert johnvanvliet's Avatar
    Join Date
    Jul 2012
    Location
    N 42.39 W 83.44
    Posts
    1,091
    Blog Entries
    4

    Default

    i use blender's built in engine or Celestia ( space sim)

    like these renders of the Minor planet "Ceres" from the Dawn mission data
    -- Blender cycles


    or these renderings of a KBO ( kuiper belt objects )
    -- Blender cycles





    or these 3d renderings done in Celestia ( but the textures were created in Blender )
    http://forum.celestialmatters.org/vi....php?f=4&t=878


    and this
    100% generated and rendered in blender procedural nodes
    Last edited by johnvanvliet; 05-01-2017 at 05:08 PM.
    --- 90 seconds to Midnight ---
    --------

    --- Penguin power!!! ---


  3. #3

    Default

    Thanks, this looks quite awesome! Unfortunatelly there is no way to translate Blender nodes setup to shader code, so that means I'll have to bake the texture and still use it as premade texture (been there done that!), which I want to avoid at all costs

  4. #4
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,249
    Blog Entries
    8

    Default

    I would reckon that if you could generate a texture which is a biome lookup then you could then generate the biomes in the shaders. You probably need several parameters that you need to access per pixel and then you would have enough info to make it look sensible.

    If you want to see someone who has been doing this kind of thing in realtime then check out Outerra.

  5. #5
    Administrator waldronate's Avatar
    Join Date
    Mar 2007
    Location
    The High Desert
    Posts
    3,610

    Default

    You should be able to use any search engine to find any number of procedural planet shaders that can be easily adapted to run on the GPU. By "any number", I mean greater than zero and by "any search engine", I mean one of the ones that has indexed at least a few hundred million pages.

    Look up F. Kenton Musgrave's Gaia shader from long ago in the book Texturing and Modeling: A Procedural Approach. It's a Renderman shader, but the principle is the same as a GPU shader.

    Look at articles by Inigo Quilez ( http://iquilezles.org/ and lots of his at stuff https://www.shadertoy.com/ ). They are already shaders. Or skip the understanding part and just go to https://www.shadertoy.com/results?query=planet for quick satisfaction.

    If you want to generate biomes from world position and altitude, you can use a small texture as a lookup (a texture is just a lookup table for quantities that are expensive to calculate otherwise), you can convert an annual average temperature and annual average rainfall into a rough biome map using a lookup similar to http://www.thewildclassroom.com/biom...tiongraph.html. Ideally, you would have a temperature-rainfall map by biome type and feather the types out at the edges so that you can get a probability for each type of biome rather than hard edges; switch between biomes by the probability indexed into a fractal map to get scattered blending rather than soft blending. Implementing the full Koppen-Geiger model is probably not needed for the basic case.

    You can convert latitude, altitude, axial tilt, and time of year into a base temperature (insolation based on latitude and axial tilt with temperature decreasing by the lapse rate for altitude). Sample that a few times around the orbit for each point. You can convert latitude and temperature into a very rough rainfall amount by starting with rainfall high at the equator, low at the desert latitudes, increasing to the temperate line, then dropping again toward the poles; if you want to calculate a distance from water and decrease rainfall past a certain amount, that helps, too). For both rainfall and temperature, add a small fractal perturbation to keep things from being too banded by latitude. A fancy sim that does heat and moisture transport via wind and wave would give nice results. For finer details, you'll probably need rivers and should take the slope and aspect angle relative to the sun into your calculations.

    Once you have your biomes, sample a googly map of Earth at similar biomes to get a patch of representative texture. Then synthesize larger patches on the fly using a texture synthesis engine. As above, use a fractal to control the hard transition between biome types.
    Last edited by waldronate; 05-01-2017 at 11:01 PM.

  6. #6

    Default

    Quote Originally Posted by Redrobes View Post
    I would reckon that if you could generate a texture which is a biome lookup then you could then generate the biomes in the shaders. You probably need several parameters that you need to access per pixel and then you would have enough info to make it look sensible.

    If you want to see someone who has been doing this kind of thing in realtime then check out Outerra.
    Looks great, thanks will check it!

  7. #7

    Default

    Quote Originally Posted by waldronate View Post
    You should be able to use any search engine to find any number of procedural planet shaders that can be easily adapted to run on the GPU. By "any number", I mean greater than zero and by "any search engine", I mean one of the ones that has indexed at least a few hundred million pages.

    Look up F. Kenton Musgrave's Gaia shader from long ago in the book Texturing and Modeling: A Procedural Approach. It's a Renderman shader, but the principle is the same as a GPU shader.

    Look at articles by Inigo Quilez ( http://iquilezles.org/ and lots of his at stuff https://www.shadertoy.com/ ). They are already shaders. Or skip the understanding part and just go to https://www.shadertoy.com/results?query=planet for quick satisfaction.

    If you want to generate biomes from world position and altitude, you can use a small texture as a lookup (a texture is just a lookup table for quantities that are expensive to calculate otherwise), you can convert an annual average temperature and annual average rainfall into a rough biome map using a lookup similar to http://www.thewildclassroom.com/biom...tiongraph.html. Ideally, you would have a temperature-rainfall map by biome type and feather the types out at the edges so that you can get a probability for each type of biome rather than hard edges; switch between biomes by the probability indexed into a fractal map to get scattered blending rather than soft blending. Implementing the full Koppen-Geiger model is probably not needed for the basic case.

    You can convert latitude, altitude, axial tilt, and time of year into a base temperature (insolation based on latitude and axial tilt with temperature decreasing by the lapse rate for altitude). Sample that a few times around the orbit for each point. You can convert latitude and temperature into a very rough rainfall amount by starting with rainfall high at the equator, low at the desert latitudes, increasing to the temperate line, then dropping again toward the poles; if you want to calculate a distance from water and decrease rainfall past a certain amount, that helps, too). For both rainfall and temperature, add a small fractal perturbation to keep things from being too banded by latitude. A fancy sim that does heat and moisture transport via wind and wave would give nice results. For finer details, you'll probably need rivers and should take the slope and aspect angle relative to the sun into your calculations.
    Thanks, but I've got all that already covered, I have algorithms to generate terrain that fits my needs, together with moisture (in my case it's proximity to sweet water source) and temperature (like you've suggested latitude and axis tilt), so basically I've got biome types figured out per field.

    Quote Originally Posted by waldronate View Post
    Once you have your biomes, sample a googly map of Earth at similar biomes to get a patch of representative texture. Then synthesize larger patches on the fly using a texture synthesis engine. As above, use a fractal to control the hard transition between biome types.
    Any chance you can pardon my ignorance and elaborate a bit more about synthesizing textures from small samples and using fractals to control the transition between biomes? Basically the underlying structure of my terrain is hexagonal, so I need a way to make biomes transition as "noisy" as possible for hexagonal structure not to be obvious. Any links to articles explaining implementing those techniques would be greatly appreciated!

  8. #8
    Guild Expert johnvanvliet's Avatar
    Join Date
    Jul 2012
    Location
    N 42.39 W 83.44
    Posts
    1,091
    Blog Entries
    4

    Default

    do you read /write " Racket " or "c++" for the old version of the code

    have a look at "earthgen" on github

    the racket version
    https://github.com/vraid/earthgen

    and the old c++ version
    https://github.com/vraid/earthgen-old
    --- 90 seconds to Midnight ---
    --------

    --- Penguin power!!! ---


  9. #9
    Administrator waldronate's Avatar
    Join Date
    Mar 2007
    Location
    The High Desert
    Posts
    3,610

    Default

    There are many ways to synthesize larger texture patches from smaller ones. Unsurprisingly, searches for "texture synthesis", especially combined with "SIGGRAPH" will yield good results. The Inigo Quilez page referenced above has a couple of good examples on sampling a tiled texture so that it appears less regular. Image Quilting is a popular image synthesis technique, as is use of Wang Tiles.

    Managing transitions between biomes is, as you have discovered, the tricky part. As I mentioned in the part that you already have covered, a very good way to handle this transition is to synthesize biomes on the fly using temperature and rainfall maps for each biome type. You sample each temperature/rainfall map and add a fractal factor to each one: you now have a set of values that tells you how much each sample belongs to each biome type. The simplest resolution is to threshold that result by picking the single largest value: that's your biome type. You can also pick the largest n values and blend among those biome types. Once the biome type is selected, pick a pixel in your biome exemplar using some function of your world position.

    It really sounds more like you want to do a tile-based render of your terrain and are concerned about getting transitions between your tiles. A quick search for "tile-based game transition" turns up quite a few techniques, many of them based on the idea of preparing special boundaries between tiles of a specific type.

    If you are indeed using hexgonal tiles, you can do texture splats along the boundaries to get varying amounts of repeatable overlap (Hierarchical Poisson might be a good search term for ideas).

    Note that I'm not trying to be vague or difficult here. I'm trying to provide solid search terms and ideas. Without knowing what your underlying code base looks like, there's not a whole lot of specifics that I can provide.

  10. #10

    Default

    Quote Originally Posted by johnvanvliet View Post
    do you read /write " Racket " or "c++" for the old version of the code

    have a look at "earthgen" on github

    the racket version
    https://github.com/vraid/earthgen

    and the old c++ version
    https://github.com/vraid/earthgen-old
    Thanks. That's more or less what my generator already does, what I'm looking for is more of a semi-procedural shading, which this project doesn't do.

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •