Tears of Steel Rises - A remix of the Open Source film Tears of Steel set to the soundtrack of The Dark Knight Rises trailer done at 4am.
Video demonstration of the procedural textured terrain. Be sure to view in HD.
Ditching Diffuse Maps - Efficient use of textures for landscape rendering
This is a followup to the previous post on terrain rendering. Hopefully this will make clear what the shader is doing in the sample file.
So here we have a terrain model, it has 3 colour layers (rock, grass, sand), an ambient occlusion layer, a specular layer, and lastly a detail layer. The usual.
One could combine 1,2,3 into one monolithic diffuse map that covers the whole mesh, and use a lower resolution texture for AO(4) and specular(5). And finally a small detail map(6) is tiled across the object to add some high frequency detail at sub-diffuse map resolution. This is the most obvious approach. At the cost of huge textures memory usage.
A better way to do it might be to have 1,2,3 as separate, tillable textures. Then an additional texture can be used to mask between them, like a stencil. Texture Splatting is apparently the term for it. AO(4), specular(5) and detail (6) stays the same. Despite using an additional texture, we can achieve much higher resolution without using gigantic textures.
Considering today’s video consoles - PS3 with 256MB of RAM, Xbox 360 with 512MB of RAM, it is obvious that memory is premium. A single 4096x4096 RGBA texture would take up 64MB, uncompressed. We need to pack more pixels into less bytes.
This is where this novel approach comes in. Basically we are storing absolutely the bare minimum image data needed to reconstruct the surface, relying on a shader material to supply some of the information that’s missing from the textures.
Here is how.
Grass is green, sand is yellow, rocks are gray. These textures typically have a rather uniform colour that don’t change much. So we should be able to set the colors of these textures in a shader, there is no point in wasting 24bit (3 channels per pixel) just to encode colour information.
So now that we are removing all the colour information from the base textures, up to four grayscale images can be combined into a single RGBA image. Yay!
Now we need a way to specify which image gets applied where. This information is stored in the R channel of the mask texture. Which, through some colour-ramp and nodal material magic, maps the grayscale image into a series of masks which can then be used to control the distribution of the textures.
Lastly, the gray textures are colorized by a the shader, combined with AO and Specular (which are stored in the G and B channel of the mask texture. And finally displayed.
First of all, recognize the fact that this approach works far better with high frequency, tileable textures such as wood/bricks/asphalt/grass than non-repeating textures such as logos/markings/etc. As such, terrain is a perfect candidate to try this texturing approach on.
Some notable features of this method: Smaller texture footprint > Less system RAM and Video RAM usage; faster loading time Higher shader complexity > More arithmetic computation; but less texture-fetch Most image compression/texture compression down-samples chroma, making this texture encoding scheme less effective.
Uber efficient use of textures for terrain rendering
Traditionally, for a terrain this size, one will need an 8k texture at minimum. The landscape is rendered using a single 2028x2048 texture and one 512x512 texture.
This post is inspired by Andrew Maximov’s article. In which he explores the limitations of traditional diffuse colour textures, and proposes a shader based semi-procedural texturing approach.
This is that method in Blender.
Download the Blend file here Here is the texture use break-down
- Combined.tga R Channel: Dirt texture
- Combined.tga G Channel: Grass texture
- Combined.tga B Channel: Rock texture
- Mask.tga R Channel: Gradient Map (used to control which of the textures (Dirt, Grass, Rock) to use)
- Mask.tga G Channel: Light Map (Ambient Occlusion)
- Mask.tga B Channel: Specular Map
To see how these textures are being used, take a look at the nodal material setup in Blender.
Blender Game Engine improvements to keep an eye on
OpenGL Mobile Compatibility and Android Port (GSoc 2012) - Alexandr Kuznetsov: This project aims to made OpenGL slightly faster and compatible with OpenGL ES in order to port Blender Player to Android. This would include port of libs, ghost and build infrastructure. At the end Blender Games can be played on Android.
BGE Converter Improvements and fixups (GSoC2012) - Mitchell Stokes: Various improvements such as saving out converted data to disk and allowing for asynchronous level loading. Will make loading of large geometry much faster.
Multitouch Framework (GSoC 2012) - Nicholas Rishel: Extending recognition for multitouch input for SDL for the purpose of navigation, and a framework for future additions. As envisioned, the immediate result would serve as a compliment to a stylus. This would prepare Blender for the incoming Slate form factor machines (see Samsung Series 7 Slate and Asus Eee EP121), and potentially ease ports to Android touch devices.
Adapting the Hive system for the Blender Game Engine (GSoc 2012) - Spencer Alves: This project aims to make a more accessible, efficient, and useful editor for logic systems in the Blender Game Engine by integrating the Hive systems project into Blender.
The above 4 projects are collectively codenamed “SwissCheese Branch”.
Candy Branch - Martinsh Uptitis and ‘mokazon’: General eye candy improvement [link]
Harmony Branch - Daniel Stokes et al: Phase 1 merged into trunk, more goodies coming [link]
Here is the slides for my presentation at the Boston Blender get-together this past week.