Page 1 of 3

My Sadrith Mora inpsection

Posted: 29 Jul 2016, 23:32
by DestinedToDie
So I traveled to Sadrith Mora and noticed I had low fps. I´ve heard of people complaining about physics going up in there, but nobody ever got to the root of it. The physics went up to 100 compared to the low 30 of Balmora.

Curious to see what was causing it, I enabled the collision grid and started inspecting. It seems to be a combination of two things. There are like 6 Telvanni guards who aggressively wander around the place. This is fine on its own, as there are many wanderers in Balmora too, but the way the path they wander on can be problematic.

If you´ve ever explored Sadrith Mora, you´ll know that there are 4 outside shops. I think 1 sells armor, the other weapons, third sells potions and the fourth sells general items. The general items has some lootable urns with no collision mesh.

The difference here is that the Telvanni guards wander around these urns and other misc items whereas in Balmora the urns are in corners of houses where NPCs don´t go. Similarly there are small outside shops in Gnisis, but these don´t cause trouble because they are against the side of the temple wall instead of being in the middle of the street.

But perhaps the biggest offender here are the slave cages, past which the Telvanni guards occasionally wander.

Image

These cages do have a collision mesh. Let´s have a look. The one on the left is the mesh and the one on the right is the collision mesh.

Image

It seems like the upper and lower part of the rods were simplified into a wall, but for some reason the middle part was left as-is. In the next screenshot I´m going to walk against 2 rods and also against the ground and also the lower wall of merged rods. Let´s see what happens.

Image

I can get my physics as high as 250 by walking against it like that for 2 seconds. A single actor colliding with 8 faces = 100 physics. A Telvanni guard won´t explicitly walk against it like that, but he will occasionally breeze against it and cause collision to jump up and kill my poor frames. While not the only offender here, it is still a pretty big one.

It seems like OpenMW physics in general goes out of whack if you have more than 1 NPC walking near something that isn´t a simple cube.

So what´s the lesson here? Don´t place a lot of wandering NPCs near objects with no collision mesh. If you have issues in Sadrith Mora, the best course of action is to disable the 3 guards that frequent this slave shop + weapon seller potion seller + general item shop and you will shave off a significant amount of physics.

Re: My Sadrith Mora inpsection

Posted: 30 Jul 2016, 05:03
by raevol
Is there something we can do to fix this in our code?

Re: My Sadrith Mora inpsection

Posted: 30 Jul 2016, 07:11
by DestinedToDie
I don´t know of a solution in code myself, since I have no real idea of how it´s written.

Anyway, I decided to take another look this morning and this time setstrength 0 on guards so that they could not wander instead of completely disabling them. Turns out that despite not wandering, physics can still jump quite high, as high as 100.

After disabling all the NPCs, it went down to 6 and stayed there. So it seems the high physics is a combination of a lot of NPCs together idling (3 slaves, slavemaster, 3 telvanni guards, 3 shop owners in 1 tiny area) and the Telvanni guards aggressively wandering around the shops.

I feel like I´m still missing something, but can´t narrow it down.

Re: My Sadrith Mora inpsection

Posted: 30 Jul 2016, 07:17
by raevol
Are idle NPCs still doing pathfinding?

Re: My Sadrith Mora inpsection

Posted: 30 Jul 2016, 09:10
by DestinedToDie
On the other hand you have a place like Molag Mar, where there are 6 idlers and 3 wanderers.

Image

9 NPCs (2 are offscreen, but in the same cell) and you get solid 11 physics, no crazy spikes. There is a distinct lack of meshes near them tho. Meanwhile, 7 NPCs in Sadrith Mora (wandering guards disabled):

Image

Do keep in mind that the idle animation is not the NPC standing frozen still. They make small movements and nudges, which may account for the increased physics if these movements collide with other collision meshes.

Re: My Sadrith Mora inpsection

Posted: 30 Jul 2016, 16:28
by Pherim
I noticed something similar myself when I tested how well OpenMW works with MGSO some time ago (unfortunately not very), as there was an interior cell which had urns with improved meshes in it. As the vanilla meshes have no distinct collision meshes, the improved ones also had none, so the actual mesh was used for collision. When my Character walked against them FPS dropped dramatically, indicating that OpenMW does have a problem with more complex collision meshes. There is absolutely no FPS drop with the vanilla engine in this case.

So yes, I guess the bottom line is collision detection needs to be optimized before there really can be a 1.0 version. Here is the bug ticket for this: https://bugs.openmw.org/issues/3355
The urn meshes are even mentioned there. Now one way to work around this issue would be to give them collision meshes, for example the original Morrowind ones they are derived from. Of course, every mesh profits from proper collision meshes, but you cannot guarantee that every mesh from every mod has them. Also, here we seem to have a case where a vanilla mesh causes issues, and as I said, the vanilla engine has no problem with complex collision meshes.
I really hope you guys will find a way to improve this before version 1.0.

Re: My Sadrith Mora inpsection

Posted: 30 Jul 2016, 21:01
by MiroslavR
I cannot reproduce the cage spikes. Make sure no mod is replacing meshes/d/ex_t_door_slavepod_01.nif. I know that OpenMW doesn't recognize RootCollisionNode in some of the Morrowind Rebirth model replacers (if this node is not an immediate child of the root node), leading to an automatically generated, perfect collision mesh being used instead.

Edit: Ignore what I said about RootCollisionNode, OpenMW seems to handle it correctly.

Re: My Sadrith Mora inpsection

Posted: 31 Jul 2016, 06:23
by DestinedToDie
Adventurer wrote:Make sure no mod is replacing meshes/d/ex_t_door_slavepod_01.nif.
I´m using nothing else but vanilla Morrowind. It doesn´t get any more vanilla than this, I only installed Morrowind+Tribunal+Bloodmoon. The slavepod door can´t be from a mod.

Also it uses the collision mesh. I checked this using ToggleCollisionGrid and it uses same exact one I showed you in the Blender screenshot of the vanilla slavepod door extracted from Morrowind.bsa.

Image

But let´s pretend that this slavepod door is from a mod and has no simplified collision mesh whatsoever. What´s the difference, then? Vanilla engine is still handling collision better than OpenMW.
Pherim wrote:When my Character walked against them FPS dropped dramatically, indicating that OpenMW does have a problem with more complex collision meshes. There is absolutely no FPS drop with the vanilla engine in this case.

Re: My Sadrith Mora inpsection

Posted: 31 Jul 2016, 19:48
by Atahualpa
I cannot reproduce the issue either.

Are we sure that this is an engine problem? I don't know anything about our physics implementation but maybe it's hardware-related. -- Just think of the AMD issue with flickering textures.

Edit: I was able to get a slight increase on pyhsics load (going from 2 to 5-8 for a short amount of time) when walking against the cages in/from a very, very special angle/position. Without my character interfering, no peaks did occur.

Edit 2: Maybe the frame rate is important too? I normally get 60-80 fps in Sadrith Mora on maxed out vanilla graphics.

Re: My Sadrith Mora inpsection

Posted: 31 Jul 2016, 20:11
by DestinedToDie
Atahualpa wrote:Edit 2: Maybe the frame rate is important too? I normally get 60-80 fps in Sadrith Mora on maxed out vanilla graphics.
I switched to high performance mode (fps capped at 30) and had 6 physics just being in the shopping spot, 20 physics running against the pod jail door. Seems like physics does scale with fps.

Looks like if you´ve got a pretty good machine you won´t notice the difference. The situation does sound way better than I thought tho if you can simply power through it.

I like to keep my laptop´s cooler calm, so I play on power saver and 30 fps, so that´s where I really feel it when there´s something specific causing a higher amount of physics than usual.