Blending textures for Terrain Generation

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
Guest

Blending textures for Terrain Generation

Post by Guest »

Hello to all of you, willing to read my post!

I've a, basicly, simple Idea for the Generation of Terrain. No, not a better terrain renderer or similar. This "simple" Idea can get quite complex, if you follow it far enough, but basically it's simple and first of all, this will be a producibility study.

I just want to generate some Heightmap textures at runtime (not continuously), to let Spintz' nice Implementation of the Terrain Renderer do it's job.

I don't want to proceduraly generate some Height Data, I just want to take two (or more) textures and blend them partially together, to create a nice terrain.

So how do I blend textures? And of course, how do I do it _fast_ :)

I've thougth about shaders, because they can do these sort of Operations quite fast. But I don't know, 1. how to implement it, so that I can get the texture back from the shader, and 2. how to run it like a Function, not like "per-frame" effect, as it is intended imho.

But maybe there's another, possible better, way to generate such textures, any Idea?

Thanks for the thoughts!

p.s.
Here a short ASCII stuff, to illustrate it a bit:

Code: Select all

Tex 1    Tex2
-----
|A|B|    ---
-----    |X|   -> i.e. Blend D+X -> Y and use it for Terrain Generation   
|C|D|    ---
----
or D+X+(ABCD) -> Z for some senseless reason, (ABCD) means full Tex here
MasterD
Posts: 153
Joined: Sun Feb 15, 2004 4:17 pm
Location: Lübeck, Germany
Contact:

Post by MasterD »

This post above was actually me :)
YASS - Yet another Space Shooter
under Devolpment, see http://yass-engine.de
Guest

Post by Guest »

Read Bloom's paper on splatting
MasterD
Posts: 153
Joined: Sun Feb 15, 2004 4:17 pm
Location: Lübeck, Germany
Contact:

Post by MasterD »

Thanks for the reply.

That paper you mentioned is quite interesting, but I just wanted to blend two or more textures. Since this texture splatting sounds a bit higher level, as I wanted to go for now. Also I have other ideas I want to implement.

In the meanwhile I think I have found what I meant. It is described in this article as Blitting.

But I would love to use JPEGs as a matter of hd space, since in that article RAW image format is used.

Anyway, to my idea with that shader:
It should be possible to, e.g.
  • 1.set Texture as Render Target.
    2.use shader to blend textures together on a camera aligned plane
    3.set wanted dimensions (about 512x512 ?)
    4.let irrlicht render one frame
    5.repeat steps(1-4) for multiple texture blending
    6.use rendered Texture for ITerrainSceneNode
This sounds doable I think, but in that case, all users with not that good hardware would not be able to run this. Because it is not a nice effect, it is a heavily dependand feature. (I'm thinking of HLSL shader, maybe PC2 [since I'm a lousy shader programmer a.t.m])

Anyway, I currently would not be able to implement it, because Irrlicht thinks I don't have shader support nor the ability of Anti-Alias! (with a Radeon 9600XT)

I'm going to look for that a bit in the forum, but if you know whats wrong, please let me know anyhow :D

So what do I do if I want to change a texture manually and without that shader?

I mean: how do I change pixel data of an ITexture? (Not possible, afaik)

Or would it be better to do all that blending stuff (some similar technique as in the article above) and write that texture temporally to disk? But it would be nice to let it stay where it is: in memory.
YASS - Yet another Space Shooter
under Devolpment, see http://yass-engine.de
omaremad_

Post by omaremad_ »

this is quite interesting

I would do it through a much simpler shader based way

load 3 textures

-grass
-rock
-map

the map has 2 diffrent colors maybe green and red in diffrent areas

where there are green pixels relace them with the grass texture

where there are red pixels replace them with rock texture

or instead of red and green in a splat map i could use height of poygons
or their normals

low x and z normals and high y normal indicate flat ground and vice versa
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

IrrSpintz has updates that support 8 textures and support base or detail textures with up to 3 alpha maps.

Check out this post on the freeworld forums where these features are discussed in detail -

http://freeworld3d.org/v-web/bulletin/b ... .php?t=151
Image
Post Reply