Breakdown: Mud and Water of Spintires
Subscribe:  iCal  |  Google Calendar
7, Mar — 12, Jun
Anaheim US   23, Mar — 26, Mar
San Jose US   26, Mar — 30, Mar
Washington US   30, Mar — 2, Apr
Los Angeles US   2, Apr — 4, Apr
Latest comments
by jenny
4 hours ago

That is really a great thing for us all.

by Jeff
7 hours ago

I just based my landscape material on this. I just wish I could exactly figure out what is going on with normals, ao and displacement here.

by Christopher Buller
9 hours ago

That was extremely helpful! Thank you!

Breakdown: Mud and Water of Spintires
16 November, 2017

Pavel Zagrebelnyy has shared an article with some technical details behind rendering of Mud and Water in Spintires:MudRunner, a driving simulation game from Saber Interactive. The developer decomposed some screenshots from the game and then showed how you can recreate mud and water from Spintiers with your 3D tools.

Here is a small piece about mud to get you interested:

Game levels in MudRunner can be up to 1km x 1km in size. They are subdivided into a grid of 16m x 16m blocks. Each block contains a list of plants (trees, rocks, etc.), base terrain data, mud data (optional), and other data. Game only draws those blocks that are inside camera “frustum”. Only those blocks that are near the truck that player is driving are “active”. Game only performs plants physics simulation, mud simulation and water simulation for “active” blocks.

The mud simulation consists of mud-vehicle physics processing (performed by CPU) and rendering of the mud (performed by GPU). For a number of reasons (CPU and GPU are out of sync on PC, high detalization required for rendering is not required for physics, etc..), those two tasks operate on completely different sets of data. We won’t go into details of physics here, but in short, there is no rocket science involved, but it’s not something Havok (physics engine in MudRunner) can do out of the box.

In order to draw the mud, vertex shader takes in a simple 2d grid of vertices, then fetches two A8R8G8B8 textures that look like this:

Texture 1. 25×25 in size for each block, is used for rendering both low-res base terrain and the high-res mud.

R (red) channel – packed height (elevation). It is unpacked into real-world height with a bit of math.

G (green) channel – grass/dirt materials mix factor. Currently, each block can only mix 2 materials.

B (blue) channel – “tint” factor. Tint adds some color variation to the environment, and illustrates physics properties (“tinted” terrain is softer).

A (alpha) channel – marks portions of base terrain that are substituted by the mud, it’s the only channel that is dynamically updated as vehicles deform terrain.


Texture 2. 128×128 in size, is only allocated for blocks with mud.

R (red) channel – “mud height”, is relative to elevation of base terrain. It gets unpacked into a floating point value with a simple multiplication.

GB (green, blue) channels – used for “mud offset” effect (the mud slides away from vehicles wheels as they move).

A (alpha) channel – “mud tracks”, a blending factor of terrain shader into mud shader, In combination with A channel of Texture 1 that makes mud transition into terrain unnoticeable.

Pavel Zagrebelnyy 

You can find the full breakdown on Gamasutra

Source: Gamasutra

Leave a Reply

Be the First to Comment!