Fast light processing

About advanced scenes, and the Thyme scripting language used in Algodoo.

Fast light processing

Postby Kilinich » Tue Oct 26, 2010 4:35 pm

Since algodoo 1.8.0 became more than twice slower thyme than 1.6.0 I've try to optimize some of my functions.

Here it is simple brightness calculation:

Code: Select all
Scene.my.min := (x)=>{x > 0.2 ? x : 0.2};
Scene.my.fl := (n, r)=>{0.1 + scene.my.min(n(0) * r(0) + n(1) * r(1)) / (r(1) * r(1) + r(0) * r(0))};


n - normal vector to geom surface
r - vector to light source

In that example I've store normal in [friction, restitution] pair.
16 geoms gives ~50FPS on my pc. Can't do better atm.

Rating: rated 7
Filesize: 4.01 kB
Comments: 1
Ratings: 6
download
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests