Jump to content

Instances and render speed


Roland
 Share

Recommended Posts

I know that instances brings down the amount of meshes loaded into memory.

Let's take a simple example. A cube. That's 6 Quads or 12 Triangles. When two cubes

are loaded we still have only 12 triangles loaded. That saves memory.

 

My question now is. Has this any other advantage besides saving memory.

There is still 2*12 triangles to render?

 

The reason why I'm asking is that when creating a house, it can be done in several ways.

Either you make the whole thing in your modeler and exports it as single gmf file, or you can

divide it into say 4 walls, a floor and a roof and export them as separate gmf files. In the latter

case you then assemble the house in the editor (which is very hard to do with current editor).

 

One can easy see that using the 4 wall's approach will result in fewer triangles loaded into memory,

but will there be any gain in speed doing this. The amount of triangles are still the same as if we

load the whole house as one mesh.

 

Can someone elaborate a but about this.

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

I'm actually creating a house myself at this very moment, and this is indeed a very good question...

What I have remarked with LWE so far is that rendering multiple instances is slower as rendering one. Yes, this will result in memory bloating, but is memory still an issue these days? SSD's are coming up, making disc IO way faster...

 

This is the main reason why I personally decided to create 1 mesh = 1 house. Another reason would be that placing separate objects in the editor is a pain in the bum :).

Link to comment
Share on other sites

I'm actually creating a house myself at this very moment, and this is indeed a very good question...

What I have remarked with LWE so far is that rendering multiple instances is slower as rendering one. Yes, this will result in memory bloating, but is memory still an issue these days? SSD's are coming up, making disc IO way faster...

 

This is the main reason why I personally decided to create 1 mesh = 1 house. Another reason would be that placing separate objects in the editor is a pain in the bum :).

Yes. We are at the same path. Memory is of no concern, at least if we are talking about a few objects.

I have got the advice to keep the polys down by using instances. A good example is the bridge which I talk about in my blog.

If I do the whole bridge in my modeler the result is about 1900 polys. By creating some parts in the modeler and assemble them

to a bridge in the editor the poly count is reduced to 10% (=190 polys). Looks good on the paper, but what is realy gained by

doing this. Obviously some memory is saved, but as you say, memory is of no or at least less concern these days. Now if doing

this doesn't end up in a better framerate speed, I cant see why there should be any reason to bother at all. And as all probably

knows. Assembling pieces together in the editor is possible in theory, but not i practice. So I don't really see any meaning of

this poly count hunt for such objects that we are talking about.

 

One thing that I CAN understand is the case where a building has many materials. Then there may be some speed gain by

dividing separating the pieces with same material into a separate gmf. The gain would be that same shader could be used

for the complete gmf file. I guess that switching shaders is a thing that might bring speed down a bit.

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

Agreed, this is one thing I was going to test once my demo scene is done. I don't think LWE sorts the scene file by material (shader and texture), this could result in unnecessary texture and shader swapping. I will write some tool to sort:

- By texture (is the heaviest swap)

- By shader

- By position

So all of those combined, will need some testing. However, I do not know the internal implementation in LE2. Like josh is working in LE3, this may be very problematic because map is a red-black binary tree. Maybe we could get a gain by using an unordered_map. If Josh uses auto for iteration, or the for_each algorithm he could implements this in 1 min...

Link to comment
Share on other sites

I would divide the house into breakable components. LE2 has a limit of 65536 vertices per model anyway, so you can't make any complex models with a single mesh:

http://www.leadwerks.com/werkspace/index.php?app=tracker&showissue=172&view=findpost&p=809

And when the player gets heavy weapons, he should be able to destroy all houses.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

I would divide the house into breakable components. LE2 has a limit of 65536 vertices per model anyway, so you can't make any complex models with a single mesh:

http://www.leadwerks.com/werkspace/index.php?app=tracker&showissue=172&view=findpost&p=809

And when the player gets heavy weapons, he should be able to destroy all houses.

Aha. There is a limit. Its quite high so its no problem in my case, but thanks for that info Lumooja.

Don't be such a violent nature. Every house does not need to be torn down to the ground :)

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

1. The best way to make house - is make it as single mesh with one flattered texture. - very fast to render.

2. Some slowly - multimaterial, when all different material meshes attached to one mesh.

3. Very slow - is group all house walls\flor.

 

I see that Leadwerks not lost speed on render meshes, more important is culling i thinking.

 

if you will be gather house by walls\flor in editor, at render it must be frustum culled many times. And if you will have many such houses, each frustum cull for each separate mesh..... And you incrase totel count of rendered objects in scene.

 

I thinking such things in most of engines. 3DRipper DX is good way to se how ready game rendering it resources. For example, Prince Of Persia Prodigy - don't cull beside camera objects, all scenes created by models (not terrain), and it showing 300 000 - 400 000 triangles per frame with ~1000 meshes

"Better" is big enemy of "good"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...