Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Distant Worlds 2 - Dev Diary #3

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [General] >> Press Releases, News and Events from Matrix >> Distant Worlds 2 - Dev Diary #3 Page: [1]
Login
Message << Older Topic   Newer Topic >>
Distant Worlds 2 - Dev Diary #3 - 8/25/2021 4:07:24 PM   
Mantuvec

 

Posts: 100
Joined: 10/13/2020
Status: offline
Procedural Rendering in Distant Worlds 2

Hello to all. My name is Elliot Gibbs, and I am the developer for Distant Worlds 2. This article has a slightly different focus. It will give you a behind-the-scenes look at a small slice of the game with an important on-screen role: the natural environment of the Distant Worlds galaxy.

While this article is more technical, it will help you see “under-the-hood.” It will give you insight into how we solved some of the unique problems faced in a game as vast as Distant Worlds 2.



Procedural Rendering versus Hand-made Art

What is procedural rendering? This refers to drawing various parts of the game without using hand-made art assets. In other words, an item is rendered on the screen without using any artist-created models or images. Instead the item is drawn using only software instructions – the item is rendered in code.

That might not sound very useful. Why would you bother writing a lot of software to draw something in code instead of just having an artist make a 3D model, or draw a 2D image?

That depends on what you are drawing and the number of different items that need to be drawn.



The old way: the Galactic Environment in DW1

As you probably appreciate, in Distant Worlds there is a vast galactic environment, filled with many items to explore and discover: stars, planets, moons, black holes, nebula clouds, and many others.

In Distant Worlds 1 (Universe and earlier) these items were mostly hand-drawn 2D images: there were a set of images for desert planets, another set of images for ocean planets, a set of images for nebula clouds, etc. In total there were about 250 images for planets alone. So there was a lot of hand-drawn art!



The advantage with static, hand-drawn art is that you can have very specific details in the art. For example you could have an image of the planet Earth in the game, complete with the continents, islands and oceans we know so well.

However there are some big drawbacks with static art:

  • 2D images and textured models have a resolution limit that is constrained by memory, thus when zoomed in their appearance can become blurry or pixelated
  • you typically need to draw each image or texture by hand, limiting how many variations you can realistically have. Although tools can help automate the generation of some images, you still have to store them and load them in game, which can take a lot of memory and storage

    Procedural rendering is an alternative to making a lot of hand-drawn art. It means writing software that knows how to draw a particular item. We can then draw as many variations of this item as needed, tweaking parameters to make changes to its appearance.



    The new, better way in DW2

    In Distant Worlds 2 nearly all of the galactic environment is procedurally rendered. That means that we use minimal hand-made art to draw the stars, planets, moons, black holes or nebula clouds in the game.

    Instead there are a set of custom shader programs that know how to draw each of these items:

  • a star shader that can draw brightly glowing coronas of semi-transparent gas and plasma
  • several shaders that draw planets with solid surfaces: some with a lot of mountains, others with deep oceans, others with glowing lava lakes
  • a shader that draws planets with gaseous surfaces with colored bands and swirling storms
  • another shader draws black holes
  • other shaders draw nebula clouds



    How does it work?

    At the core of these shaders is a concept called fractal noise. Fractal noise refers to a set of special random values that are tuned for drawing a natural environment in a realistic manner.

    Fractal noise is a huge subject, which I won’t go into detail about here. But if you want to learn more you should look it up. You’ll see terms like Perlin noise and Simplex noise, which are good starting points.

    But how do these procedural shaders work? What process do they follow, and what do they allow us to do?

  • Firstly they use fractal noise to make a unique height map for each planet, allowing us to generate mountains, valleys, plains, coastlines and sub-oceanic terrain
  • applies shadowing from sun light on the mountains and hills to provide subtle realism to the terrain
  • if the planet is populated , adds city night lights that follow the natural geography of the planet, preferring low-lying and coastal areas (including underwater cities in shallow coastal regions)
  • provides light-emitting features like lava lakes and oceans
  • adds cloud layers with animated storm systems and shadows on the planet below
  • allows latitude-specific features: polar ice caps, equatorial jungle belts, deserts
  • allows altitude-specific terrain: snowy mountain tops, forested valleys, grassy plains and coastal areas, shallow underwater continental shelves, deep ocean basins



    Thus procedural shaders provide a vast improvement when rendering the natural environment in Distant Worlds, giving us an incredible level of detail and variety. The advantages of procedural rendering directly address the weaknesses of static art that we had in DW1:

  • because the shader programs operate on each pixel on the screen, there is no resolution limit. You can keep zooming in closely to an item without blurriness or loss of quality
  • by varying the input parameters for each shader you can obtain nearly infinite variety for an item, thus every planet in DW2 is unique
  • because no static images or textures are needed, there is a dramatic reduction in memory and storage requirements



    A Living, Animated Galaxy

    Procedural rendering also enables another feature: animation. The fractal noise used in the shaders can be multi-dimensional, so you can use one of the dimensions to represent change over time. This allows you to smoothly animate things that you draw. For example, we have the following in Distant Worlds 2:

  • cloud layers on planets that move and change
  • star coronas with prominences that rise and fall
  • gas giant planets with animated cloud surfaces
  • nebula clouds that smoothly change over time
  • black holes with swirling vortexes of light and energy

    Thus procedural rendering helps to bring the galaxy of Distant Worlds to life, with motion and activity even in the natural environment. It gives infinite variety and depth of appearance to all of the planets and stars.



    Modding

    You might be thinking: how does this affect modding? Can you easily mod new planet and star types into DW2? Or does this require special coding or shader skills?

    The good news is that modders also have access to these same shaders to make their own unique planets and stars – no special skills are required. By simply adding a few values to a file you can have a completely new type of planet available in the game. Your planet will have all the same features as the built-in planet types: hyper-detailed height maps with shadowing, animated cloud layers, city night lights when populated, planetary rings, etc.



    Summary

    So how does procedural rendering improve the galactic environment in Distant Worlds?

  • provides infinite variety – no two planets in the galaxy are the same. They all have their own unique geographical features and coastlines
  • eliminates blurriness or pixelation. Everything remains sharp and clear even when zoomed in close
  • allows animation of features like star coronas, planetary clouds and nebula clouds
  • uses a lot less memory, thus freeing up resources for other rendering

    I hope you enjoyed this look at the galactic environment of Distant Worlds. I’ll be back later with more behind-the-scenes information about other features in Distant Worlds 2.

  • Post #: 1
    RE: Distant Worlds 2 - Dev Diary #3 - 9/3/2021 12:41:52 PM   
    mik11

     

    Posts: 1
    Joined: 9/3/2021
    Status: offline
    Loved DW but, and this may be a bit late, is there any chance of including various scouting diaries/logs? E.g. date, coords, name of asteroid (whatever) and type and number of Kaltors (whatever) that were found there? Similarly scouting for invasion targets could include information about defences, planet type, alien type etc. Preferably downloadable to a spreadsheet, so the data can be arranged as people would prefer and add things that they think useful.

    I always played on large/massive maps and had to set up spreadsheets with all this stuff on it, to avoid repeating things I had already done and help with planning. I often had lengthy gaps before I could return to the game and needed something to help my memory! However it was time consuming and took some of the playability away.

    Just a thought, thanks.

    Post #: 2
    Page:   [1]
    All Forums >> [General] >> Press Releases, News and Events from Matrix >> Distant Worlds 2 - Dev Diary #3 Page: [1]
    Jump to:





    New Messages No New Messages
    Hot Topic w/ New Messages Hot Topic w/o New Messages
    Locked w/ New Messages Locked w/o New Messages
     Post New Thread
     Reply to Message
     Post New Poll
     Submit Vote
     Delete My Own Post
     Delete My Own Thread
     Rate Posts


    Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

    4.375