Mask for background animations and transparencies

Previous topic - Next topic

Ian Price

#15
Almost right, but...
Quote-draw a pink (to be transparent) circle over the objects that produce light on this screen 2.
You can't. There is no way to draw a pink (255,0,128) circle onto the black screen unless you build it up out of rectangles. You can't display a pink POLYVECTOR, DRAWLINE, DRAWSPRITE or even SETPIXEL and have it show through as if the pink was transparent. I've tried a hundred and one different ways to do that. You can use DRAWRECT but that requires multipls squares to draw a circle. And you can't change the transparency on the fly with SETTRANSPARENCY.

What i had to do is use the background graphic in the POLYVECTOR and draw it using COS&SIN, which are very slow even from a lookup table.

So I'm drawing -
- background screen
- black virtualsprite with polyvector halos
- drawing virtualsprite over background
- scaling the whole lot up/down to relevant screensize.

The Caanoo  is working really hard to get 30FPS, but it's not really enjoyable.

If I could find a way to draw the pink circle without COS&SIN (or even without POLYVECTOR) I think this would be playable. However I asked Gernot about this for something else I was doing back in September and he couldn't come up with another answer. In fact you took part in the discussion erico - http://www.glbasic.com/forum/index.php?topic=8587.msg72601#msg72601
I came. I saw. I played.

erico

QuoteYou can't. There is no way to draw a pink (255,0,128) circle onto the black screen unless you build it up out of rectangles. You can't display a pink POLYVECTOR, DRAWLINE, DRAWSPRITE or even SETPIXEL and have it show through as if the pink was transparent. I've tried a hundred and one different ways to do that. You can use DRAWRECT but that requires multipls squares to draw a circle. And you can't change the transparency on the fly with SETTRANSPARENCY.

Now for a dumb question, can´t you do a PNG sprite of the pink circle and paste it drawsprite style? That way the pink goes on.
I´m not sure when grabbing this virtual screen and applying over the normal one the transparency will remain, but why would not?
I guess I would have to give it a test to check.

Let me re-check that forum topic.

Ian Price

Nope - pasting a transparent sprite won't work. For starters the black background comes through in the pink and even if it didn't, how would you draw the hole transparent, but not the surrounding image anyway. If you draw the outline in black, if you draw two circles interlinked you'd see the black outline.

I've tried literally dozens of different ways to achieve the outcome - now and before. Obviously it does work (on pc very well), but not on lower specced machines. It's something I really wanted in my other game and this, for all formats.
I came. I saw. I played.

erico

Altough I think I´m understanding what you want (ye the hole stuff), there is no way to talk/solve it.
I guess I have to experience it myself to understand it better.

I will give it a go now on a very simple project and test on the caanoo to check it out.
If you tried million ways, and being a more advanced coder than me, I will probably fail.
But there is no other way I can understand it better if not trying.

Let´s see, give me a moment.

erico

So far I can create the virtual screen with pink circles by drawing sprites, but grabbing and pasting it back does not count that pink as transparent at all.
I wonder if it has anything to do with alphatesting as the example on the manual is supposed to show holes.

It dosen´t on my end, on the online manual, it states it is a v11 feature.

Heck, so I will just download the v11 beta and give it go, I think if the alphatesting works as the example there should be no reason my won´t. :rant:

Wampus

Erico so happy you got that performance boost. Its such a buzz to be able to add *more* stuff to a game because of that.

Ian, sometimes there just isn't a way for something to work the same on all formats. I have to wonder if giving up on that kind of visual effect for some platforms and looking for an alternative could be a possible way forward.

erico

I have done the mask as Ian was trying! :)
Let me give a go on the caanoo now!

Ian Price

QuoteIt dosen´t on my end, on the online manual, it states it is a v11 feature.
I suspect that Gernot added it after I brought it up. i haven't downloaded the V11 beta as I need to be able to compile for other platforms - esp Pandora and caanoo. Is this possible in the beta?

QuoteIan, sometimes there just isn't a way for something to work the same on all formats.
I know that. I do already have a work around but it would mean a few level changes for the Caanoo version.

Any luck then erico?
I came. I saw. I played.

Wampus

Oh, I know you'd know that technically. I was wondering whether it was something you were strongly attached to is all.

Ian Price

It's something I wanted to add and the other version severely limits the dramatic effect, but it still adds challenge to the game. So yeah, one way or another it's staying in some form, but maybe limited. Depends on erico's test. :)
I came. I saw. I played.

erico

#25
As usual, it works out on PC.

I´m facing a few problems on the caanoo though, I´m starting to think it dosen´t support virtual screens.

First I thought we could solve the mask problem by using a 32bit PNG, that way, I can print the pink color on the virtual screen.
As for the overlapping, no problem either.

I have been messing with it the whole afternoon.
My last attempts don´t even deal the pink color, just plain black or white.
I can´t seem to settransparency on that, it is all a mixed up confusion.

I will try again using the pink.

Wors case I upload the code here so you can take a look, maybe it inspires.
I do believe there is a way of doing it by using 32bit PNGs and caanoo can deal that as my game was using it to this point.

On the virtual screen, maybe gernot can share some light on that on the caanoo?

EDIT: alphamode 1 does good on PC too, but I think it dosen´t work on caanoo at all, so I´m trying to achieve without it.

Ian Price

You can definitely use a virtual screen on the Caanoo - you've seen the result already in AquaVenture erico. That uses a virtual screen to draw the map on and the creatures etc. are drawn on top and then scaled. There might be limitations on its use though, maybe you can only use one? Dunno.
I came. I saw. I played.

erico

Quote from: Wampus on 2013-Feb-07
Erico so happy you got that performance boost. Its such a buzz to be able to add *more* stuff to a game because of that.

Again, super thanks Wampus, that was really great!

Ian,

Strange, I´m using only one virtual screen, that is to draw a black and white image to be used over the original as a mask.
I think it can be done when using png32bit.

I must rest my mind a bit, will get back to it later, I see no reason why it should not work. :rant:

Ian Price

I have to admit that i have not tried 32Bit .PNG, but you have given me an idea...
I came. I saw. I played.

erico

I actually made it work without alphamode 1 and without grabsprite.

Now I messed so much the code can´t get back to what it was.
This sure pisses me off.

It was suppose to be a surprise hehe! Imagine if a noob like me could resolve such!
But I´m sure it can be resolved somehow.