@jhonny.goransson
For light data i create texture in runtime resource.create_texture.
Then i changed data.png texture using resource.set_texture every frame.
I think i can use texture handler of created texture. But this texture handler have empty texture.
Looks like texture resource not updated when i change buffer.
But if i set this texture resource to another texture in resource.set_texture this another texture is updated.
1)So if i create texture in resource.create_texture. If i update buffer texture not changed? So how can i update this texture?
2)If i use resource.set_texture for data.png. Not i create new texture that will be used? So now i have 2 textures. One i created in resource.create_texture and second in data.png because i set texture?
I set all data for shadows in render script. So it use same as render view,projection.
I think it something with precision. If i set shadow projection size to lower values shadows worked better.
But i have no idea what to do with precision. Mb i need some filtering or something like that?
I see that some shadow shaders add random to uv, but i don’t understand how it worked, and it not fixed jittering in my case(
Fixed shadows.
Avoid recreate light matrix every frame:)
Now i create a bigger light_projection so i don’t need to recalculate light matrix if user make small movement.
It is still possible to see shadow shimmering but now it is much harder)
Old
Refactor how lights cluster calculated in c++.
Now math worked a little bit slower but clusters border for lights more accurate and worked correct on all angles of view.
Because clusters more accurate in result it worked faster that previous version
In order to get this (master(d0d16a4)) to build (on Linux) I changed some ints to reals and one real to int. This was to fix errors. dmLogWarning in extension.cpp which has %f in it, which I guess I could of changed to %d maybe.
I still get: ERROR:xMath: Registered xmath Extension
However it does run.
Swapped to:
#define LIGHT_RADIUS_MAX 64 // store in r value of pixel. Mb store as rgba value for better precision?
#define LIGHT_MIN_POSITION_X -511.0
#define LIGHT_MAX_POSITION_X 512.0
#define LIGHT_MIN_POSITION_Y -511.0
#define LIGHT_MAX_POSITION_Y 512.0
#define LIGHT_MIN_POSITION_Z -511.0
#define LIGHT_MAX_POSITION_Z 512.0
Now positions and radius is limited in some borders. In new year i will refactor that. I think it will be better to store decimal part in RGB and fraction part in A channels.
#define LIGHT_RADIUS_MAX 64.0 // store in r value of pixel. Mb store as rgba value for better precision?
#define LIGHT_MIN_POSITION_X -511
#define LIGHT_MAX_POSITION_X 512
#define LIGHT_MIN_POSITION_Y -511
#define LIGHT_MAX_POSITION_Y 512
#define LIGHT_MIN_POSITION_Z -511
#define LIGHT_MAX_POSITION_Z 512