castle-engine
castle-engine copied to clipboard
Optimize fps_game example performance (e.g. bake non-dynamic lights) and loading time (e.g. load vertex buffers from glTF directly)
Hi i tried runing the new fps_game example but the game is realy slow in loading time and runing fps it shows 5 and sometimes 2 fps , i have an old gpu Nvidia geforce gt-610 but the example is not a complex scene so i don't know where the slowleness is coming from hardware or the engine ?
my os is windows7 win32 , i build the example with fpc 3.3.1
The current examples/fps_game is actually quite demanding, though it should definitely have more FPS on modern GPUs.
-
How do other demos work for you? Create new project using "New Project -> 3D FPS Game" template, run it and look at FPS. How many FPS do you get?
-
Also, I would very advise to upgrade your Windows, and you likely should use win64 as most users now. Microsoft ended support for Windows 7 in 2020, and you really should not use Windows without security updates.
I realize it may be easier said than done, if you have older hardware, but you just really have to upgrade -- you should use OS with security updates. Even if CGE will continue to work on Windows 7 for probably a long time, but we do not test on unsupported Windows versions so cannot guarantee.
-
Please provide your system information, open any project in CGE editor, use menu item "Help -> System Information" and use "Save to file" to send us the report.
thanks , i'll try as you suggested
ok here is my system information cge_sysinfo.txt
Thanks for the report. It all looks good, i.e. the OpenGL supports shaders and all modern stuff.
That said, it is quite old hardware -- I see GeForce GT 610 is from 2012.
So it is possible that the answer is just: this particular demo, examples/fps_game/, is indeed just too resource-demanding to run on your GPU. It has a lot of lights and uses forward-rendering. There are possible optimizations there for low-end devices (limiting computed lights number or even forcing Gouraud shading), these are TODO to add there.
Please tell me still how many FPS you get with simpler demos,
Create new project using "New Project -> 3D FPS Game" template, run it and look at FPS. How many FPS do you get?
I am curious how good or bad is performance in this (much simpler) project, "3D FPS Game".
You can also turn off shadow volumes in "3D FPS Game" (select light with "Shadows = true", and turn them to "Shadows = false") and also measure FPS difference.
i tried probably all cge examples , and the fps was between 30-60fps (my screen refresh rate is 60fps) so only fps_game example was the slowler one, even if i turn the camera to none visible area , but as you mention maybe its because the uses of lights and forward-rendering
OK, thanks for testing.
So yes, this is definitely the fault of "heavier" 3D gfx in fps_game, and in particular lights. I'll see about adding there something like "low graphics mode". I already wanted to optimize loading too.
There is some solution now to this, albeit a bit "nuclear": With the new CGE, you can use option "Run -> Run Parameters -> Force Ancient Rendering" (see the screenshot) before running to force using old rendering method. This makes everything really quite uglier (Gouraud lighting, no shaders, no multi-texturing) but also much faster.
( Underneath, this option just runs the binary with --capabilities=force-fixed-function command-line option. In Pascal, this in turn sets TGLFeatures.RequestCapabilities := rcForceFixedFunction. )
Try it out, I bet this makes rendering much faster in your case :)

I'm renaming this ticket -- I would still like to do different fps_game optimization, by e.g. baking lights.
thanks michalis , it is much faster now 35fps , but the loading time is very long , do you think its because of big geometry ?
Yes, loading time is a TODO for fps_game too -- it is too big even on modern machines. This demo is probably the most intensive 3D demo we made so far (thanks to the fact that the art was made by real professional 3D artists with a guideline from me "make something pretty, let this be a stress-test of CGE too" -- https://castle-engine.io/wp/2022/10/21/concept-art-teaser-huge-graphical-and-functional-upgrade-to-our-fps-game-is-coming/ ).