Simple splatting question

I know this has probably been answered somewhere, but my search didn't find it, so maybe one of you can help.

What function(s) do I use to get the different color channels in a single alphamap for splatting?  Right now I use 4 different alphamaps for 4 different textures, but I want to use 1 alphamap for all 4 (using the R, G, B, and A channels of that file).  I know it can be done, I just don't know how to access those channels individually.

This would be done outside of jME.  We do it at work using Java 2d image code.

If you're using a shader you can just load your alpha texture color into a vec4 and access the components individually to do splatting, e.g:

vec4 alpha = texture2D(alphamap, texCoord);
// ...
gl_FragColor = texture2D(colormap1, texCoord) * alpha.r + texture2D(colormap2, texCoord) * alpha.g // ... etc

Thanks, those answers were exactly what I needed to know  :smiley:

Ah, sorry I thought you'd asked how to merge the 4 images in jME.