[Solved] issue creating a world texture

trnrez

17-02-2009 22:26:28

I want to set a world texture to my terrain and then use texture splatting on top of that texture. I have read through the forum and I haven't found anything telling me how to set the texture using terrain manager.

I am not very familiar with materials but I added the colormap example at the beginning that way I would set the world texture as the bottom layer. Then I simply made splatting0.png a 512x512 transparent texture. I figured that would draw correctly but it draws the texture as pure black so I have no idea.

I am very sorry if this question is extremely simply I have been browsing the forums for an answer for the past three hours and haven't came across a fix.

The ETTerrain.material:
material ETTerrainMaterial
{
technique
{
// Draw the world texture
pass
{
lighting off

// from the lightmap pass before to counter lod-bugs
vertex_program_ref ET/Programs/VSLodMorph2
{
}
fragment_program_ref ET/Programs/PSLighting
{
}
//

// other blend modes work too
scene_blend modulate

texture_unit
{
// your structure / color-map
texture ETterrain_texture.jpg
}

}
// primary splatting technique, requires PS 2.0
// has issues with OpenGL rendering, though...
pass
{
// splatting pass

lighting off

vertex_program_ref ET/Programs/VSLodMorph2
{
}

fragment_program_ref ET/Programs/PSSplat2
{
param_named splatScaleX float 20
param_named splatScaleZ float 20
}

texture_unit
{
// first coverage map, dynamically managed
texture ETSplatting0
}
texture_unit
{
// second coverage map, dynamically managed
texture ETSplatting1
}

// splatting textures
texture_unit
{
texture splatting0.png
}
texture_unit
{
texture splatting1.png
}
texture_unit
{
texture splatting2.png
}
texture_unit
{
texture splatting3.png
}
texture_unit
{
texture splatting4.png
}
texture_unit
{
texture splatting5.png
}
}

pass
{
// lightmap texture pass

scene_blend modulate

vertex_program_ref ET/Programs/VSLodMorph2
{
}

fragment_program_ref ET/Programs/PSLighting
{
}

texture_unit
{
// dynamically created
texture ETLightmap
}

}
}



technique
{
// fallback technique for ps 1.1

pass
{
// first splatting pass

lighting off

vertex_program_ref ET/Programs/VSLodMorph
{
param_named splatScaleX float 20
param_named splatScaleZ float 20
}

fragment_program_ref ET/Programs/PSSplat
{
}

texture_unit
{
// will be dynamically generated by the splatting manager
texture ETSplatting0
}

texture_unit
{
texture splatting0.png
}


texture_unit
{
texture splatting1.png
}

texture_unit
{
texture splatting2.png
}

}

pass
{
// second splatting pass

lighting off

scene_blend add

vertex_program_ref ET/Programs/VSLodMorph
{
param_named splatScaleX float 20
param_named splatScaleZ float 20
}

fragment_program_ref ET/Programs/PSSplat
{
}

texture_unit
{
// will be dynamically generated by the splatting manager
texture ETSplatting1
}

texture_unit
{
texture splatting3.png
}

texture_unit
{
texture splatting4.png
}


texture_unit
{
texture splatting5.png
}

}

pass
{
// lightmap texture pass

scene_blend modulate

vertex_program_ref ET/Programs/VSLodMorph
{
param_named splatScaleX float 20
param_named splatScaleZ float 20
param_named_auto morphFactor custom 77
}

fragment_program_ref ET/Programs/PSLighting
{
}

texture_unit
{
// dynamically created
texture ETLightmap
}
}



}
}


Thanks for your time and any help or guidance is greatly appreciated.

Thanks,
Jonathan Jones

CABAListic

17-02-2009 23:02:13

Your first pass must be scene_blend add, not modulate.

trnrez

17-02-2009 23:11:57

Your first pass must be scene_blend add, not modulate.

Still draws straight black. I am using the ETSample application and getting the same results of a black terrain.

Terrain file
Splatting Texture

CABAListic

18-02-2009 09:37:51

Sorry, I was mistaken. Your first pass has to be scene_blend replace, your second (the splatting pass) has to be scene_blend add. Then, at least, you should see something.

However, this will not work correctly. It will overdraw. I'm not sure what you want to accomplish with the base texture, but I'd really recommend including it in the standard splatting procedure. To get a base texture under the splatting is rather complicated. Currently, your setup will paint the base texture with 100% opacity. But the splatting will also be drawn with 100% opacity, so that you will get an overlighted or possibly white result. To pull it off, you would have to split opacity between the base texture and the splatting.

trnrez

18-02-2009 16:04:14

I'm not sure what you want to accomplish with the base texture, but I'd really recommend including it in the standard splatting procedure.

I am going to be using a satellite image as the base texture so that my asset artist can use that for reference as he paints on top of it. It wouldn't be kept for the final product just for asset creation.

How do I go about telling it that I want it to use one splatting texture at a scale of 1x1 and then the rest at 20x20? I tried the following but it still draws the first splatting texture as 20x20 :(

// primary splatting technique, requires PS 2.0
// has issues with OpenGL rendering, though...
pass
{
// splatting pass

lighting off
scene_blend replace

vertex_program_ref ET/Programs/VSLodMorph2
{
}

fragment_program_ref ET/Programs/PSSplat2
{
param_named splatScaleX float 1
param_named splatScaleZ float 1
}

texture_unit
{
// first coverage map, dynamically managed
texture ETSplatting0
}
texture_unit
{
// second coverage map, dynamically managed
texture ETSplatting1
}

// splatting textures
texture_unit
{
texture ETterrain_Texture.jpg
}

vertex_program_ref ET/Programs/VSLodMorph2
{
}
fragment_program_ref ET/Programs/PSSplat2
{
param_named splatScaleX float 20
param_named splatScaleZ float 20
}
texture_unit
{
texture splatting1.png
}
texture_unit
{
texture splatting2.png
}
texture_unit
{
texture splatting3.png
}
texture_unit
{
texture splatting4.png
}
texture_unit
{
texture splatting5.png
}
}

CABAListic

18-02-2009 16:51:22

A pass can only have a single fragment program, so what you're trying to do doesn't work that way. You will have to modify the shader; there you need to disable the scaling by splatScaleX and splatScaleZ for the first texture.

trnrez

18-02-2009 17:22:58

A pass can only have a single fragment program, so what you're trying to do doesn't work that way. You will have to modify the shader; there you need to disable the scaling by splatScaleX and splatScaleZ for the first texture.

You are awesome!!! Thanks for the help! :mrgreen: