Jump to content

  • Log In with Google      Sign In   
  • Create Account






Forest Splatting

Posted by JTippetts, 10 October 2012 · 1,690 views

Goblinson Crusoe isometric hex rpg procedural trees
When you make a game, you have to make compromises. Doesn't matter what kind of game you make, 2D, 3D, RTS, RPG, FPS, TBRPG.... you name it, there are compromises you have to make.

Goblinson Crusoe is a 2D hex-based game viewed from a 30-degree angle above the horizon with an orthographic projection. At first glance, you'd call it isometric. Close enough. It does use a 3D renderer on the back end, though, to avoid some of the issues with sorting that a "standard" isometric has.

However, I am fond of using anti-aliased sprites with partial alpha, smoothly blended into the background. Partial transparency is still kind of a bugbear of 3D rendering. In 3D games, typically the "solid" geometry will be rendered first, then the partially transparent geometry is sorted back-to-front and rendered in another pass. Unfortunately, everything in Goblinson Crusoe is partially transparent. To help mitigate some of the sorting burden, and to fix some edge cases (co-planar terrain splats, for example) I built a layer system reminiscent of the old engines. (Things like this are part of the reason I find out-of-the-box scene managers for third-party libraries to usually be insufficient; they are built with mainly FPS games in mind, so the structure and optimizations they make can slow you down for cases like this.)

Anyway, to date I've implemented trees on the over-map as individual billboard sprites scattered about. This worked great as long as I was fine with relatively sparse forests or larger tree sprites, but since I've been working on the overmap art I've found myself wanting denser forests with smaller trees, more matching the visual abstraction of a world map that I am shooting for. However, I can't simply just bump the tree count up through the roof, because then I run into sorting slowdowns and other performance problems, especially on the cruddy XP boxes I have to work on at work, which is where I do the bulk of my development.

So today, I made a compromise. The billboarded sprite trees had to go. In lieu of separate billboards, I implemented pre-rendered tree "splats", similar to the terrain splats. They are rendered as a terrain splat, but are sorted into the same layer as mountains/mobs, and drawn with a slight scaling factor so that there is some overlap. It doesn't look quite as good as with billboards, especially as the player moves through it and there is unrealistic overlap. However, this is one of those compromises where the drawbacks are small enough, and the improvement significant enough, that I'm okay with the tradeoff. Even with a single tree model, no color variation, and one single pre-rendered splat, the results are quite nice:

Posted Image

With just 2 or 3 splats per forest biome, I could have some pretty varied overmap terrain, and the impact on the framerate is almost negligible. Setting up the splats in Blender as particle systems similar to the forests in the landscape renderings I did earlier is trivial, though I do have to render in 2 passes (1 regular, with a transparent ground plane; 1 with a high exposure and the ground plane set to a diffuse white to capture the shadow) and run the 2 renders through a composite pass to get the final sprite. This workload isn't crushing, and I think the result is well worth it.




You heard it already but I think it looks great still =)
Nice! Maybe you also could mirror the drawing of some of the splats to get even more variation without increasing the number of prerendered splats

Recent Comments

September 2014 »

S M T W T F S
  1 23456
78910111213
14151617181920
21222324252627
282930    
PARTNERS