Merging textures

Hello, recently I have encountered a small limitation with my project. Within blender it is possible to assign more than one texture to a material. I have used two textures in one material, each overlap. The lighting shader in JME does not seem to have this capability, Is there a way to accomplish this without resizing and overlapping them in GIMP, because one of the textures is 3280x1080. Here is a screen from blender to show you what I mean;



http://i.imgur.com/68kn6.png



The texture on the floor is made up from the texture on the rocks and the one on the volcano.

There is no way to do this with the default shaders so you have to write your own. Maybe there is some way to make the terrain do what you want, I’m not sure if that fits your ultimate usage, though.



Also, non-power-of-two textures will pose problems on certain hardware so those texture sizes will limit who can run your game.

im pretty sure in the unshaded.jm3d, there is a Lightmap and it merges together with the ColorMap, if i remember correctly, could be wrong tho

Right thanks, I think I shall just blend them in Gimp, and thanks so much for telling me about the textures, I have been wondering how to get a higher frame rate out of it.



I really need to get round to watching wezrule’s shader videos.

In it’s simplest form… a frag shader for blending 2 images would look like this:



[java]

uniform sampler2D m_Map1;

uniform sampler2D m_Map2;

varying vec2 texCoord1;



void main(){

vec4 color = vec4(1.0);

color *= texture2D(m_Map1, texCoord1);

color *= texture2D(m_Map2, texCoord1);



gl_FragColor = color;

}

[/java]



Alternately, you could use the mix function… and lastly you could add up the sum of X number of samples and divide by the number of samples you took.

The terrain material already allows you to mix many textures at once based on an alpha map, no need to make new shaders.

and if you want to use lighting + normalMap, he need to edit JME Lighting and mix(before calculations) both diffuseMaps + normalMaps.

@oxplay2 said:
and if you want to use lighting + normalMap, he need to edit JME Lighting and mix(before calculations) both diffuseMaps + normalMaps.

The terrain shader supports normal maps