fertscale.blogg.se

Mudrunner spintires game
Mudrunner spintires game






With a knowledge of wheels and chassis positions, their size and velocities, and their current mud penetration depth, CPU forms various “primitives” and draws the into a “Texture 2” (RT – render target), which is then read back by GPU. The visual part of mud simulation boils down to properly updating Texture 2: GB (green, blue) channels – used for “mud offset” effect (the mud slides away from vehicles wheels as they move).Ī (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. It gets unpacked into a floating point value with a simple multiplication. R (red) channel – “mud height”, is relative to elevation of base terrain. 128x128 in size, is only allocated for blocks with mud. Tint adds some color variation to the environment, and illustrates physics properties (“tinted” terrain is softer).Ī (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. Currently, each block can only mix 2 materials.ī (blue) channel – “tint” factor. G (green) channel – grass/dirt materials mix factor. It is unpacked into real-world height with a bit of math. R (red) channel – packed height (elevation). 25x25 in size for each block, is used for rendering both low-res base terrain and the high-res mud.

mudrunner spintires game

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: 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. 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. The mud simulation consists of mud-vehicle physics processing (performed by CPU) and rendering of the mud (performed by GPU). Game only performs plants physics simulation, mud simulation and water simulation for “active” blocks. Only those blocks that are near the truck that player is driving are “active”. Game only draws those blocks that are inside camera “frustum”.

mudrunner spintires game

Each block contains a list of plants (trees, rocks, etc.), base terrain data, mud data (optional), and other data. They are subdivided into a grid of 16m x 16m blocks. Game levels in MudRunner can be up to 1km x 1km in size. Now let’s have a closer look at each layer… MUD HEIGHTFIELD So if vehicles have not deformed terrain, its wireframe would have looked like this: Now we are left with the mud itself, which is a simple heightfield (essentially a 2d mesh):īut most of the game level terrain is actually rendered at lower resolution. They are not actually rendered as a separate layer and are embedded into terrain shaders. Roads, that map author places within Level Editor, are then baked into a special data that game uses to draw them efficiently. (A “plant” is an object that is scattered over the terrain in large quantities, like rocks or trees.) They are maintained by the same systems that simulate and render all other plant types in the game. These are bigger chunks of mud, each is a full-fledged rigid body so they interact with the physics world properly and they even break into smaller chunks, when vehicles drive over. A lockless synchronization technique makes that whole effect very performance-friendly. Mud particles are simulated by the CPU in a separate thread. Those objects float on top of the mud and are affected by vehicle wheels (can stick to them even), they only act as decoration and don’t affect the physics. Terrain Mud Decals (will get back to it later)Ģ. Now let’s take away all the layers in the reverse order they are applied when the game renders a frame.ġ. Let’s start by disabling post-processing: SSAO (ambient shadows), FXAA (softens object edges), DOF (blurs foreground), Sharpen Effect and Color Correction:

mudrunner spintires game

Let’s take a game screenshot and decompose it.

mudrunner spintires game

The author of this blog post is lead developer of the game. Spintires:MudRunner doesn't use third-party game engine.








Mudrunner spintires game