Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / How to use multiply drawing mode in Gosu?
- By banister Date 2010-06-05 05:49
Mathias added the multiply drawing mode to Gosu, how do i use it?

thanks
- By jlnr (dev) Date 2010-06-07 09:19
Pass :multiply for the mode parameter, at least this SHOULD work, I tried it once!! ;)
- By kyonides Date 2010-06-08 00:45
Why would you need to multiply the drawing mode?
- By banister Date 2010-06-08 13:54
I think this drawing mode could be useful for implementing dynamic lighting
- By jlnr (dev) Date 2010-06-08 17:41 Edited 2010-06-08 17:54
Well, if you just want to darken stuff, drawing transparent black over it should have the same effect. I used multiplication in Photoshop before, say to "square" the brightness of stuff (or to take the square root, depending on how you see it). Not quite sure what can be done with it so far :)

(Also, my IRC bouncer somehow died, but: :multiply works for me? Gosu::VERSION = ?)
- By banister Date 2010-06-08 22:48
well the idea is i first darken the scene using an image to halve teh color values, then i can put on top of that a spotlight that is just a filled-circle image that does the opposite (multiplies color values by 2). This way i can get a spotlight effect very easily. Using floating point colors this is very easy as you make the darkening image just [1, 0.5, 0.5, 0.5] and then the smaller spotlight image [1, 2, 2, 2] and then just apply all with drawing mode :multiply
- By erisdiscord Date 2010-06-09 00:42
You can't really define a color as 0xGGGGGG though—how would you do superwhite with Gosu? :)

I think a spotlight effect could also be achieved using shaders—sorry, I think they're cool! I might play with the shader library from this forum and try just that, for science.
- By banister Date 2010-06-09 05:44 Edited 2010-06-09 06:57
yeah, i'm discovering it's impossible to define colors with channels > 255. Fair enough i guess. Howver another approach is just to define a texture with all colors set at 127 (to halve the brightness of the background image) -- but to keep a circular area with color channels at 255. Moving this 'lightmap' image over the background and drawing with :multiply should give a fairly good spotlight effect, esp. if you have a fuzzy border for the circular area.

Haven't looked into shaders yet but if i can achieve a fairly good effect using this approach then i'll be happy enough :)
- By jlnr (dev) Date 2010-06-09 08:14
That would have been possible with the old (:default) mode too though ;)
Up Topic Gosu / Gosu Exchange / How to use multiply drawing mode in Gosu?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill