A lighting model made for love 2d
Go to file
2014-12-20 00:21:00 -05:00
examples took out debug box in short exammple 2014-12-11 22:00:06 -05:00
lib just a bit of a refactor that should be a bit of an optimizations because I wont be sending a buffer several time for no reason 2014-12-20 00:21:00 -05:00
.gitignore added back in some options in the short example to give a better refraction example 2014-12-11 21:58:18 -05:00
conf.lua just some reformatting 2014-11-07 09:21:41 -05:00
LICENSE had to add myself to the license 2014-10-24 14:36:00 -04:00
main.lua added back in some options in the short example to give a better refraction example 2014-12-11 21:58:18 -05:00
README.md Update README.md 2014-12-05 09:59:17 -05:00

light_world.lua

This is the light modeling done by Priorblue here, only it has been largely refactored and edited to allow for scaling and proper translation.

Installation

Copy and rename the lib folder into your project.

How to use

local LightWorld = require "lib" --the path to where light_world is (in this repo "lib")

--create light world
function love.load()
  lightWorld = LightWorld({
    ambient = {55,55,55},         --the general ambient light in the environment
  })
end

function love.update(dt)
  lightWorld:update(dt) --only needed for animation
  lightWorld:setTranslation(x, y, scale)
end

function love.draw()
  love.graphics.push()
    love.graphics.translate(x, y)
    love.graphics.scale(scale)
    lightWorld:draw(function()
      -- do your stuff
    end)
  love.graphics.pop()
end

For more information please check out the wiki and see the examples directory to see how it is fully used. This project can be run with love to see the demonstrations in action.

Gamera & HUMP

There are example in the example directory how to use both of these with the library.

Features

  • Preview (Video)
  • polygon shadow calculation Preview
  • circle shadow calculation
  • image shadow calculation Preview
  • shadow blur
  • light color, range, smooth and glow Preview
  • ambient light
  • self shadowing on images with normal maps Preview
  • dynamic glow effect on images and circle/poly objects Preview Preview
  • generate flat or gradient normal maps Preview
  • convert height maps to normal maps Preview
  • generate a normal map directly from the image (usually gives poor results)
  • shadow color and alpha (glass) Preview
  • directional light Preview
  • refractions (moveable) Preview
  • chromatic aberration Preview
  • postshader with many included postshaders, plus easy to extend
  • animations in tandem with normal maps thanks to anim8

License

A License has been included in this project