Unofficial Oblivion Patch excessive draw calls fix
-
Endorsements
-
Unique DLs--
-
Total DLs--
-
Total views--
-
Version1.0
File information
Created by
Quarn and Kivan and Arthmoor and PrinceShroob - PherimUploaded by
PherimVirus scan
About this mod
A patch for some meshes from the Unofficial Patches which can decrease performance by causing excessive draw calls.
- Requirements
- Permissions and credits
- Changelogs
What is this and why should I care?
Short version:
This mod fixes an issue present in some of the meshes from the Unofficial Patches for Oblivion, Shivering Isles, and the DLC, which can decrease performance in certain places due to excessive draw calls caused by NiTriStrips with more than 1 strip. Draw calls are commands from the CPU to the GPU to draw a 3D shape, and therefore increase CPU load. As Oblivion can only effectively use a single CPU core, additional draw calls almost certainly affect performance negatively. The meshes were fixed by optimizing them with Pyffi. As I don't know if the UOP will get updated at some point to fix these meshes, and not everybody can be expected to use Pyffi themselves, I decided to upload this patch for the Unofficial Patches.
Sniff can be used to detect problematic meshes (Find several strips), however, sometimes only the collision meshes are affected, which is fine, since they are not drawn and therefore don't cause draw calls.
Update: The fastest, easiest and potentially safest way to fix the issue is with Sniff itself, as it can convert NiTriStrips into NiTriShapes. This also works with things Pyffi cannot optimize, like Hair. Still, always backup your files!
So far, I found:
- Balanced Magic
- Mesh Improvement Project (two meshes are affected)
- Harvest Containers
- Jungle for Everyone (Palm Trees Update10 only)
- Weather: All Natural (BSA, Mostly collision geometry, which should be fine, but there is a single, very simple mesh that is used in a few places to cover up windows. Can probably be neglected, as just a few interior cells are affected)
- Bomret's Texture Pack for Shivering Isles v1 with meshes from USIP (two meshes, but one of them is not used by the game, and the other appears to be identical to the one from the Unofficial Shivering Isles Patch, so you can just use that one, it is "SEWallPost01.nif)
- Maskar's Oblivion Overhaul (BSA)
- Coms Argonian Headstyles v2dot1 (Pyffi will skip these automatically because they are hairs, can be triangulated with NifSKope)
- Slofs Oblivion Better Beasts OMOD
- Argonian Beautification
- Scripted Argonian Feet
- Simple Horse Utilities - Saddlebags and Follow-Wait Commands
- Slof's Oblivion Horses
- Espless Slofs Horse Replacer
Unique Artifacts for Unique People(Should be optimized now)Artifacts Redone(Should be optimized now)- New Potions
- RD Better Book Collision (only extra folders vor other mods, not the "meshes" folder for Vanilla Oblivion)
- Cobl
- Mannimarco Revisited
- FLY UC01 02 remodel replacer for HGEC with BBB
(BSA) means that the mod uses a BSA to store its meshes, and it needs to be unpacked to edit them. You can just unpack the problematic meshes and use the fixed versions as replacers, so you don't have to re-pack the BSA again.
Obviously, I can't check every mod out there that has meshes. But I'm going to check all mods that I use myself. However, it looks like the issue exist in a lot of big and popular mods, and I won't be able to check them all.
If you think you have found mods with this issue, please let me know!
Epic Wall of Text version:
I recently stumbled over a blog post of someone who had noticed that in some places of the game, his FPS were significantly lower than they should be, particularly Cheydinhal near the gate, and he discovered that in this particular spot, the number of draw calls was extremely high, in the tens of thousands. My first reaction was "That can't be true!", and I went to check for myself. Surprisingly, I by using ReShade, which can display the current draw calls, I found that he was right, I also had huge amounts of draw calls in this area, but much fewer (less than 10%) in other, similarly detailed cells. For some reason, each individual house caused over 5000 draw calls, which is absolutely insane. If you are unaware of what draw calls are and why they are so bad: In short, every time an object is drawn on screen, the CPU has to give the command to draw this object to the GPU, which then draws it on the screen (one Object is NOT an entire nif file, but each individual part it consists of - more on that later). Therefore, draw calls increase the CPU load, and as Oblivion can only use a single CPU core, additional draw calls almost certainly decrease performance.
I was determined to find out what exactly was causing this, and after a short investigation it became clear that this only happens if the Unofficial Patch is installed. Yes, THE Unofficial Patch. A quick search in the comments showed that some people had already reported performance issues in Cheydinhalt, but they were always told that it could not be the UOP causing this, and that the meshes had been sufficiently optimized a long time ago.
However, I noticed that the meshes in Question used NiTriStrips instead of NiTriShapes for their geometry, and the NiTriStripsData in these particular meshes had "Num Strips" values of, well, more than one. What does that mean, you ask? Well, I try to keep it simple: Basically, there are two ways in Oblivion a 3D shape can be drawn: NiTriShapes and NiTriStrips. NiTriShapes are simply shapes consisting of triangles, nothing special about them. NiTriStrips however (as far as I know) organize these triangles into "strips", which supposedly is more "optimized" than NiTriShapes, however, if that ever made any difference, it doesn't any more, as far as I can tell. Even worse, one NiTriStrips can consist of any number of individual strips (not any number, but up to as many as it has triangles, in which case each strip only contains a single triangle), and here is the catch: EACH of these individual strips causes one draw call. Normally, one NiTriShape causes one draw call, the same is true for NiTriStrips with Num Strips = 1 (I am not sure if there even is any difference between a NiTriShape and a NiTriStrips with just 1 strip, as far as the engine is concerned). Some of the affected meshes have several thousand strips in a single NiTriStrips, each with only a single-digit number of triangles.
As far as I'm aware, this problem occurs if a model is exported from Blender 2.49b with the nif plugin (which is STILL the most functional Blender plugin for Oblivion, unfortunately, as exporting collision geometry does not work in newer versions, at least for me) and "Stripify Geometry" is checked, but NOT "Stitch Strips". It is very important to either enable both options or none (as NiTriStrips with just one strip probably don't perform any different than NiTriShapes, checking none would be perfectly fine - edit: more recent tests seem to suggest that NiTriShapes perform slightly faster) to avoid this issue.
One more thing of importance is that in the vanilla game, it depends on the version of the game whether NiTriShapes or NiTriStrips with single strips are mostly used for visible geometry (apparently, the retail versions used NiTriShapes, but the Steam and GOG GOTY versions use NiTriStrips), but NiTriStrips with multiple strips are ONLY used in Collision meshes, which are not drawn and therefore don't cause any draw calls. In this case, it might even improve performance, as it seems logical to me that only one strip has to be used for collision detection any time something collides with the object, and not the entire collision mesh. However, as I am (so far) unable to make collision geometry with multiple strips myself, I could only test vanilla models agains modded ones with just one strip in their collision meshes. I might do that some time.
So, how can this issue be fixed? Well, first I used Sniff to detect which models actually had this issue (a total of 71 in the Unofficial Oblivion Patch, and a few more in the SI and DLC patches), then I used Pyffi to optimize them. This converted all NiTriStrips into NiTriShapes, eliminating the problem. However, Pyffi, as other tools as well, is not perfect and may actually make the meshes unusable by the game, which can lead to crashes, so it should be used with caution.
Installation
It is highly recommended to use a mod manager to install this. Mod Organizer 2 and Wrye Bash will probably work best, I don't know about Vortex, as I don't use that myself. Make sure this mod is installed/loaded AFTER the Unofficial Patches, and that their files get overwritten.
Manual installation is not recommended.
Compatibility
Any mod that changes the same meshes will be incompatible, however, it is possible that they don't have this issue and overwriting will be safe. I intend to check popular mods for this issue and report and conflicts I find here.
So far, I have confirmed the following mods to be unaffected (no fix necessary):
- Improved Middle and Upper Class Architecture
- Animated Window Lighting System and Chimneys - AWLS
- Harvest Flora
- Oblivion Upscaled Textures (OUT), Shivering Isles Upscaled Textures (SIUT), DLC Upscaled Textures (DLCUT)
- Farm fence retexture and UV maps
- RobertMaleBodyReplacerV52
- Roberts Female Body v13
- Seamless - Robert Male
- Let the People Drink
- Male Hair Mod
- The Ayleid Steps
- Retextured Potions
Credits
The Creators of the Unofficial Patches and all other mods I might upload patches for
zilav for Sniff
Amorilia for Pyffi