Fading parts of the screen
Blitz3D Forums/Blitz3D Beginners Area/Fading parts of the screen
| ||
@all, what is the best method to "fade to/from black" just a portion of the screen. Say I have a userinterface and inside there is a picture I want to fade, without fading the actual interface. is this where commands such as origin and viewport come in handy? |
| ||
Create a Sptite and color it black, use it's alpha to blend it from visible to not visible. whatever's behind it will fade, windowed or fullscreen..... |
| ||
I forgot to mention that I am using BlitzPlus |
| ||
there are two methods: Real time fade, or pre-rendered fade. Real-time can be slow (depending on the size of the area you are fading and the specs of the machine). Pre-Rendered is faster but uses more RAM since it needs to store all the frames. For real time, take a look in the code archives. |
| ||
If it is an image you use a lot then throw the rgb values into an array and do a wpf in a loop and modify the value each frame. If the size isn't too large this can be done rather fast. On a P4 2.4ghz with a decent gfx card you can do this for a 800x600 screen at about 30-35 fps. So if its just a small square it should be something you could do. |
| ||
@all I have looked at every single piece of code in the code archieves, and also at every code sample on www.blitzcoder.com So far I have *NOT* seen ANY code that does a fade to/from black fullscreen in BlitzPlus. Either all code fades from one single color to another (useless for fading an entire bitmap) or otherwise all sample code uses B3D. I have come to the conclusion that I manually need to lock the entire screen and use readpixelfast() / writepixelfast() or use GetColor()/setcolor() I need to experiment |
| ||
Yes you can do it with lockpixels and rpf/wpf and you should be able to get an ok fps. Just jump 5-10 instead of 1 each frame or the fade might be to slow looking. |
| ||
@Zawran Thanks, I will try your suggestion |