Skip to main content
GameDev.net gamedev.net
🔒 Locked

Texture continuity

Started by Civilwar Mar 16, 2011 at 12:53 PM 8 replies 1.6k views
Original Post
Civilwar
Civilwar
Hi,

When I have two different textures side by side, the border looks very strange and unrealistic. I mean this:

borders.jpg

You can see that border between road and grass is just an ungly line.

Is there a way (or some trick) to make border between textures look smooth?

Thanks


Mussi
Mussi
I believe what you are looking for is Texture Blending, try searching for that term.
Civilwar
Civilwar

You either draw transition textures, or you layer them on top of each other and use alpha to blend between them. Look up texture splatting.
http://www.gamedev.n...-direct3d-r2238
That link is exactly what I want - however, it is in D3D and I need OpenGL


So basically, I have "color" texture and alpha texture. But how to put them together? How to draw one texture with alpha channel of another texture?

Daaark
Daaark

[quote name='Daaark' timestamp='1300283141' post='4786505']
You either draw transition textures, or you layer them on top of each other and use alpha to blend between them. Look up texture splatting.
http://www.gamedev.n...-direct3d-r2238
That link is exactly what I want - however, it is in D3D and I need OpenGL


So basically, I have "color" texture and alpha texture. But how to put them together? How to draw one texture with alpha channel of another texture?


[/quote]It doesn't matter. The same techniques can be applied in OpenGL.

Use a shader to draw whatever you want.


Civilwar
Civilwar
Well, I understand technique, but I just don't know HOW to do it ...


Could you give me an example or some link?

Thanks for helping

Daaark
Daaark

Well, I understand technique, but I just don't know HOW to do it ...
The technique is described in the article. Use OpenGL's similar functionality to achieve the same results.

Sample all the textures in a shader, and use the alpha channel in the alpha texture to determine the final pixel color. Use the dirt texture as the base, then add on the grass depending on the alpha texture's value at that pixel.


V-man
V-man
http://www.opengl.org/wiki/Texture_Combiners

you probably want "Blend tex0 and tex1 based on alpha of tex0"
Civilwar
Civilwar

http://www.opengl.or...xture_Combiners
you probably want "Blend tex0 and tex1 based on alpha of tex0"



Warning: This article or section describes material that has been deprecated in OpenGL 3.0, and removed in core GL 3.1 and above implementations. It is recommended that you not use this functionality in your programs. Consider using the OpenGL Shading Language instead.[/quote]

Looks like I have to learn shaders anyway

Thanks for replies.

Topic Locked

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

Sign in to reply to this topic.