🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Texture Blending

Started by
11 comments, last by Blue*Omega 23 years, 11 months ago
I know that it''s possible to blend colors on a polygon (set each vertice to a different color) but can you do the same thing with textures? How? ----------------------------- Blue*Omega (Insert Witty Quote Here)
// Tojiart
Advertisement
Here''s a cheap method for OpenGL. I''m not saying it works but it could. It does involve multipass texturing, so you need to know how to do that..

    // setup(enable blending, multipass texturing)// triangle, first pass(set texture to first vertex''s texture)(draw vertex 1, alpha 1.0)(draw vertex 2, alpha 0.0)(draw vertex 3, alpha 0.0)// triangle, second pass(set texture to second vertex''s texture)(draw vertex 1, alpha 0.0)(draw vertex 2, alpha 1.0)(draw vertex 3, alpha 0.0)// triangle, third pass(set texture to third vertex''s textures)(draw vertex 1, alpha 0.0)(draw vertex 2, alpha 0.0)(draw vertex 3, alpha 1.0)    


I''m not sure if this would work, or result in having a transparent center. If it does make the center semi-transparent, you could modify the first pass to have alpha 1.0 on all values. That would probably work right.. however, this method is extremely slow (triple pass texturing!).

If you''re working on a software engine, it should be fairly simple to modify your texture mapper to interpolate color values from different texture sources, especially if you''re already using bilinear filtering (they could both be implemented in the same algorithm).

-RWarden (roberte@maui.net)

Well... I tried the above method and it worked fine but... what a preformance hit! That TRIPLES the polys evry frame! More if you use quads. any other suggestions... Please...

-----------------------------

Blue*Omega

(Insert Witty Quote Here)
// Tojiart
Hi Blue*Omega,

I wonder why u need to blend color when u use a Texture.

If it''s for blend the lighting to the poly, use normal at each vertex.

Elseway tell me why u need to do this, i will try to help you !!

LowRad
Im trying to do a landscape texturemap and interpolate textures according to height. (did that make sense?) I could do a Huge texturemap and get all the little details I want but... that would take loads of memory. Anyways, I know about normals and shading and color blending and such, I just want to know how to do it with texture maps.

-----------------------------

Blue*Omega

(Insert Witty Quote Here)
// Tojiart
ya it''s possible and pretty easy. let me make sure know what effect you''re trying to get. blending as in alpha blending?
glEnable(GL_BLEND);
glBlendFunc(...);
yada yada
for a glass or transparency effect? or actually mixing the textures?

JoeMont001@aol.com www.polarisoft.n3.net
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
No, sorry if I haven''t been to clear, but I know how to do transparency and the like. I want to MIX textures.

crappy ASCII example:

texture 1 texture 2
\ /
*---------*
| /
| /
| / texture 1 = grass;
| / texture 2 = sand;
| / texture 3 = rock;
| /
| /
| /
|/
* - texture 3


I want the textures to sort of "fade" into each other. Can it be done without overlapping triangles? sorry for the confusion.

-----------------------------

Blue*Omega

(Insert Witty Quote Here)
// Tojiart
aww shoot! The stupid message board screwed up my ascii triangle!


-----------------------------

Blue*Omega

(Insert Witty Quote Here)
// Tojiart
This is in no way related to your problem, but you can use to draw with spaces.<br><br><pre><br>|----------/<br>| /<br>| /<br>| /<br>| /<br>| /<br>| /<br>| /<br>| /<br>| /<br>|/<br> </pre> <br><br>EL <br><br>----------------------------------------<br>"Inash neteia haeg joa kavari quilm..." SD4
----------------------------------------"Inash neteia haeg joa kavari quilm..." SD4
the only way i can see ( i''ld like to hear others ) is to use a plain grass texture and blend the rocks over it using an alpha channel on the rocks. ive tried to use just a plain grass texture a plain rocks texture and another bw texture to specify the blending of the 2 previous textures but i haven''t as yet been able to find a fast way

This topic is closed to new replies.

Advertisement