Open pjcozzi opened 11 years ago
While developing the gridMaterial, I noticed the uniforms are exposed as-is in Materials.js. Would it be worthwhile for materials to have a bit of JS interface, for example publicly exposing 4 un-related floats, while privately bundling them into a vec4 uniform? In other words, allow a material to present more public variables, and hide the bundling from the user.
@emackey we will do something like this for materials since we don't want end users to do deal with packing directly. However, materials are not much of a problem right now compared to, say, terrain tiles and, soon, models. Generally, there are a lot more draw commands for these than for primitives supporting materials, especially when we add better batching.
Some improvements were made in #1144
For the Everest terrain view in Sandcastle, uniform1f
still shows up on the profiler. We should pack floating-point array uniforms into vec4 array uniforms. We can also better isolate uniforms that don't change between draw commands.
It should be low-hanging fruit to replace manualUniforms
with an array.
More improvements: #2357
Plans:
UniformMap
.Also see OpenGL Scene-Rendering Techniques.
CC #2490 and #2493
Setting uniforms can take up to 15% of our time in the profiler, which is pretty standard in a 3D engine. We can do better, by both optimizing setting them and using less of them (yes, that means packing things together).
CC #646