Hello,
While working at same shader transformations im always wondering, what would be the fastest way to implement something, or is there no diffrence?
I would have benchmarked it if it wasnt just impossible to test, so does one of the glsl experts here have a answer for this?
Case:
I have the following calculation in the vertex shader, it simply converts the modelmatrix to an normal matrix:
n = normalize(mat3(inverse(transpose(modelmatrix))) * normal);
If i would precalculate this matrix in java (every frame, every object, worst case) and send them to the shader for every object, would this be faster, slower or equal to the speed of calculating them every vertex.
I would say preloading then for every object, but this means no parallel calculations and sending a command to the shader for every frame.