Super simple lighting for LÖVR

#lovr #lighting #library #lua #gamedev

bjorn 88046982ed Add WIP PBR shader; 7 years ago
README.md 88046982ed Add WIP PBR shader; 7 years ago
conf.lua 88046982ed Add WIP PBR shader; 7 years ago
depth.lua bb4a3758af Add depth buffer shader; 7 years ago
main.lua 88046982ed Add WIP PBR shader; 7 years ago
normal.lua cfab941dac Rename simple to phong; Add normal shader; Add README; 8 years ago
pbr.lua 88046982ed Add WIP PBR shader; 7 years ago
phong.lua cfab941dac Rename simple to phong; Add normal shader; Add README; 8 years ago

README.md

lovr-lighting

A collection of lighting shaders for LÖVR.

Usage

Drop the shader you want to use in a LÖVR project, then require it. It will return a function that returns the Shader when called.

local phong = require('phong')
local shader = phong()

function lovr.draw()
  lovr.graphics.setShader(shader)

  -- draw stuff
end

Shaders

  • Phong - Simple phong lighting. Per fragment lighting with a single directional light that has ambient/diffuse/specular colors. Includes specular reflections.
  • Normal - Colors pixels based on their vertex normal. Can be used to debug problems with vertex normals and also looks really cool.
  • Depth - Visualizes the depth buffer. Pixels closer to the camera will be darker.
  • PBR - A basic PBR shader (WIP). Make sure you set t.gammacorrect = true in conf.lua when you use this.