alpha map

hey all, i created a terrain with L3DT and i created alphamaps, lightmaps and texture one main question is that to use the alpha maps should i combine them wiht the texture in photoshop or use it in panda?

alpha maps are for holes and stuff - i am wondering how you have holes in your terrain :slight_smile:. To use all the maps you need to make your own shader. After you get through some shader basics creation shades is easy and fun.

its for texture splatting cuz thats how im gunna texture my terrain. i have to write a shader for alpha maps?

well without shader you can do very limited texture-splatting. but. since there are people working on terrain algorithms right now there are also some existant shaders. i think pro-rsoft has one and dunno i think treeform. not sure about later one. but pro-rsoft should be able to help you out in this case

You indeed have to write shaders for texture splatting. UNLESS you are just using 2 textures+2 alphamaps, you could probably fit that into most GPU’s which have 4 texturestages.
I can easily write a shader for you, if you want. How much textures/alphamaps do you have and how do you store them?

well thanks pro soft. i have 5 textures and alphamap files which are seperate files.

Sorry that I was unable to reply earlier, but here it is:


//Cg profile arbvp1 arbfp1

void vshader( in float4 vtx_position : POSITION,
              in float2 vtx_texcoord0 : TEXCOORD0,
              in uniform float4x4 mat_modelproj,
              out float2 l_texcoord0 : TEXCOORD0,
              out float4 l_position : POSITION)
void fshader( in float4 l_position : POSITION,
              in float2 l_texcoord0 : TEXCOORD0,
              in uniform sampler2D tex_0 : TEXUNIT0,
              in uniform sampler2D tex_1 : TEXUNIT1,
              in uniform sampler2D tex_2 : TEXUNIT2,
              in uniform sampler2D tex_3 : TEXUNIT3,
              in uniform sampler2D tex_4 : TEXUNIT4,
              in uniform sampler2D tex_5 : TEXUNIT5,
              in uniform sampler2D tex_6 : TEXUNIT6,
              in uniform sampler2D tex_7 : TEXUNIT7,
              in uniform sampler2D tex_8 : TEXUNIT8,
              in uniform sampler2D tex_9 : TEXUNIT9,
              out float4 o_color : COLOR )
  float4 tex1=tex2D(tex_0,l_texcoord0);
  float4 tex2=tex2D(tex_1,l_texcoord0);
  float4 tex3=tex2D(tex_2,l_texcoord0);
  float4 tex4=tex2D(tex_3,l_texcoord0);
  float4 tex5=tex2D(tex_4,l_texcoord0);
  float alpha1=tex2D(tex_5,l_texcoord0).z;
  float alpha2=tex2D(tex_6,l_texcoord0).z;
  float alpha3=tex2D(tex_7,l_texcoord0).z;
  float alpha4=tex2D(tex_8,l_texcoord0).z;
  float alpha5=tex2D(tex_9,l_texcoord0).z;
  o_color =tex1*alpha1;

Here is the python code:

#load the textures
#load the alpha maps
#replace textureX and alphamapX with your texture.

Please note that its extremely inefficient to store your 5 alpha maps in 5 different files. You could much better store them in 2 files or so, and make the Red channel for the first alpha channel, Green for the second, Blue for the third, etc.

I didn’t test this. But if there’s any problem with it, i’d be happy to help you with it.

thanx dude, ill test it out as soon as possible

Is it possible at all to do texture splatting without the use of shaders? What would be the most efficient way of doing that?

This is 'cos my graphics card - a NVDia GEForce2 by the way - doesn’t support shaders. ANd no - please no lectures on getting a new graphics card. I share the com with my family, and I don’t think they will let me replace the graphics card unilaterally.


it is possible on a geforce2 … but in an very limited way.
first way is to use texture-stages. but since a geforce2 has , i think either 2 or 4 textures. you can pretty much forget about this one without using multipass rendering.

another way is to use several terrain meshes above each other and do blending via the vertex-colors, or more precise the vertex-alpha value.

3rd option is to write a custom off-screen texture-tile rendering code which creates LOD-oriented textureplats. while this works comparebly well even without shaders, it requires quite some texture memory which makes it very hard to use on a geforce2.

4th option is to go the “dungeon sige” way of having hundrets of pre-rendered tiles, with maching borders. this works very well, works on older hardware. but it’s limiting the viewing distance somewhat and it requires you to paint tons of texture. dungeon sige had several then thousand textures if i remember correctly.

your best bet is option 2. to use several meshes above each other. there was an example posted on the forum using this technique.

ps: replacing a graficcard … most users wont even notice :wink:

One of these has already been implemented by treeform:

okies very new to both panda, python and l3dt and have some questions bout terrain splatting.

First i started in l3dt created a 25 mile wide mosaic map it split it into 8 tiles each has thier own alphamaps.png and uses black and white colors for em. so reading this discussion im wondering bout how to apply tiled sections into the script posted here. or which is the best way to do it. i read a post on how to use earthsculpt mapping proggie and there are enuff differences between the 2 programs that im just not sure what gets plugged into where. i have looked for a step by step tutorial for l3dt use for splatting and cannot find one. exporting these maps i get 1 heightmap 1 lightmap, 1 attributes map (colormap), 8 alphamaps, and 8 texturemaps…and varius html docs which ive looked at and scratched my head over not knowing what it is im looking at yet…
the texturing they use is a lil confusing also in that they take jpegs and layer them for the texture used in the program and call it a .mat file so logically if i copied each texture that program can use i can direct a shader to that one file instead of 9 different folders they are scattered in to find the correct jpegs but im not sure how to direct the shader to knowing which combos are used to create the texture as it was in l3dt

thanks to anyone who responds to help me understand what it is im looking at and applying it to a workable world

Well, I don’t really think it’s possible to do it with mosaic textures. Unless you only want to display the texture for the tile the player is currently on.

I use L3DT too but I just scaled my alpha maps and texture map down. Still gives a good effect and is still detailed.

yes all of the tiles will not be visible at the same time, idea is a seamless world which im not sure im going about in the right way anyways. this is for me trial and error time really. and learning to not pull my hair out anymore then i have :>

okies ditched the mosaic tiles map and made one single tile map, part of the problem i found is the freebie l3dt version makes 1 alpha map per each tecture used, so i ended up with nice black and white maps 6 of em…
i turned around and after thinking bout needing a single map colored em different colors in adobe and made a single map with copy and paste, so that takes care of one of my issues i hope. Yay.

now i have a heightmap, normals map, water map (dont think i will use it tho), alpha map colorcoded for textures and overall terrainmap

can someone point me to where is the scaleing in the docs it exports? ive looked but without knowing what im looking for i could see it 50 times and not know what it is

trying to plug in my map info to the code and shader is prolly ambitious for a first time project but if you have patience i will learn it :>