Actually the way Teleglitch does "lighting" is not actual lighting. The camera is fixed always facing down and each wall has a black wall above it that reaches all the way up to the camera. It gives the illusion of being lighting.
It's just a fancy 3D trick. And a pretty unique one at that.
Lighting and Shadow System
Re: Lighting and Shadow System
Yes I believe a Teleglitch-like viewcone can be achieved with a subtractive shadow casting algorithm as the starting point.
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: Lighting and Shadow System
Has this been discontinued ?
Re: Lighting and Shadow System
Hi,
i don't know, if this project is canceled (because the screenshots and links are empty). So i post here my "own" light shadow engine. The code for the poly2shadow calculation is not from me, but i have added a circle shadow calculation, a functionality to blur the shadows, light interaction with the object surface (no self shadowing at the moment), better performance when only lights are moving and i packed all the code in an easy "love-like" module.
Here a colorful screenshot:
To use the engine, just implement these:
Have fun!
PS: just for your interest, i made a experimental pixel based shadow shader, check it out -> http://love2d.org/forums/viewtopic.php? ... 20#p163757
i don't know, if this project is canceled (because the screenshots and links are empty). So i post here my "own" light shadow engine. The code for the poly2shadow calculation is not from me, but i have added a circle shadow calculation, a functionality to blur the shadows, light interaction with the object surface (no self shadowing at the moment), better performance when only lights are moving and i packed all the code in an easy "love-like" module.
Here a colorful screenshot:
To use the engine, just implement these:
Code: Select all
require "light"
function love.load()
-- light world
lightWorld = love.light.newWorld()
lightWorld.setAmbientColor(15, 15, 15)
-- add light example (x, y, red, gree, blue, range)
mouseLight = lightWorld.newLight(x, y, 127, 63, 0, 400)
-- add a few shadowbody examples
shadowRect = lightWorld.newRectangle(0, 0, 32, 32) -- (x, y, width, height)
shadowCircle = lightWorld.newCircle(0, 0, 16) -- (x, y, radius)
shadowPoly = lightWorld.newPolygon(0, 0, 1, 0, 0, 1) -- (polygon data)
end
function love.update(dt)
-- example for change your light position
mouseLight.setPosition(love.mouse.getX(), love.mouse.getY())
-- a few examples for change the shadow bodys
shadowRect.setPosition(x, y)
shadowCircle.setRadius(64)
shadowPoly .setPoints(0, 0, 1, 0, 0, 1)
-- or get the poly direct from a physic object
shadowPoly .setPoints(phyExample.body:getWorldPoints(phyExample.shape:getPoints()))
-- update lightmap
lightWorld.update()
end
function love.draw()
-- draw lightmap shadows
lightWorld.drawShadow()
-- Draw your stuff here
-- draw lightmap shine (optional)
lightWorld.drawShine()
end
PS: just for your interest, i made a experimental pixel based shadow shader, check it out -> http://love2d.org/forums/viewtopic.php? ... 20#p163757
- Attachments
-
- polyshadow.love
- (8.7 KiB) Downloaded 348 times
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: Lighting and Shadow System
You know what, I'm gonna drop my shadow and lightning project and I'm just going to use yours, would it be ok if I sent you the bugs (if I find any) of your code or some suggestions ?
Re: Lighting and Shadow System
Yes, of course and it would be nice if you post your improvements too.Ranguna259 wrote:You know what, I'm gonna drop my shadow and lightning project and I'm just going to use yours, would it be ok if I sent you the bugs (if I find any) of your code or some suggestions ?
I love the idea of an easy to use standard light library like the physics module and the more people are working on it, the better the result.
Re: Lighting and Shadow System
So i have added a few new features:
How to use:
- added optional glow
- glow size and strength can be changed
- added light smoothing (for discreet lighting or spot lights)
How to use:
Code: Select all
light.setSmooth(0.5)
light.setGlowSize(0.1) -- 0.1 = 10%
light.setGlowStrength(0.5) -- 0.5 = 50%
- Attachments
-
- polyshadow.love
- Version 2
- (9.06 KiB) Downloaded 123 times
- ArchAngel075
- Party member
- Posts: 319
- Joined: Mon Jun 24, 2013 5:16 am
Re: Lighting and Shadow System
Regarding the latest polyshadow :
I seemed to be unable to change the strength of the light (mouse wheel) after fiddling around, All i could achieve was scrolling alot to make it suddenly jump from no light intensity to maximum and then scrolling in the opposite direction just made it jump to 0 light intensity again instead of the smooth/gradual declining intensity.
Not sure how to replicate the issue though.
I seemed to be unable to change the strength of the light (mouse wheel) after fiddling around, All i could achieve was scrolling alot to make it suddenly jump from no light intensity to maximum and then scrolling in the opposite direction just made it jump to 0 light intensity again instead of the smooth/gradual declining intensity.
Not sure how to replicate the issue though.
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: Lighting and Shadow System
PriorBlue, do you have a git for this ?
Who is online
Users browsing this forum: No registered users and 7 guests