Interesting read, as usual
Sadly I think most of my app's computational costs originate from different areas than yours, but I'd love to try out your modified setMaterialRec function and report my results, if you are able to share it.
Anyways, thanks for posting your findings.
- modified setMaterialRec to set materials from an array instead of recursively. As we have lighting parameters in a stage material the trunk version set uniform and samplers twice - once for
the mesh material and than for the stages material. Now parameters are only set only once and parameters are set hierarchically. if param found in mesh's material stops searching,
otherwise searches in light, stage,.. materials. (this was a significant speedup, it seems uniforms set are costly)