Skip to main content
gamedev.net
🔒 Locked

Texture combiners

Started by blue_gfx 0 replies 700+ views
Original Post
blue_gfx
blue_gfx
I'm trying to modelate snow falling on ground. My terrain is textured using one 2D grayscale texture for details and another 1D texture to apply color per height. When snowfalls get on terrain I want the terrain to slowly blend to white (geometry color). //---------------------------------------------------------------------- // bind the detail texture to the first unit glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, m_grassTexture); glEnable(GL_TEXTURE_2D); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);//GL_REPLACE // bind the height texture to the second unit glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_1D, m_heightTexture); glEnable(GL_TEXTURE_1D); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR); glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_CONSTANT); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR); float mycolor[4]; mycolor[0]=mycolor[1]=mycolor[2]=0.9; // blend factor is set by color //mycolor[3]=0.8; glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, mycolor); //---------------------------------------------------------------------- But it seams that GL_PREVIOUS refers to Unit1 texture , not to the result of Unit1 + Unit2 . How cam I get the result Unit1+Unit2 and blend it with the geometry color ?
blue_gfx
blue_gfx
Nobody knows how to take the result of modulating two textures and blend it to white ?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.