We are about to switch to a new forum software. Until then we have removed the registration on this forum.
https://github.com/lmccandless/Processing3/tree/master/RaytraceShader
I made a pixel based 2D raycast lighting/shadow shader. It detects pixels with full red as walls, and can run over 500fps with 6 lights on my gtx 1070.
I have been playing with learning shaders and hacked away at the conway and blur examples and skimming the book of shaders to get to here. It works well, but it could clearly be better. It needs more natural mixing of the light, and probably could run faster. Could any shader/lighting gurus steer me in the right direction?
I widdled the code down to almost nothing and got it as clean as I could, it should be easy to dive into.
There doesn't seem to be any other examples of doing this in processing and I feel many people would find it useful, so I'd like to get it much more proper.
Answers
Nice.
Just a note here: Pleace look up in the specs, and decide the version you are using: For version 120 no while loops, for version 150 re re -assignment build in functions(reserved keywords) like step will breaki was mixing up WebGL (no while loops) and Desktop
https://www.khronos.org/registry/OpenGL/specs/gl/
This is something processing do for you, and it is good to know, but still, some conversation is needed, Maybe you will save the work, and you take care of possible mistakes by your own. Either using while loop or a float step variable.Because Smartphones become popular we still dealing with ancient OpenGL Specs. Book of shaders was written in 2015 as example no one put ifdef GL_ES in a shader. https://developer.mozilla.org/de/docs/Web/API/WebGL_API/WebGL_best_practices
Please have a look also in this repro how to declare a version directive
https://github.com/codeanticode/pshader-experiments/blob/master/PointsSphere/data/pglslvs.vert
Also note that version directive will decrease compatibility on different Platforms.
Update:
the Processing default: OpenGL2.0 GLSL1.10
http://download.java.net/media/jogl/jogl-2.x-docs/javax/media/opengl/GL2ES2.html
So most of the stuff is deprecated still valid
Holy Cow
https://github.com/processing/processing/wiki/Advanced-OpenGL
Sorry man, i confused myself WebGL, OpenGL, and then JOGL. and as i said: Nice :)