Three.js render performance with and without multiple materials (both with
textures)
I am trying to figure out if the significant performance hit I'm seeing is
something that can be optimized away or is this the state of things:
I have a geometry that looks like Obama, it's about 11K triangles, 5600 or
so faces (both quads and triangles). It was modeled in Maya, and is
exported as OBJ in one of two methods depending upon the render method
being used.
In one export method, we do not export the materials file from Maya. We
take the 5 different texture maps used by the model, stitch them into a
single texture and re-write the UVs in the model to reference the new
texture locations in the unified texture. The final unified texture is
1024x512.
The 2nd export method does use the exported materials file from Maya, and
we reduce the 5 different textures to be smaller in all cases than their
counterpart in the unified texture used by the other method. If the 5
different textures were tiled, you'd get something about 768x512.
The only other difference between the two methods of rendering the same
geometry is the second method has 1 semi-transparent material: the cornea
(the clear layer) over the eyes is set to 0.1 (barely visible)
transparency and a slightly blue/gray tint.
In place of the semi-transparent cornea in the first rendering method, we
simply have the image of the eyeball on the cornea, and the inner eye
(iris and pupil) are never seen by this method. They are there, just
discarded by rendering because they are behind the opaque cornea.
Now here's the big puzzle: render method one easily hits 60 fps and stays
there with two such geometries. Render method 2 is rendering between 20
and 25 frames per second. I've not tried rendering with a second geometry
yet. I'm somewhat surprised at this significant reduction in my frame
rate. If I change the semi-transparent cornea to be opaque, the frame rate
is still poor (same rate).
Is there that much of a hit from using multiple materials and multiple
textures? What are people doing with more complex environments requiring
exponentially more materials than my paltry 6?
No comments:
Post a Comment