Garry's Mod

Garry's Mod

VRMod - Experimental Virtual Reality
SiEgE Mar 25, 2020 @ 5:39pm
Gmod optimizations for VR
So, the recent usability and feature updates totally immersed me deep into the VR Gmod. The thing is a blast! Movement is top notch. Most issues that bugged me before are fixed, and it is actually pretty stable now.

But.. there is one issue - it lags like hell. Because of lack of frames, my Motion Smoothing makes the world look like a sick dream(everything is morphing and refracting). I think my fps is jumping around near 15-50. Some spots(like, inside of buildings) are pretty stable and my fps is tolerable, but sometimes it is no longer enjoyable and is actually discomforting to a point I don't want to stay at a spot.
I know, Source is a pretty dated engine, yadda-yadda. But, there are still ways to improve Gmod's performance. How about we group up some, that would be useful for every VRMod player here? As a bonus feature - lets also add more graphics improving configs.

Optimizations:
gmod_mcore_test 1 //Multicore computing(Gmod specific). Test feature. May be unstable.
mat_queue_mode -1 //Multicore rendering(textures)
cl_threaded_bone_setup 1 //Multicore rendering(model bones). May be unstable

Bonus:
dsp_enhance_stereo 1 //Better sound effects
mat_parallaxmap 1 //Parallax maps for textures that have them
< 1 2 >
Showing 1-15 of 18 comments
SiEgE Mar 27, 2020 @ 2:58pm 
So, I've made some performance checks, and this is my report:

RT(realtime) Cameras - they are the performance killers for the VRMod. Avoid maps with RT Cameras(for example - gm_construct has an RT Camera. RT Camera is what the reflection mirror texture at one of the rooms is).

Refractive shaders - Prefer disabling/setting shader quality to Low, as it also can cause lag spikes for the VR Mod.
SiEgE Apr 19, 2020 @ 5:08pm 
Found a perfect map for performance checks: mario_kart
If you go around the map using the road, while facing away from the center of the map, performance is absolutely perfect. I bet there is around 90 constant FPS.
But, once I face the center of the map, FPS instantly hits low numbers. I've tried placing myself at the center of the map, while looking at 2 different directions, and FPS was pretty much stable, but once I walk further away - it gets laggy again.

That makes me think that the possible issue with the low framerate may somehow be connected to distance. That means:
- Vis leaf issues?
- Render distance issues?
- Distant models?
SiEgE Apr 19, 2020 @ 5:49pm 
Yep, as I thought.
"r_novis 1" kills the crap out of VR performance almost no matter where I look at.

Seems like open world maps are the worst kind for VRMod in its current state. The more there are VIS divisions, the more performant would be the map.
Performance damage grows with distance observed, and not the actual FX in-game features.

The best map type for VRMod is a small box map.
The second best type of maps for VRMod are close quarter, short corridor and small room maps with perfect VIS optimization. Less the possible distance between perceivable parts of maps - the better
Last edited by SiEgE; Apr 19, 2020 @ 5:51pm
SiEgE Apr 19, 2020 @ 6:03pm 
More info:
Quality of models, textures or shaders has NO effect on VRMod performance. The observed odd lag is somehow connected to maps and their size.

Using command r_mapextents allows you to play any map in VRMod on highest FPS possible. The command cuts the max perceived distance.

This command requires sv_cheats 1.
Default value for this command is 16384.
Last edited by SiEgE; Apr 19, 2020 @ 7:14pm
SiEgE Apr 19, 2020 @ 6:32pm 
For map mario_kart:
With r_mapextents at value of 2000 the game is no longer as laggy, with some exceptions.
With r_mapextents 1500 the game is pretty much lag-free, with some little exceptions.
Reducing the number even lower will remove the rest of lags.

RT Cameras do not damage performance, but the stuff that is rendered through it does. Reducing the r_mapextents also removes RT Camera performance penalty.
Last edited by SiEgE; Apr 19, 2020 @ 7:12pm
SiEgE Apr 19, 2020 @ 7:09pm 
Interesting.
Whatever it is, it probably has something to do with brush complexity, or brush lighting.

I've also found out, that having anything in your hands BUT the "empty hands" also badly damages the performance, and I have the world models enabled, so model complexity/textures is pretty much out of question.
Last edited by SiEgE; Apr 19, 2020 @ 7:15pm
IvanTheRexouium Apr 19, 2020 @ 8:00pm 
Originally posted by SiEgE:
Yep, as I thought.
"r_novis 1" kills the crap out of VR performance almost no matter where I look at.
Disabling VIS kills all optimization in a map, so I'm not surprised.
Do net_graph 1 or cl_showfps 1, and look at your framerate even in desktop mode, it'll likely tank from 250+ fps to 70 after running that command
Last edited by IvanTheRexouium; Apr 19, 2020 @ 8:00pm
IvanTheRexouium Apr 19, 2020 @ 8:05pm 
Originally posted by SiEgE:
Interesting.
Whatever it is, it probably has something to do with brush complexity, or brush lighting.

I've also found out, that having anything in your hands BUT the "empty hands" also badly damages the performance, and I have the world models enabled, so model complexity/textures is pretty much out of question.
If you think there's something going on with lighting, maybe give mat_fullbright 1 a try, as for the weapons, I don't really see much performance change unless using the physgun, toolgun, or have viewmodels enabled
SiEgE Apr 20, 2020 @ 9:13pm 
For the map mario_kart:
r_drawbrushmodels 0 - gives a good FPS boost.
r_drawstaticprops 0 - gives a slight but steady FPS boost.
r_drawentities 0 - no lags since every entity and every model is removed. But, that reassures me that static brushes or lighting are not the issue either.

+showbudget shows that 2 of the most heavy loads are "Unaccounted" and "GLua". That means the only one thing - whatever the lags are caused by - fiddling directly with graphics won't help.

Too big "Unaccounted" line may be caused by fps_max or apps running in the background, and is USUALLY not something that is worth worrying about.
The oddest thing about it is that GLua usage grows alot depending on the viewable things.

I'll try more "secret commands" later.

P.S. mat_fullbright 1 has no effect.
Last edited by SiEgE; Apr 20, 2020 @ 9:13pm
SiEgE Apr 23, 2020 @ 8:34pm 
So, I went through the entire possible set of console commands and haven't found a single one to help(removing transcluent entities and props did add some fps for the mario_kart map, but that is basically it).

Whatever the issue there is, it is 100% caused by how LUA or the VRMod infused renderer is interacting with entities, existing on the map, and only as long as player is seeing them on his screen.
Model quality is not the issue. Lighting is not the issue, Static brushes are not the issue, Textures are not the issue.
Last edited by SiEgE; Apr 23, 2020 @ 8:35pm
IvanTheRexouium Apr 23, 2020 @ 11:22pm 
Originally posted by SiEgE:
So, I went through the entire possible set of console commands and haven't found a single one to help(removing transcluent entities and props did add some fps for the mario_kart map, but that is basically it).

Whatever the issue there is, it is 100% caused by how LUA or the VRMod infused renderer is interacting with entities, existing on the map, and only as long as player is seeing them on his screen.
Model quality is not the issue. Lighting is not the issue, Static brushes are not the issue, Textures are not the issue.
Gmod is just not optimized for this, Source is an old engine. As a result, the multicore support is limited, as well as many other things which may affect performance.

Also, you aren't wrong with GLua being a performance killer, it's not too bad with only a few addons, but the more addons you have, the more it'll affect your performance, even if said addons aren't in use as their lua code still runs.

You said you're getting 15 - 50 fps, but have you tried for example, d1_trainstation_02 and checked there, or gm_flatgrass? I seem to get a solid 90 fps in those places
SiEgE Apr 24, 2020 @ 5:20am 
Originally posted by Ivan:
Originally posted by SiEgE:
So, I went through the entire possible set of console commands and haven't found a single one to help(removing transcluent entities and props did add some fps for the mario_kart map, but that is basically it).

Whatever the issue there is, it is 100% caused by how LUA or the VRMod infused renderer is interacting with entities, existing on the map, and only as long as player is seeing them on his screen.
Model quality is not the issue. Lighting is not the issue, Static brushes are not the issue, Textures are not the issue.
Gmod is just not optimized for this, Source is an old engine. As a result, the multicore support is limited, as well as many other things which may affect performance.

Also, you aren't wrong with GLua being a performance killer, it's not too bad with only a few addons, but the more addons you have, the more it'll affect your performance, even if said addons aren't in use as their lua code still runs.

You said you're getting 15 - 50 fps, but have you tried for example, d1_trainstation_02 and checked there, or gm_flatgrass? I seem to get a solid 90 fps in those places
I forgot that I've set myself an on-launch "+gmod_mcore_test 0" some time ago, so I basically had my FPS halved this whole time :D
Only noticed it yesterday, but still, that allowed me to do some tests on a border fps position.

With mcore disabled, everything was lagging me, including gm_flatgrass(it didn't in the beginning, but as I spawn stuff or pick a weapon instead of empty hands, it did drop my FPS to 45).
ItsYuri May 28, 2021 @ 10:08pm 
Originally posted by SiEgE:
More info:
Quality of models, textures or shaders has NO effect on VRMod performance. The observed odd lag is somehow connected to maps and their size.

Using command r_mapextents allows you to play any map in VRMod on highest FPS possible. The command cuts the max perceived distance.

This command requires sv_cheats 1.
Default value for this command is 16384.
r_mapextents Is perfect for big or long maps, it does totally limit the scene but usually works well!
Just try to fiddle to what you want to see until you're satisfied with :cta_emo7:
Derp Jun 17, 2023 @ 10:33pm 
I saw that my FPS in vr is locked at 45 fps, how do I uncap it?
SiEgE Jun 18, 2023 @ 5:10am 
Originally posted by Derp_Trap_King:
I saw that my FPS in vr is locked at 45 fps, how do I uncap it?
It is not completely locked at 45 fps. It sees that it cannot reach 80/90 fps so it locks fps at half the value. Once you get in a situation where your fps would be solid 80/90, it'll unlock your fps.
Feature that is responsible for that is called Motion Smoothing, in SteamVR, but many other HMDs have their variants of that feature, accessible somewhere within its software.
< 1 2 >
Showing 1-15 of 18 comments
Per page: 1530 50