Page 1 of 1

(ray)Castling: another light engine

Posted: Tue Aug 23, 2016 11:08 pm
by cval
Prove me if i'm wrong when i say that community needs more light/shadow engine to illuminate their scenes.

Castling is another implementation of "pixel-perfect" light/shadow technique that is based on some shader sources i've found on the net. The aim was to create a lighting engine that does not choke on more than 10 lightsources and still provide decent light/shadow rendering and also be flexible enough to be able to tune shadowmaps and stuff to eliminate rendering overhead when scene clearly does not need that level of quality much.

https://github.com/mkdxdx/Castling

Library was initially created with aim for scenes that use spritebatches so that occlusion will be drawn in one draw call, hence there might be usage specifics because of that.

I get the perfomance i need in my projects, however i become desperate when i think about all those redundant canvas switch calls. Turns out they are the biggest bottleneck.

Some screenshots:
love 2016-08-24 01-45-41-55.png
love 2016-08-24 01-45-41-55.png (345.41 KiB) Viewed 2725 times
FOV mode
love 2016-08-24 01-46-18-83.png
love 2016-08-24 01-46-18-83.png (115.06 KiB) Viewed 2725 times
And an example .love file to touch stuff. Tested on 0.10.1.

Scene control:
-- arrows control camera position
-- Q/A,W/S,E/D +/- RGB of current lightsource accordingly
-- R/F +/- current lightsource elevation value
-- Space toggles shadow casting mode of current lightsource
-- Enter toggles shadow blur
-- Y/H,U/J +/- Shear X and Y
-- Home toggles occlusion prerender
-- 1/2,3/4,5/6 +/- Ambient RGB
-- Left CTRL toggles FOV mode

-- left click places lightsource
-- right click places a figure with shadow
-- mouse scroll controls camera scale
castling.love
(40.81 KiB) Downloaded 212 times