Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

2D Lights

edited May 4 in Code Sharing Posts: 122

after many attempts i’ve gotten a basic version of 2D lights to work in codea - :D

the demo project is attached

a few areas i’d like to improve on are
* the x and y positions is kinda weird, I’ll have to recalculate it to fit into whatever resolution the active device is so 0,0 is bottom left and 1,1 is top right
* the light algorithm, N dot L is rather a bit too simple and doesn’t get the same effect as https://29a.ch/sandbox/2016/normalmap.js/buddah.html
* is there a better way to use multiple meshes without each of them needing their own duplicate shader? maybe i need to pass the textures and normal maps as arrays
* try to get a spotlight effect (solid light color, i think this one is easy to do just remove the falloff)
* test to see how to get a flashlight effect (with the light scattering and lines one would see as they focus and unfocus)

fyi i used this guide - https://github.com/mattdesl/lwjgl-basics/wiki/ShaderLesson6

eventually i hope to get some shadows going too

Comments

Sign In or Register to comment.