About Store Forum Documentation Contact



Post Reply 
Double FPS loss when using materials?
Author Message
kulesz Offline
Member

Post: #1
Double FPS loss when using materials?
Hi,

Since I started my project, I've tested my application with (custom generated in-game) heightmap painted with single material. Today I added some random materials to half of the nodes and I've noticed a tragic FPS loss, like in the screens. Is there some way to improve it?
Heightmap resolution is low, 33.


Attached File(s) Image(s)
       
09-24-2011 10:18 AM
Find all posts by this user Quote this message in a reply
Abril Offline
Member

Post: #2
RE: Double FPS loss when using materials?
One thing I've noticed with EE is that it handles only a very limited amount of unique meshes/parts/materials.
To verify this you can make a simple test, create a mesh (in Max or your DCC of choice) with let's say only 16 unique materials and a couple hundred different parts (doesnt matter how many triangles).
Now load this mesh in the EE editor model viewer from the EE SDK distribution, you should see that the model contains a few hundred parts, and notice a massive performance drop.
Now join/optimize all the parts using the same material together (using the menu options) and notice the smooth framerate, regardless of polygon count/shaders used (so seems like it is not a GPU issue).

Seems like there is some heavy engine side CPU processing when handling several different separate drawcalls (probably heavy use of dynamic lists?allocations? I dont know what happens inside the EE), and this is happening even in the model viewer which is otherwise a completely empty environment where there is no any other processing affecting the results.

Of course this test mesh is a single mesh and you can simply optimize it as explained above, but in real world game levels, you usually need thousands of different objects / materials to create a rich and interesting environment. It is true that number of drawcalls should always be minimized when possible but regular PC game on current PC hw will render at least 1-2 thousand separate mesh parts / drawcalls.

So all I can say is that you should somehow try to merge different parts together and use less material variations as possible, based on some test when the engine has to render over 100/200 different parts things start getting slow.
11-16-2011 01:46 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Double FPS loss when using materials?
the case from 1st post is very unrealistic situation, besides it looks like vsync is enabled so 60->30
in model meshes it's encouraged to have 1 to few mesh parts only.
11-16-2011 02:01 PM
Find all posts by this user Quote this message in a reply
kulesz Offline
Member

Post: #4
RE: Double FPS loss when using materials?
There is no such thing as "unrealistic situation" in game development - you can never tell, what people will do with your engine :-)
VSync was enabled, but it should limit to 60, not 30, should it?
11-16-2011 02:31 PM
Find all posts by this user Quote this message in a reply
Abril Offline
Member

Post: #5
RE: Double FPS loss when using materials?
(11-16-2011 02:01 PM)Esenthel Wrote:  the case from 1st post is very unrealistic situation, besides it looks like vsync is enabled so 60->30
in model meshes it's encouraged to have 1 to few mesh parts only.

Hi Esenthel, as I said it is possible to make meshes to have only 1 material (1 part), however this results in exactly the same problem as there are still hundreds of materials in a decent production level that still need to be rendered somehow.

Are you saying that in EE is more efficient to create multiple meshes with only 1 material instead of having 1 mesh with multiple materials?

If that is the case in EE would be good to know what would you recommend to do as you have the best knowledge of EE internal workings.
For instance in a urban environment, having simple buildings with 10 different materials. Are you saying that generally would be better to create 10 different meshes with 1 part rather than 1 mesh made of 10 parts?

Generally speaking (also comparing to other engines) I'd expect a mesh with multiple parts to be rendered more efficiently than multiple meshes with 1 part. It would also be more efficient on the production side but this can be worked around.
(This post was last modified: 11-17-2011 11:19 AM by Abril.)
11-17-2011 11:17 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Double FPS loss when using materials?
advice:
the fewer parts in mesh the better
the more meshes share the same materials the better

Quote:Are you saying that in EE is more efficient to create multiple meshes with only 1 material instead of having 1 mesh with multiple materials?
no, as long as they are all different materials, then better to have 1 mesh with multiple parts
11-17-2011 01:26 PM
Find all posts by this user Quote this message in a reply
Post Reply