Ziz
Advanced Member
- Joined
- Jan 15, 2006
- Messages
- 3,583
Hi folks,
after a long time I did a small change, I would like to share with you. In fact I work right now on other projects (somewhere I have to start to finish my stuff, and working on every project at the same time doesn't sound wise to me), but when I do some changes on sparrow3d (what is of course my main project, which will never be finished I think ) and think, that these changes would be nice in one of my projects, I add them there.
So this will be semisparrowthread, because the big change is in sparrow3d - I just use it in Schwerkraft.
The last days I had a nice idea about alpha "blending". The problem is, that alpha blending is very slow if I do it on the CPU, so a real blend operation was not possible. But I had another quite good idea. As the pandora and most modern openhandheld consoles (even my gp2x!) has very small pixels, I can use a 8x8 pattern for alpha operation! I don't want to bore you with details. I implemented some magic stuff, that you can add a pattern layer to all drawn (even bliting!) functions, which is pretty fast (much faster than real alpha blending). Such a "layer" for a 0.5 alpha value could be:
1 would be drawn, 0 not. So I draw 50% of the pixels, what is some kind of discretization of alpha blending. XD
For smaller or greater alpha values I use a pattern with fewer or more set bits in the pattern mask. For the gas planets in schwerkraft (which looks VERY shitty), I used the alpha value 0.25, which means, that only 1/4 of the pixels will be drawn. That looks so:
Pretty cool, isn't it?
Another big advantage is, that I don't have to sort alpha seperatly like you have to do it in OpenGL.
greetings,
Ziz
after a long time I did a small change, I would like to share with you. In fact I work right now on other projects (somewhere I have to start to finish my stuff, and working on every project at the same time doesn't sound wise to me), but when I do some changes on sparrow3d (what is of course my main project, which will never be finished I think ) and think, that these changes would be nice in one of my projects, I add them there.
So this will be semisparrowthread, because the big change is in sparrow3d - I just use it in Schwerkraft.
The last days I had a nice idea about alpha "blending". The problem is, that alpha blending is very slow if I do it on the CPU, so a real blend operation was not possible. But I had another quite good idea. As the pandora and most modern openhandheld consoles (even my gp2x!) has very small pixels, I can use a 8x8 pattern for alpha operation! I don't want to bore you with details. I implemented some magic stuff, that you can add a pattern layer to all drawn (even bliting!) functions, which is pretty fast (much faster than real alpha blending). Such a "layer" for a 0.5 alpha value could be:
Code:
01010101
10101010
01010101
10101010
01010101
10101010
01010101
10101010
1 would be drawn, 0 not. So I draw 50% of the pixels, what is some kind of discretization of alpha blending. XD
For smaller or greater alpha values I use a pattern with fewer or more set bits in the pattern mask. For the gas planets in schwerkraft (which looks VERY shitty), I used the alpha value 0.25, which means, that only 1/4 of the pixels will be drawn. That looks so:
Pretty cool, isn't it?
Another big advantage is, that I don't have to sort alpha seperatly like you have to do it in OpenGL.
greetings,
Ziz