Question Why the CPU usage drops significantly when mirrors are enabled?

zulusmjz

New member
Messages
4
Reactions
0
Points
1
Hello,

I'm not a performance optimisation geek, however I've observed something in VAM what at the first sight is not logical.

I'm running VAM in desktop mode on an a little bit outdated laptop (i5-7300HQ, 8 GB, GTX1050), so I don't expect high performance. I've noticed that disabling the mirrors in graphic setting improves the fps a lot, from 10-15 to acceptable 30 (high graphic settings). However, the increase is only short, after few minutes it drops down to 10 fps, even if I leave the VAM unattendend and change nothing. I've found out that with mirrors off my CPU usage reaches 70-80%, temperature rises quickly to 90-95 C and automatic downclocking is applied to save the CPU. However - and that's a surprise to me - switching the mirrors back on results in the CPU usage drop to 30-40 %. Of course fps drops again, CPU cools down and reverts to the standard 2,5 GHz.

vamscreen1.jpg vamscreen2.jpg

Is it an expected behaviour, or something is wrong?

Why the CPU uses only 30-40% when mirrors on - regardless of the scene, animations ect. Why VAM doesn't put more workload on CPU to improve the fps at least a bit?
On the other hand, when mirrors are off, why VAM doesn't limit the fps to put less workload on CPU to avoid overheating? Finally, mirrors on is a more demanding setting, isn't it? So why overheating takes place on less demanding settings and doesn't happen with more demanding?

I'm not sure if constant 70-80% of CPU usage schould really overheat it, perhaps there is something wrong with my laptop?

Right now the only option for me to get a playable VAM is to.... frequently switching the mirrors on to cool the CPU. Where is the logic?

Thanks for any advice.
 
Last edited:
If you enable mirrors you are probably getting limited by your GPU-thread, that's why the load on the CPU is less. If you want to stop your CPU feom overheating you could try limiting your framerate. No program in existence I know of takes your CPU temps into consideration. Your issues are standard with oretty much any laptop out there.
I would recommend a proper PC though. ;)
 
Upvote 0
A laptop cooler might help your CPU overheating problem. You can jury-rig one just to see if it works. Hold or prop the laptop up off the desk and setup a fan to blow over it.

Feel around the parts outside to find the spots that get hottest, make sure the fan is blowing on them and whatever you use to prop up the laptop isn't blocking flow to those parts.

If you want a good tool to see all the temps and such on your system, try this https://www.hwinfo.com/ gives a ton of information including telling you when the CPU starts thermal throttling. You can graph any of the sensors too....just open it up and click the "sensors" button.

If it works you can buy one of those cheap laptop coolers.
 
Upvote 0
My first thought when a CPU is overheating is always dust coating the heat sinks, reducing their cooling ability. I'd suggest taking the laptop outside and blowing it out with compressed air. I like to do this at least once year.
If your machine is older and you've never done this, it's even more likely this is the issue.
 
Upvote 0
From what I can see, when you turn on any mirror or camera, VAM does all the physics twice. Not sure if this is a bug, or just part of the unity engine.
 
Upvote 0
According to the screenshot you have a scene with 3 mirrors? That means your scene needs to render 4 times instead of just once. Of course the mirrors have lower resolution than your monitor, but still you got to render 4 times. So, your CPU is waiting on the GPU, simple as that. And that's what you see. Has nothing to do with overheating, as you see in the screenshot, with mirrors the temp is actually lower.
 
Upvote 0
No, that is not the case. However you got to render for every camera perspective. As said, that's why we are waiting on the GPU here.

Yeah I realise the render overhead of re-rendering the screen (game dev myself), but I do notice a massive CPU spike when a mirror is enabled, which (in my opinion) suggests that the physics being also done multiple times. It sort of makes sense as models are usually using their own local coordinates/matrix in engines, but I would think it should be possible still to do the physics once at the start of the frame and reuse the results.

Another option may be to only render mirror updates once every X frames (possible render slightly larger area to account for movement) and reuse? Not sure how this would work out, but it's an idea.

For environment type reflections, screen space reflections would probably also be quite handy and have much less cost than a mirror.

Another thing, maybe the mirror object should be single sided. Not sure if that has an impact or not (no idea how the culling system in unity/vam works).

Another option for all this of course is LODs (and the game in general), which would help mirror render times.

The mirror situation is one of the things in VAM that always gets to me, I have them in every scene I make, and the moment you add one, game speed drops by around 1/2.

On a side note, thanks for all the work you do for the community @MacGruber with all the scripts and assets (even answering forum posts it seems :) ). It's appreciated.
 
Upvote 0
but I do notice a massive CPU spike when a mirror is enabled, which (in my opinion) suggests that the physics being also done multiple times.
That is not the case. I recommend to familiarize yourself with the execution order during frame updates in the Unity engine:

Another option may be to only render mirror updates once every X frames (possible render slightly larger area to account for movement) and reuse? Not sure how this would work out, but it's an idea.
That's a common thing to do. Obviously you get lower frame rate in the mirrors, so you can't go too low or it becomes noticeable. VaM does not support this on its own, but this is doable via plugin. Just got to find someone to code it for you (or do it yourself)

Another thing, maybe the mirror object should be single sided. Not sure if that has an impact or not (no idea how the culling system in unity/vam works).
Mirrors in VaM are not rendered when not on screen. Check this, I put a mirror onto one of the walls. Its not visible in the first part, but in the second. Obvious FPS difference from the mirror, although the character is closer, too:

Another option for all this of course is LODs (and the game in general), which would help mirror render times.
Yes, of course. VaM has no real LODs, but to a limited degree you get similar effects via Mipmaps (texture resolution) as well as hair rendering.
 
Upvote 0
That is not the case. I recommend to familiarize yourself with the execution order during frame updates in the Unity engine:

Hmm, are you sure a mirror is not considered a new frame by the renderer (in essence, eg: may treat a mirror as a new frame without increasing the frame number)? I know it is in the engine I use, no idea with unity. My only evidence is from ingame testing and CPU usage spikes watching fpsvr when a mirror is turned on. The extra GPU usage is expected, but i'm more trying to account for the CPU spikes. I think these are exagerated somewhat by my older CPU, but the overhead seems very high simply switching them on/off.

That's a common thing to do. Obviously you get lower frame rate in the mirrors, so you can't go too low or it becomes noticeable. VaM does not support this on its own, but this is doable via plugin. Just got to find someone to code it for you (or do it yourself)

Unfortunately, i'm a c++ coder, my c# and unity engine knowledge is lacking for something like this.

Mirrors in VaM are not rendered when not on screen. Check this, I put a mirror onto one of the walls. Its not visible in the first part, but in the second.

I'm more thinking about the mirror's back face when on screen. I imagine it's culled, but I have no evidence either way.

Yes, of course. VaM has no real LODs, but to a limited degree you get similar effects via Mipmaps (texture resolution) as well as hair rendering.

Yeah mipmaps can help with mostly vram bandwidth, but there's nothing like lower poly count :)

Volumetric billboards would be a really cool option, and easier then lod models, these could be generated on mesh load. Although this is something for the VaM devs to consider, I doubt this could be done as a plugin.
 
Last edited:
Upvote 0
Back
Top Bottom