Combining two images.
BlitzMax Forums/BlitzMax Programming/Combining two images.
| ||
Hey, What would be the most painless way to combine 2 images using a black/white mask (alpha is a must)? I know I could write a shader and hack my way into max2d but I'm hoping not to have to do that. The reason I need this is to combine two tiles on a isometric game(like grass and mud). Thanks. |
| ||
WOWOWOW I had the exact same problem in this thread and found a fix. I'm working on a solution that hopefully won't require modifying the brl code and will work with DirectX too. http://blitzbasic.com/Community/posts.php?topic=94692 Last edited 2011 |
| ||
-_- I actually did a search for this but like 2 weeks ago. And after posting I was searching again and then I found your sollution. I don't have time to add it right now but I hope you can answer this: What you have uses the color (black/white) right? What would happen if I also use alpha when drawing the 3 images? I'm hoping that where alpha is 0 there is nothing drawn. Thanks a lot btw Last edited 2011 |
| ||
It doesn't use any colour. The appearence of colour is just the way the png is drawn by the browser. The colour of the entire mask is black. The gradient is in the alpha channel. Depending whether you select mask on or mask off blending modes, it will draw the image either when the alpha is 1 or 0 (or vice versa). An alpha of 0.5 would be a mixture of the two images. |
| ||
I've done some tests and it has one major flaw: It doesn't take in account the alpha of the 2 images. In my case where the alpha is 0 it's black so it will draw that black on the buffer. This pretty much makes combining different iso tiles impossible. I suppose I'll have to do something and add shader functionality to bmax. This will anyway help with other things like water. Still, thanks a lot dude:) I'll share what I'll manage to do here.I don't promises anything for DirectX. |
| ||
You could use pixmaps, too. |
| ||
Could you use a mask colour such as purple for the transparent parts of the iso tile? My game is not isometric, so I didn't think of that problem :( |