Save The Trees! Remeshing for Performance

Rhys

FreeSO Developer
Staff member
Moderator
What's up everyone!

Remeshing benefits for appearance are pretty obvious, but I'm here to preach another cause to you. This time it's all about "hitting that 60 fps target on intel disaster chips" and "stable framerate on the town hall lot", with a little bit of "stop melting my laptop's battery with 100% cpu load its getting all over my legs".

As mentioned in the introduction to 3D reconstruction, the models generated not only have a lot of triangles, but they have a lot more actual problems that will kill performance on systems without good CPUs, or running in OpenGL mode. 3D reconstructions are essentially a combination of all of the sprites projected into model space, so essentially all four rotations combined into one. This is done to cover the holes in the sprite and mesh where detail was not available due to obstructions... this is far from perfect anyways, but it could definitely be a lot worse. Typically one rotation covers two cardinal direction sides of an object - so if you think about it, 4 rotations covers 8 sides... wait a minute, doesn't a compass only have four directions? Yes, re-constructions also tend to draw surfaces a little more than twice, doubling the load incurred by our lighting pixel shader and stressing the fill rate of poor intel chips around the world. They also draw faces facing away from the camera (again, to fill holes) but this will become important later.

So anyways, let's look at trees.
upload_2018-6-2_18-48-3.png

Each of these tiles has 4 sprite rotations for four of its tiles. Since remeshes draw each texture (rotation) with a different draw call, and there are four separate objects, that's a total of 16 draw calls for one object. Since our pixel shaders aren't too extreme for objects, 3D's performance relies entirely on the number of draw calls required to draw the scene, and the memory bandwidth strained by all the texture switches.

If these are modelled with one texture, this draw call count goes down to ONE. That's a 16x speedup for drawing just trees. You can only draw with one part of the object by filling the other tiles with empty OBJs, and eventually this will also skip more cpu eating portions of the draw function.

Not all trees are terrible, but all of them are considerably slower. The snow trees in trees3, and all trees in trees4 and trees actually only use 4 draw calls (1 per tile). However, in the best case these still use 4x more draw calls than usual still suffer from overdrawing, and look abysmal.

How common are trees?
...I don't know why I even thought I needed to answer this question, but trees are arguably about as common as doors or windows. There's also the fact that properties are initialized with trees on them, including surrounding lots. This raises the barrier of entry for drawing surrounding lots significantly, as the number of draw calls can easily raise by over 200 for each additional property drawn. In a perfect world, this number would be about 12.

unknown.png

This shot shows a lot with a lot of objects, some of which are trees. But count them, and those draw calls add up very quickly. In fact there's a calling to look into foliage here since people use it so liberally, but now's not the time for getting side tracked from the REAL problem, large greenery with barky trunks.

unknown.png

All of these look particularly terrible up close, even though they are using all 4 rotations in each tile. From a distance they look very light and leafy, but up close they look a lot more abstract than the other objects. The triangle count is also pushed up by the disconnects between leaves.
...and then there are garden lots.
unknown.png

God, help us all.
With less than 1/4 of the objects, this single lot performs as bad as the town hall. What has the world come to?

Please, someone save us.
 
Last edited:
Back
Top