[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Blended tile systems



On Oct 11, 2008, at 2:48 PM, Knapp wrote:

I do a lot of work in Blender3d and very often I make textures by
using 3 textures of different sizes. One is the basic look, say a
square of grass. Then the next to are blurry cloud like shadow things.
The last is used for the normals but all that means is shading based
on the light angle.

So my question is has anyone ever made a basic 2d tile game this way?
You would end up with tiles that were much more natural looking an
much less tilish.

This is a animation I made this week using this technique for the
grass. See how there are almost no seen seams? If you look close you
will see a bit of repeat but not much. It is also totally  flat. The
hills are nothing but shading done with the 2 extra textures.

http://www.youtube.com/watch?v=Hn91J1YwikA&feature=related
If you go to my area you can find a bunch of other night walker vids
with the same grass.

So has anyone ever tried this 2d with a tile system?

I think you are talking about something very similar to "texture splatting", described in excellent detail here:

http://www.cbloom.com/3d/techdocs/splatting.txt

I actually have a python implementation for a tile-based iso game I've been working on. It uses Pyglet/OpenGL
and creates splat textures and vertex lists based on a text file:

http://code.google.com/p/caseman/source/browse/trunk/mech/mechazoid/map.py

Right now the tileset is hardcoded, but I intend to extend it to support tilesets derived from config files later. As written it doesn't support much in the way of different elevations, but that's a (deliberate) limitation of the underlying map definition class (which just defines the topography, it does no drawing). The view class is more general and supports arbitrary tile elevations, though since it is for an iso game, the transitions are rather abrupt rather than smooth, but this could be worked around by making the tiles small and the difference in elevation low, at the cost of a more complex terrain mesh.

It does support arbitrarily large maps by dividing the mesh and textures into chunks, so it can draw only the visible chunks. It does not support more advanced features like automagic LOD control, which isn't useful for an iso game not drawn in perspective.

I don't have a screenshot of the current code handy, but I could post one if you like.

-Casey