Now that the versions of the engine’s built-in shaders and the L_S library are the same, it’s time to experiment with GPU skinned models and shadows. You can ignore the running animation, I couldn’t quickly make friends with the skeleton and character animation from the free Kenney set.
What’s interesting.
-
The engine places the pose_matrix_cache texture apparently not by name, but by number? Because if pose_matrix_cache is not specified in the material, this texture will overwrite the tex1 texture, which contains the shadow map and is included in the render script. There is clearly some conflict here.
-
If you don’t specify any samplers for the shadow render material (you don’t need them for the model), but use skinnig, the engine will show the error
ERROR:GAMESYS: Unable to bind bone matrix cache texture for component ‘/boy5’, does the shader(s) have a sampler named ‘pose_matrix_cache’?"
This situation can still be for a material without a texture, if the lowpoly model is for example painted with the colour of vertexes. -
What happens to the shadow of the duplicated character model_skinned I honestly do not understand yet
Somehow the position of the last character is remembered when the rendering script substitutes the material for the shadow renderer.
-
Unrelated to skinning. I noticed that
in mediump mat4 mtx_normal;
comes to the shader incorrectly? In some cases, replacing this matrix withmtx_world
in the normal correction for later light calculations gives the expected result.
var_normal = normalize((mtx_world * vec4(normal, 0.0)).xyz);
But even this does not solve the case with different platforms, for example in html5 and just building PC give me different results.
And finally, the most disturbing thing of all. My tests show GPU skinned losing to regular World material in the browser on the 12 iPhone. 48 vs 60 fps.
I think I should create issues, but I don’t have the energy for that yet
I have created a separate branch in the repository with these materials for experimentation and testing.