Inscrit le: 26 Avr 2018
|Posté le: Mer 6 Juin - 13:58 (2018) Sujet du message: Color and alpha blending questions
I'm trying to achieve a couple of basic visual effects in my game, and since shaders aren't supported in Slick (I wouldn't know how to make them anyway), I need help figuring out how to approach creating the visual effects that my game needs.The first effect I need is a "flashlight". In the previous iteration of this game that was done in Swing/AWT in 2013, I created a completely black image with transparency, and then I would blend various shapes (radial gradients or polygons) into to subtract from the darkness and essentially create light, then draw it on top of everything.So far, I have not seen an easy way of achieving this in Slick, but I have been more focused on the second problem, which is that I need to create a "night vision" effect, where I put a slightly transparent gray filter over everything, and then draw a white filter over the enemies so they appear like heat signatures, which would look like infrared night vision. The gray filter doesn't seem like it would be any more difficult than rendering a rectangle with the color (0.4f, 0.4f, 0.4f, 0.25f) or something similar. However, I have not been able to get a "white filter" over my images. Whenever I try to apply the color (1.0f, 1.0f, 1.0f) as a filter color in the g.drawImage() method, it simply draws the image as normal. I'm assuming this is because the color filter is simply a multiplication effect, leading it to just show the original color.I have also tried drawing the image's "flash", then trying various draw modes and drawing the original image over it. The most promising was to color multiply the original image over the flash, but it was not white enough and made the transparent shadows under the enemies look strange.Does anyone know of a way I can achieve this?
I didn't find the right solution from the Internet.
Real Estate Video marketing