hey , long time ! whats happening under the hood here ?
Iām working on this rendering engine built simply through the node editor because itās useful for me to better prototype the game using upbge 0.2.5b (I havenāt tried range atm yet).
My goal was to have many (static) light sources simultaneously visible without moving from the node editor as I want to have everything visible in the 3D view port to work comfortably on the level design.
I took the liberty of posting something about it here because the basic working mechanism of the light is very similar to what you were talking about here.
Iām using 2 textures on which I render the light sources.
For the position it is sufficient to save the Z coordinate only.
For the direction of light X and Y (Z is reconstructed)
The method used to calculate the light of the area lamps is something I improvised quickly, but today I reviewed it and the result is what you see in the video:
Iām quite satisfied but maybe Iāll work on it a little more.
This same method used for area lamps is also used to calculate the light of point lamps considered as spherical area lamps.
To avoid using more than 2 textures, the calculation method Iāve implemented presents some simplifications which lead to the direction of the light of the pointLamps not being exactly the same as that of a real pointLamp, but this does not seem to be very noticeable so, atm, I donāt intend to use a third texture to save additional parameters so as not to affect the fps, which still remain very high, allowing me to exploit the resources for other thingsā¦
One downside is that you canāt have overlapping lights. In this case to have a possible overlap I should duplicate the effect using 2 other textures:
1 possible overlap: 4 textures
2 possible overlays: 6 textures
3 possible overlays: 8 textures etcā¦
(For now Iāll do without overlap, then proceeding with the level design Iāll evaluate whether it will be appropriate to enable one or more overlapsā¦)
its storing the data in UV correct?
I was thinking ātransform uvā could be used potentially to move lamps in game,
Still need to test.
Parameters are stored per texture pixels.
The uv for sampling is calculated as a function of the fragment_worldPos
looks nice. And if you are able to replicate perfectly lamps just with material textures, just wow.
MattFrnndz gave an answer for the Z, for the X,Y we use a simple normal texture (which is very easy and convenient)
Donāt hesitate to grab ideas displayed in the thread and share your findings