An experiment with LOD distance values in x1551
#21
Posted 12 April 2013 - 06:43 AM
Draw calls are made by the CPU, and can be done in only one thread, at least below direcx 11, that's why single CPU core performance is more important than multi core performance in games.
Really the draw call quantity for an object looks like this: nodecount*materialcount.
A diesel locomotive in game ideally looks like this: 2x nodes of bogies/trucks with 1 material, 1x node of locomotive body with 2 materials (normal body texture, + something for transparent faces, like glass. Which means 2x1+1x2=4 draw calls. But since the 3d modelers use multiple smaller textures for the locomotive body(they shouldn't instead they should use one bigger texture), it makes this number higher.
If you have a tree object with one node and one material, and you want to place 6000 of these as a forest, it will be 6000 draw calls. But if you attach these 6000 trees into a single node in 3d editor, then it could be drawn in game by 1 draw call.
Some game engines support draw call batching (where the game engine combines the non moving non animated objects in run time, into a single object), but as i heard it have big limitations, so still the most of the performance depends on the 3d modelers and the map editors.
You can see how much draw calls are used in OR, by watching the "Render primitives" number at the debug informations.
#22
Posted 26 April 2013 - 04:44 PM
#23
Posted 26 April 2013 - 06:24 PM
I think the best way to move forward is to have the sim calculate on the fly which objects to draw based on their size, and if they're not occluded by other objects. I think the 250 to 300 number for distance to height/width ratio suggested by Lindsay sounds reasonable. We can even extend this idea to details on objects. If it's not visible, it's not drawn. You can reduce GPU power somewhat by not doing things like showing shadows for objects until those shadows would be clearly visible. The only problem I can see with all this (besides possibly taxing the CPU/GPU) is that Open Rails needs to load more tiles in order to know about the details of the objects on those tiles. At 2000 meters viewing distance you only need to keep 9 tiles in memory. At 4000 meters this expands to 25. The numbers for 6000, 8000, and 10000 meters are 49, 81, and 121. I would imagine though the saving grace is most routes usually don't have a huge number of tiles perpendicular to the track. In practice with a 10,000 meter viewing distance, you'll usually only be looking at perhaps 30 to 40 tiles. Now I have no idea what 30 or 40 tiles in a dense urban area might mean in terms of memory requirements, but at least we're no longer bound by 2 GB if need be. Just setting the LLA flag gives us up to 4 GB on a 64-bit system. I think it's safe to say at this point the majority of people running OR will be using 64-bit hardware under a 64-bit OS.
I'm usually not a huge fan of eye candy over other aspects of the sim, but large objects just popping into view long after they would be clearly visible in the real world greatly distracts from the realism. With modern game engines and PCs, there's no reason to continue to be bound by the LOD structure needed by MSTS to cope with the limited computing power available at the time.
#24
Posted 26 April 2013 - 07:48 PM
Thinking of performance, in the view above the far buildings are being displayed w/ a 4000m view distance. Obviously the terrain runs out about as far. What is not apparent is that in this scene 2/3's of the draw calls are for the track (Scalerail). Given that fact the best thing that could be done for performance here would be to either not use Scalerail or to vastly reduce the number of individual track shapes that are rendered individually.
IMO the look of Scalerail is so vastly better than Xtracks I cannot imagine not using it and so that leaves me looking at what might be done waaaay down the road... and what comes to mind procedurally generated track. The OR teams knows how to do it (OR does procedurally generated track to replace dynamic track shapes). There's a template that provides for alternative profiles (including one that looks like Scalerail). What's not been done is any analysis of optimizing lots of track for rendering performance. Does one divide up a tile into 500m squares and render all track within each square as-if it were just one shape? That's 16 calls per tile... very cheap. 250m squares? 1000m squares? Or go a completely different way and do it by signal sections instead. Or something altogether different? Don't know. But IMO there is a big opportunity to get performance improvements by designing a solution.
#25
Posted 26 April 2013 - 08:30 PM
Genma Saotome, on 26 April 2013 - 07:48 PM, said:
Procedurally generated track is probably the way to go in the future other than for switches. Properly defining switches procedurally gets pretty complex, and even then the end result isn't always what you want. That's why in my opinion I think it's better to stick with shapes for switches, and generate everything else procedurally. As for Scalerail and also DB Track, despite the hit on performance I can't see not using them either.
Semi off-topic but do any profiles exist for DB Track? I've converted one route but the procedurally generated banked curves severely clash with DB Track.
#26
Posted 26 April 2013 - 09:45 PM
#27
Posted 27 April 2013 - 04:09 AM
#28
Posted 27 April 2013 - 09:42 AM
James Ross, on 27 April 2013 - 04:09 AM, said:
Understood... that's why I thought the moving points might need to be modeled with the switchstand.
The profile work Walt did for DT made a lot of sense to me but AFAIK nobody took the next step and examined the question of how to apply that to non DT shapes; One would think it would be a straightforward 1:1 replacement, which in turn could lead to the next step of figuring out how to merge n number of continous segments... and on to n number of adjacent segments. What do you think of my idea of simply dividing up a tile into fixed sized squares and figuring out how to generate a single shape for all track found within each square? So long as the .tdb remains in use the game doesn't really care how the mesh to render as track was created.
#29
Posted 27 April 2013 - 12:17 PM
#30
Posted 27 April 2013 - 01:10 PM
The improvement that a loading distance of 4000 metres produces in a rural route is vast being way more realistic. On the NE vic route I am using as a test bed I have now done all 60 odd trees higher than 10 metres, curiously it appears to have made little difference to the frame rate. I will have to do a before and after editing the LOD's test to see the exact effect on the frame rate. I will post the results in the near future.
Lindsay