How to : Alphablending with EMT_SOLID_2_LAYER

A forum to store posts deemed exceptionally wise and useful
Post Reply
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

How to : Alphablending with EMT_SOLID_2_LAYER

Post by knightoflight »

Hi community,
i made another experiment for displaying terrain. I want to show you. The code is not very good but maybe you find some interesting lines for you, im programming in zen-way ;-)
Its with single-nodes for every tile like the first tutorial from saigumi.
I tested how to use alphablending (is it the right name ?) with the irrlichtmaterial with two texturelayers to delete the seams between two different tiles. Cause thers only two layer, you should not use more than two textures betwenn two tiles.
Click at downloadsection below at
http://zenprogramming.tripod.com

PS:
i forgot the theory:

You have two textures and you want not a hard seam, you want that the textures smooth merge together.
you take a material with more than one texture layer. In this example with two layers EMT_SOLID_2_LAYER .
set with node->setMaterialType(video::EMT_SOLID_2_LAYER );
You set the alpha-value of one or two or tree edges of the texture on top to transparent direct to the vertex with for example, so through the transparent you see the next texture layer:
v[0].Color.setAlpha(254);
Last edited by knightoflight on Mon Aug 09, 2004 8:12 am, edited 1 time in total.
lantis
Posts: 64
Joined: Thu Jun 17, 2004 2:46 pm

Post by lantis »

Any idea how to add light to material with EMT_SOLID_2_LAYER ?
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

sorry, dont know how to add light.

But if you want light to add shadows, you could use different shaded tiles (if the height changes between a tile and the tile right beside, then use a more shaded tile...)
- ok not a super programming solution, but costs no fps.
exe_exe_5

Post by exe_exe_5 »

It's cool but really slow. I tried to use it for FPP and with viewsizex==70 there is 10 000 polys and 10 fps, about ten times slower than it should be :/
knightoflight
Posts: 199
Joined: Sun Aug 24, 2003 5:47 pm
Location: Germany

Post by knightoflight »

Thanks for the "cool" :) I think its slow cause every tile is a node. Like i wrote its a demo for alphablending - not a demo for good performance. In the project-section someone is building a new terrain-node, maybe it would be the right for you.
Post Reply