Hi, i’ve recently been messing around with texture splatting on a simple landscape demo and am currently blending between two different textures using an alpha map using the following code
myGL.glActiveTexture(GL.GL_TEXTURE0);
myGL.glBindTexture(GL.GL_TEXTURE_2D, textures[0]);
myGL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_COMBINE);
myGL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_COMBINE_RGB, GL.GL_INTERPOLATE);
myGL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_SOURCE0_RGB, GL.GL_TEXTURE0);
myGL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_OPERAND0_RGB, GL.GL_SRC_COLOR);
myGL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_SOURCE1_RGB, GL.GL_TEXTURE1);
myGL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_OPERAND1_RGB, GL.GL_SRC_COLOR);
myGL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_SOURCE2_RGB, GL.GL_TEXTURE2);
myGL.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_OPERAND2_RGB, GL.GL_ONE_MINUS_SRC_ALPHA);
Where unit 0 has one texture, unit 1the texture it’s to be blended with and unit 2 contains the alpha map.
Due to the combination, the textures are no longer modulated and as such my lighting is not being displayed. Does anyone know a way for me to retain lighting values whilst blending?
Incidentally, is there any way to get around the constraint of just 4 texture units being available on Nvidia cards for multitexturing use? i have the three units above taken up as well as another unit for the shadowmap. This has left the number of textures on the landscape sadly lacking as i have only a rock/grass transition.
Apologies for the length of the questions and thanks in advance for any help!