Why is renderspeed with Needle Engine in comparison to three.js so slow? In all cases I use exact the same scene, camera, lighting and postprocessing (renderPass, ssrPass, ssaoPass, fxaaPass, outputPass)
The difference in render speed between Needle Engine (NE) and vanilla Three.js (3D) can arise from various factors, particularly how NE handles rendering and lifecycle events.
Lifecycle Handling: Your use of onInitialized vs onUpdate can significantly impact performance. Using onUpdate may lead to continuous re-setup of the composer, which can consume more GPU resources. Ensure that heavy operations are minimized or run only once where possible.
GPU Load: You mentioned a higher GPU load with NE in the onUpdate cycle (70% vs. 30% on stable 60 fps). This could be due to unnecessary recomputations of post-processing effects or too frequent updates of the rendering pipeline. Consider optimizing how often you update the composer.
Framework Optimization: NE may include additional overhead for features like collision detection or physics that Three.js doesn’t necessarily engage unless configured to do so. Try disabling or optimizing any additional features in NE that might be active during your renders.
Post-Processing Effects Impact: You aim to keep your post-processing the same between NE and Three.js, but ensure that the way it is implemented in NE is optimally configured. For instance, check if you can lower the resolution or frequency of certain effects without losing quality.
Suggestions:
Use onInitialized for one-time setup and limit heavy operations in onUpdate.
Look into the API for ways to cache results from frame to frame rather than recalculating.
Ensure that you’re not creating new instances of high-cost objects within your update logic without necessity.
For more specific improvements, consider profiling your NE application to pinpoint where the GPU load is highest and adjusting your coding practices accordingly. Performance bottlenecks can often be revealed through careful analysis of how and when certain rendering processes are initiated.
If the above suggestions do not align with your specific implementation needs, please provide more details regarding your scene configuration, NE version, and how you handle post-processing to further assist.
You can refer to the Needle Engine documentation to delve deeper into lifecycle management and performance optimization (see the documentation).
1 replies left - Get a PRO license for more AI replies. thread_A709dudZpZ1b6pGb087vioeW Reply to this message to continue the conversation
Hey, there should be no big difference in terms of performance, and certainly not to the extent you’re showing here. Managing component lifecycle does of course use some CPU cycles but nothing that should show up as 30% or more slowdown as you’re measuring here.
That being said, I don’t think you should set composer in every onUpdate() – are you doing that in your three.js comparison as well?
Would you be able to submit reproduction projects for the scenarios that you’re outlining here, so that we can take a closer look? Thanks!
Hi Felix,
I changed the code and it’s much faster now. BUT the difference becomes significantly greater with increasing resolution. Generally, I would expect the CPU load to be higher, but why the GPU, and especially with increasing resolution? Could it be due to the different Three.js versions? Thanks…
Generally I think you’re comparing things that are not comparable here (e.g. very different three.js versions, unclear if same environment image setup, unclear if same scene setup, antialiasing settings, file compression, and so on…).
Could you provide an actual reproduction project as Marcel has requested so we can see what you’re comparing here? Thanks!