Real-Time 2D HTML5 Lighting FX

Monkey Archive Forums/Monkey Projects/Real-Time 2D HTML5 Lighting FX

Richard Betson(Posted 2011) [#1]
Real-Time 2D HTML5 Lighting FX
http://redeyeware.uphero.com/monkey/HTML5_2d_realtime_lighting/html5/MonkeyGame.html

Hi,
This is a 2D real-time lighting effect for HTML5 using 'impixi's' canvas wrapper mod (http://www.monkeycoder.co.nz/Community/posts.php?topic=1885). It uses the radial gradient fill for a poly (the size of the canvas) to simulate a lighting effect over a background. This is a bit of a hack but would work for game lighting perhaps.

Cycles through 4 effects.

* EDIT *
Fixed for IE9 and FireFox


Beaker(Posted 2011) [#2]
13fps on iPad2.
60fps in Safari.
Doesn't seem to run in Firefox (v8.0.1).

Looks good.


DruggedBunny(Posted 2011) [#3]
Nice -- 36 FPS in Chrome here, on XP, which looks perfectly smooth.


Goodlookinguy(Posted 2011) [#4]
Neat effects. I'm getting 60/61 FPS on all tests on Chrome (version 17.0.942.0 dev-m). In FireFox 8.0.1, I'm also not able to get it to run.

Edit/Update: I tested this in FireFox (Aurora) 10.0a2 (2011-12-06) and it also didn't run.


impixi(Posted 2011) [#5]
Nice. 59/61 FPS Chrome 16. Doesn't do anything in IE9.


therevills(Posted 2011) [#6]
How long does it take to load? I've left it for a few minutes and all I get is a blank screen with the text: RedEyeWare - Go Back to Monkey Demos

Running FF 8.


slenkar(Posted 2011) [#7]
I get the blank screen with FF9


NoOdle(Posted 2011) [#8]
works fine with safari, solid 60fps on my macbook. Very nice :)


therevills(Posted 2011) [#9]
Blank screen with IE9 too...

Just tried Chrome and works fine there - cool!


Richard Betson(Posted 2011) [#10]
Yup, this 'does not run' on FireFox or IE9, interesting.. but rocks on Chrome/Safari I will try to get Impixi to see if he can help get it IE9/FF comaptible. I'll poke around a bit too, I am sure it's something I got wrong as impixi's gradient-poly demo works on all browsers.

Here is the source for this:

* EDIT * - Fixed for IE9 and FireFox



L8r,


Richard Betson(Posted 2011) [#11]
OK,

I fixed the problem and this should work with IE9 and FireFox. I was passing the Hex string incorrectly.

Let me know if it works for you:)

L8r,
- Rich -


semar(Posted 2011) [#12]
30-33 FPS on Firefox 4.0b12 (on a openSUSE 11.4 O.S.)

Sergio.


slenkar(Posted 2011) [#13]
yep it works now, FF9
I got 8FPS with a celeron from 2003

Nice demo


Why0Why(Posted 2011) [#14]
61 FPS for me in Chrome. I love how it looks.


bruZard(Posted 2011) [#15]
very cool, 61 FPS in Firefox 8.0.1


jayparker(Posted 2011) [#16]
32-36 FPS in Firefox 8.0.1 and smooth.

30-61 FPS in Chrome 15.0.874.121


Goodlookinguy(Posted 2011) [#17]
Main Computer (Stats In Signature)
Firefox 10.0a2 (2011-12-07) : 61 FPS Steady
Chrome (version 17.0.942.0 dev-m) : 61 FPS Steady

Computer 2 (2.7GHz 6-cores, ATI HD 5770, 8GB DDR3 RAM)
Firefox 10.0a2 (2011-12-06)
- Test 1 : 50-52 FPS
- Test 2 : 50-52 FPS
- Test 3 : 48-54 FPS
- Test 4 : 50-51 FPS

Chrome (version 17.0.942.0 dev-m)
- Test 1 : 61 FPS
- Test 2 : 38-39 FPS
- Test 3 : 37-38 FPS
- Test 4 : 61 FPS

iMac (3.4GHz 4 Cores, AMD Radeon HD 6970M, 16GB DDR3)
Chrome (version 17.0.963.2 dev): 61 FPS Steady

It's interesting. Firefox was more consistent overall VS Chrome which was faster at certain parts and quite a bit slower at others. Regardless of the number of frames, to the eye, all tests looked very smooth.


Richard Betson(Posted 2011) [#18]
^Thanks for testing. :)

Chrome which was faster at certain parts and quite a bit slower at others


I have noticed this too and I have wondered why this happens. I have even tried different canvas sizes, optimization's and alike trying to adapt to it. It feels like it's threading issues, not sure.


dopeyrulz(Posted 2011) [#19]
Working fine in IE9 - 39 FPS on my laptop