Open mvaligursky opened 8 months ago
There are sometimes even global
uniform, e.g. time
or windDirection
that would be re-used by multiple shaders.
There are sometimes even
global
uniform, e.g.time
orwindDirection
that would be re-used by multiple shaders.
Yep that already works fine. Whatever is not in the view / material uniform blocks is automatically added to the mesh uniform block .. so that would be the case with those global uniforms.
At some point we might enable users to add global uniforms to the view UB, but for now they'd be per mesh.
In terms of architecture, I would very much like a Material
(or derived class) be just the material properties (and state) plus the update function to mark the material as dirty. But all details relating to uniforms/rendering should ideally be owned/managed by the renderer. This would help simplify our material classes massively.
Current status
On WebGPU, the plan is to have 3 levels of uniform buffers:
view
(implemented) - constant uniforms for a camera / layer combination, sets up for each forward renderer looping over mesh on that layermaterial
(missing) - details belowmesh
(implemented) - all uniforms not part of the other two existing uniform buffers. This updates for each draw call, and we want to minimise the amount of uniforms stored hereMaterial Uniform buffer(s)
There are two ways to implement this: