SFML community forums
Help => Graphics => Topic started by: Lo-X on June 27, 2011, 07:20:21 pm
-
Hi,
I would like to have a big Flash Light for my game when something explode.
But I don't know how to proceed, I think that I may use Shaders, but on what ?
A sprite ? The shader will only be applied on the texture of the sprite so, bad idea
A render image ? But how can I have the flash ?
If you have some advices, it will be with pleasure =)
-
You could flash the whole screen with a white image. ...but people might get an hearth attack because of it. What you could also do is shake the camera a little. :)
-
You could flash the whole screen with a white image. ...but people might get an hearth attack because of it. What you could also do is shake the camera a little. :)
Shake the camera is a great idea, but flash the whole screen is a bit radical.
Edit : I found this : http://www.gamedev.net/topic/304874-looking-for-spotlight-shader-tutorial/
Someone say that Shader is not the great solution, so I will searsh with the light manager tutorial on the wiki
-
Create a sprite graphic in an image editor that is a circular gradient which fades out the transparency along with the colours (use greys); so it would be white in the middle, going out to dark/transparent.
In the game place the sprite where the light bloom should be then expand its X/Y scale quickly whilst rapidly reducing the alpha channel to zero.
I stumbled across this while working on my game (a spacey shooter) and it's very effective indeed, without the need for shaders. It creates a very convincing flash of light.
Let me know if you want an example .PNG and I'll send it to you.
** EDIT -> Additive blend mode is your friend.
-
Yes if you can show me an example
I thought about the blend mode while reading a light tutorial
and.. thank you !
-
Here's the .PNG which is 192x192 size for up-scaling purposes:
(http://www.jestofevekites.com/markc/bloom.png)
Here's what it looks like in action :
(http://www.jestofevekites.com/markc/screengrab.png)
On the far right is the player's ship being hit and shedding particles. Around the ship is the light flash/bloom effect from the above image.
You can actually do quite a lot of very impressive visual effects with SFML just using the right kind of images and some particle code/blending techniques. The same lightweight particle engine I use to create that effect can also easily create sparks (just visible) and also great big fire effects!
Hope this helps.
-
Hope this helps.
Yes a lot. Big fat thank you :D
Ps: I've made my own flash image
-
Creepers! Creepers everywhere!