Masking Question

BlitzMax Forums/BlitzMax Programming/Masking Question

AvestheFox(Posted 2011) [#1]
So I want to apply a shadowmap over my in-game tile map. But to do this I need to mask out the background which is paralaxed behind the tilemap (and it just looks silly with the shadowmap effecting it as well as the main foreground tilemap)

how would I go about doing this?


AvestheFox(Posted 2011) [#2]
I'ma guess this isnt possible without certain complications... :P


Czar Flavius(Posted 2011) [#3]
I'm not sure what you are asking. Could you mock up an example image?


AvestheFox(Posted 2011) [#4]


hope that helps :)


AvestheFox(Posted 2011) [#5]
I've been toying with the blend modes since before I posted this thread and I've still got nothing... :P

the only conclusion I have would be that I'd need to combine all the layers into one big image but I can see several problems with that conclusion.

So I'm still asking (begging is more like it) the community here, is there not a way I can do this?

Any help here would be greatly appreciated!

Last edited 2011


AltanilConard(Posted 2011) [#6]
I can't think of an easy solution to this... You could draw you tilemap, draw the shadowmap, then grab the image it (ugly method).

Or maybe cut the shadowmap into tile sized squares, then draw the corresponding square over each tile. It might get messy at the edges though. Just some ideas.


ImaginaryHuman(Posted 2011) [#7]
Ever thought of using AlphaBlend and drawing `black rectangle tiles` instead, and then using the alpha channel of the black tiles to designate the shape needed? Ie create a set of color graphic tiles and a set of black tiles which both have the same alpha?

After all alphablend is kind of a multiply operation based on a cross-fade.

Last edited 2011


Noobody(Posted 2011) [#8]
The way I see it, your lighting information works on a per-tile basis anyway. So how about, instead of drawing the tilemap and then multiplying the lightmap on top, specifying the tile color directly? I.e. you store a lighting value per tile and when you draw your tilemap, you set the current color with SetColor for each tile accordingly when it's being drawn.

That should light the tiles and still leave the background fully lit.


AvestheFox(Posted 2011) [#9]
@Conard I've considered those ideas, but the problem would be that I'd want everything in the foreground to be effected by the lighting, that's including active entities such as the player, enemies, items, etc. good suggestions nonetheless. Thanks! :)

@ImaginaryHuman I think I understand what your meaning. Its something to consider. thanks! :)

@Nobody I'd have to say I think your advise is probably the best. I could just keep the color information stored on the shading layer and what ever tile (or entity) is in the same x and y coordinates as the shade tile that same information would then be applied to the targeted tile or entity... That probably doesn't make a whole lotta sense (not sure how to word it correctly atm :P ) but let's just say that I had a certain realization thanks to your advise. Thanks! :D


Czar Flavius(Posted 2011) [#10]
I need to put the images for this post back up.. maybe it can help

http://www.blitzbasic.com/Community/posts.php?topic=94692


ImaginaryHuman(Posted 2011) [#11]
If you want to go OpenGL only you can add a stencil buffer and mask out the parts you don't want to draw on.