![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | vtepe |
Ubuntu 18.04 x64, Godot 3.2.1.
Trying to have some custom lighting on CPUParticles2D. Trying to rotate the LIGHT_VEC using INSTANCE_CUSTOM.x but it seems to have no effect.
varying flat float rotation;
rotation = INSTANCE_CUSTOM.x; // in vertex func
// light func
float sn = sin(rotation);
float cs = cos(rotation);
LIGHT_VEC = vec2(cs * LIGHT_VEC.x - sn * LIGHT_VEC.y, sn * LIGHT_VEC.x + cs * LIGHT_VEC.y);
This doesn’t work for me, particles look lit from random angles. How to get particle rotation in the shader?