upbge
upbge copied to clipboard
Access lights from 2Dfilter and shaders
now that we have attachments, all that's left is to be able to access the lights and light data from 2Dfilter. This would allow us to create shaders like godrays, lens flare or even AO or shadows.
It would also be posible to render shadeless geometry into the bgl_RenderedTexture and use the attachments to create a deferred 2Dfilter, or a deferred shader for the viewport. we could have both forward and deferred and change it by pressing a button like in unity, or let the user make it from scratch (i don't know if this would be as efficient as having a deferred pipeline).
We can expose a uniform block of the scenes lights. I have a brief list without sources in front of me concerning the attributes per light:
- view space position
- view space direction
- color
- energy
- type
- falloff type
- falloff distance
- falloff radius
- falloff cuttoff
- layer
- spot size
- spot blend
Then an other array for shadows:
- light index
- texture
- shadow matrix
- type
- filter type
- bias
- slope bias
Exposing this in nodes would bee good to. Like a node that additively samples multiple lights.