Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to make transitions between two textures?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Sabat   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 April 2000 - 09:16 AM

Rendering a landscape, how can i blend a texture to make the transition between two (or more) textures?. I had seen this stuff in some terrain demos. Thanks.

Sponsor:

#2 AnalGoat   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 April 2000 - 09:30 AM

Multi-texturing? Just a guess as to one way you could do this. Essentially blending textures together.

#3 Danack   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 April 2000 - 11:30 PM

Do you mean like as you go up the side of a mountain you blend smoothly from a grass to a rock texture ?

If so then you can do it by rendering it twice and having per vertex alpha blending on the second go, ie you have a quad you want to blend the textures across

***********************
***********************
*Grass**Blend****Rock**
***********************
***********************
***********************

So you render it once as all Grass and then render it again, with the alpha values set at the vertices as shown:

0.0
*********************** 1.0
***********************
******Rock*************
***********************
*********************** 1.0
0.0

and using the blend function glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );


so the code would look like:

glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

glBegin( GL_QUADS );

glNormal3f( 0.0f , 1.0f, 0.0f );

glColor4f( 1.0f, 1.0f, 1.0f, 0.0f );
glTexCoord2f( 0.0f, 0.0f );
glVertex3f( ... );

glColor4f( 1.0f, 1.0f, 1.0f, 0.0f );
glTexCoord2f( 1.0f, 0.0f );
glVertex3f( ... );

glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
glTexCoord2f( 1.0f, 1.0f );
glVertex3f( ... );

glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
glTexCoord2f( 0.0f, 1.0f );
glVertex3f( ... );

glEnd();


You could probably also do this by using the multi-texturing extension but i don't know how to do this yet

dan

ps watch out! i think i might have the corners in the wrong order...


Edited by - Danack on 4/27/00 5:33:38 AM

#4 Sabat   Members   -  Reputation: 122

Like
Likes
Like

Posted 28 April 2000 - 10:42 AM

Thanks for your reply Danack!!!!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS