PyFFI'ing the already PyFFI'd

Post » Wed Mar 09, 2011 3:07 am

I post this topic with apologies, because a similar topic already was posted a few weeks ago.

I recently upgraded from PyFFI 2.1.5 to 2.1.7. All of the meshes I've been using, including those buried in Bethesda or modded BSAs, were optimized with 2.1.5.
I have heard that it's safe to run previously optimized meshes through PyFFI again. But I am a bit worried about doing this, considering the many references to error corrections in the PyFFI development log:
Spoiler

Release 2.1.7 (23 January 2011)
===============================
  • Added support for Fallout New Vegas (contributed by throttlekitty and saiden).
  • Updated geometry optimizer to keep dismember body parts, for Fallout 3 and Fallout New Vegas (fixes issue #3025691 reported by Chaky).
  • Added flag to enable debugging in vertex cache algorithm, to assess how suboptimal the solution is on any particular mesh (testing reveals that it finds the globally optimal solution in more than 99% of all iterations, for typical meshes).
  • New check_triangles_atvr spell to find optimal parameters for vertex cache algorithm by simulated annealing.
  • Fixed send_geometries_to_bind_position, send_detached_geometries_to_node_position, and send_bones_to_bind_position in case skin instance has empty bone references (fixes issue #3114079, reported by drakonnen).
  • Fix for verbose option in multithread mode (reported by Gratis_monsta).
  • Fix optimize spell when no vertices are left after removing duplicate vertices and degenerate triangles (reported by Gratis_monsta).
  • Fixed tangent space issue along uv seams (reported by Gratis_monsta and Tommy_H, see issue #3120585).
  • Log an error instead of raising an exception on invalid enum values (fixes issue #3127161, reported by rlibiez).
  • Disabled 2to3 in Windows installer; the Python 3 version of PyFFI will be released separately.


Release 2.1.6 (13 November 2010)
================================
  • The optimize spell now includes two new spells: opt_collisiongeometry for optimizing triangle based collisions, and opt_collisionbox for optimizing simple box collisions. This should result in faster loads and probably also a small but noticable performance improvement.
  • Fixed opt_collisiongeometry for multimaterial mopps (reported by wildcard_25, see issue #3058096).
  • New SpellCleanFarNif spell (suggested by wildcard_25, see issue #3021629).
  • Bad normals are now ignored when packing a bhkNiTriStripsShape (fixes issue #3060025, reported by rlibiez).
  • The opt_delunusedbones spell no longer removes bones if they have a collision object (fixes issue #3064083, reported by wildcard_25).
  • If the jobs option is not specified in the toaster, then the number of processors is used---requires Python 2.6 or higher (suggested by chaky2, see issue #3052715, implements issue #3065503).
  • New opt_delzeroscale spell to delete branches with zero scale (suggested by chaky2, see issue #3013004).
  • The opt_mergeduplicates spell now ignores (non-special) material names, so identical materials with different names will get merged as well (suggested by chaky2, see issue #3013004).
  • New spell to fix subshape counts (see issue #3060025, reported by rlibiez), it is included in the optimize spell.
  • New opt_collisionbox spell which automatically converts triangle based box collisions to primitive box collisions, which are much faster in-game (contributed by PacificMorrowind).
  • Optimizer spell now uses triangles to represent skin partitions (improves in-game fps).
  • Better vertex map calculation when calculating skin partitions (improves in-game fps).
  • Optimizer now always triangulates (improves in-game fps). Stripification will be readded later in a modularized version of the optimizer spell, for those that want minimal file size rather than maximal performance).
  • Much faster implementation of vertex cache algorithm (now runs in linear time instead of quadratic time).
  • Check triangle count when converting to box shape (fixes issue #3091150).
  • Bugfix in vertex map reordering (fixes most nifs reported in issue #3071616).
  • Bugfix in vertex cache algorithm (fixes a nif reported in issue #3071616).
  • Cover degenerate case in ATVR calculation when there are no vertices (fixes a nif reported in issue #3071616).
  • Cover degenerate case when calculating cache optimized vertex map (fixes a nif reported in issue #3071616).
  • Remove branches if they have no triangles (again fixes a nif reported in issue #3071616).



What do you think? Is it safe to redo the already optimized meshes, or should I start over? Or, maybe somewhere in between--like redo only certain types/categories of meshes?
EDIT: The main reason I am asking this is, I no longer have backups of some of the meshes. So putting optimized meshes through another optimization is my only (easy) option.
User avatar
Laura Shipley
 
Posts: 3564
Joined: Thu Oct 26, 2006 4:47 am

Post » Tue Mar 08, 2011 10:56 pm

Yes, you can reoptimize the same meshes.
User avatar
SiLa
 
Posts: 3447
Joined: Tue Jun 13, 2006 7:52 am

Post » Tue Mar 08, 2011 9:12 pm

Yes, you can reoptimize the same meshes.


Thanks, but I should have been clearer in my question. (I reposted this question in the general PyFFI thread.)
My primary concern has more to do with the bugfixes in 2.1.6 and 2.1.7. Basically, if the 2.1.5 optimization introduced an error into one of my meshes, will 2.1.7 fix that error? Or should I go back to the original NIF?

For example, the 2.1.6 changelog says: "Bugfix in vertex map reordering (fixes most nifs reported in issue #3071616)." If 2.1.5 introduced this a "vertex map reordering" error into one of my NIFs, will 2.1.7 fix that error?

As mentioned in the other thread - this could be an incredibly stupid question but I'm still reading through the various PyFFI documentation.
User avatar
Kelvin Diaz
 
Posts: 3214
Joined: Mon May 14, 2007 5:16 pm

Post » Wed Mar 09, 2011 11:58 am

Anything that got broken along the way should be thrown out and redone from the vanilla mesh. Hopefully it wasn't too many?

I occasionally find one that got the collision mangled and have to go back and redo it, but so far that's only been a scattered few which 2.1.7 doesn't seem to be repeating the mistakes with.
User avatar
Marlo Stanfield
 
Posts: 3432
Joined: Wed May 16, 2007 11:00 pm

Post » Tue Mar 08, 2011 10:58 pm

Anything that got broken along the way should be thrown out and redone from the vanilla mesh. Hopefully it wasn't too many?
I occasionally find one that got the collision mangled and have to go back and redo it, but so far that's only been a scattered few which 2.1.7 doesn't seem to be repeating the mistakes with.


Thanks for the response Arthmoor. I suspected that might be the case! I'd rather go back and redo all of the meshes, then take a chance that 2.1.5 mangled something that 2.1.7 cannot correct.


I just reextracted Oblivion - Meshes.bsa from the original DVD, and counted 7659 NIFs. But my current (installed) copy of that file has over 8000. Does anyone know if Shivering Isles modifies the Oblivion - Meshes BSA? I'm trying to figure out where the extra 500 or so meshes came from...
User avatar
Oceavision
 
Posts: 3414
Joined: Thu May 03, 2007 10:52 am

Post » Wed Mar 09, 2011 5:36 am

I get a .nif file count of 8.032 files from my unpacked Oblivion - Meshes.bsa, and that is off the copy of my GOTY DVD... so I don't know where your 500 meshes went. Certainly SI did not not mess with them. :)
User avatar
^_^
 
Posts: 3394
Joined: Thu May 31, 2007 12:01 am

Post » Wed Mar 09, 2011 4:15 am

Maybe one of these days some people will realize that PYFFI alone is not the complete answer to the best possible performance that can be achieved.

What is BYFFI. Blender+PYFFI.

Is it illegal to upload PYFFI'd meshes. Some say so.

Is it illegal to upload PYFFI'd Mesh patches. Others say not.

797kb vanilla to 781kb PYFFI'd

797kb vanilla to 423kb BYFFI'd

I rest my case.
Here is a proof patch. See with your own eyes.
http://www.4shared.com/file/9PYnx1To/icaugatewall01nifBYFFIPatch.html

Just a side note.
BTW Arthmoor. You should really learn to model... Your projects would improve 10x what they are now. Especially RAEVWD.
User avatar
Kate Norris
 
Posts: 3373
Joined: Mon Nov 27, 2006 6:12 pm

Post » Wed Mar 09, 2011 9:00 am

Metallicow--OK, you've definitely piqued my interest. I know that file size alone is a poor indicator of optimization (optimized meshes will often not be the smallest filesize possible), but 781kb versus 423kb is certainly eye-catching.

I have found no instructions, and in fact no mention before now, of trying to combine Blender and PyFFI approaches for optimization. Is there any documentation, or links (besides the proof patch) you could point me to so that I could read about it?
Additionally--would taking this approach require the user to do manual work in Blender, or would it be semi-automated as PyFFI currently is? Given that I am not at all familiar with Blender, nor do I have any interest in manually manipulating meshes except when something is broken, I'm hoping an automated approach is possible.

Definitely would like more information.
User avatar
FirDaus LOVe farhana
 
Posts: 3369
Joined: Thu Sep 13, 2007 3:42 am

Post » Wed Mar 09, 2011 8:54 am

Definitely would like more information.

Yeah, me too. Definitely! :drool:
User avatar
Fam Mughal
 
Posts: 3468
Joined: Sat May 26, 2007 3:18 am

Post » Wed Mar 09, 2011 1:20 am

Maybe one of these days some people will realize that PYFFI alone is not the complete answer to the best possible performance that can be achieved.

What is BYFFI. Blender+PYFFI.

Is it illegal to upload PYFFI'd meshes. Some say so.

Is it illegal to upload PYFFI'd Mesh patches. Others say not.

797kb vanilla to 781kb PYFFI'd

797kb vanilla to 423kb BYFFI'd

I rest my case.
Here is a proof patch. See with your own eyes.
http://www.4shared.com/file/9PYnx1To/icaugatewall01nifBYFFIPatch.html

Just a side note.
BTW Arthmoor. You should really learn to model... Your projects would improve 10x what they are now. Especially RAEVWD.


Yes. Please elaborate on that post. I'd like to know much more, as well.
User avatar
James Wilson
 
Posts: 3457
Joined: Mon Nov 12, 2007 12:51 pm

Post » Wed Mar 09, 2011 8:43 am

Metallicow--OK, you've definitely piqued my interest. I know that file size alone is a poor indicator of optimization (optimized meshes will often not be the smallest filesize possible), but 781kb versus 423kb is certainly eye-catching.

I have found no instructions, and in fact no mention before now, of trying to combine Blender and PyFFI approaches for optimization. Is there any documentation, or links (besides the proof patch) you could point me to so that I could read about it?
Additionally--would taking this approach require the user to do manual work in Blender, or would it be semi-automated as PyFFI currently is? Given that I am not at all familiar with Blender, nor do I have any interest in manually manipulating meshes except when something is broken, I'm hoping an automated approach is possible.

Definitely would like more information.


Well, Yes you have to know how to hand optimize meshes. to "BYFFI" them.

I started this little project a while back. Well, quite a while back....
Anyway, I really started figuring it all out when I requested BBC fix their screwed up IC meshes.
Well after a while of not having them fixed, I inquired again. Finding out, that they couldn't do it, because they could not model.
What was the problem anyway. Lots of strangely flipped normals, which I manually corrected. And hand optimized while I was in there.

As for one particular mesh I then, started chopping the stuff that really didn't need to be there out.
Which by the way should NOT be done to a vanilla BYFFI mesh unless you absolutely know the reprocussions. Doing this will affect all mods that use that mesh.

I so far am the only one who has even meantioned BYFFI. Some people were curious and thrilled at the results, but so far no one else has seemed to notice how to do this.

Imagine oblivion with PYFFI'd meshes. With a complete set of BYFFI'd mesh patches you would not only probably double the performance from PYFFI alone.
And to boot all the far meshes for vanilla oblivion arthmoor has included in RAEVWD would be null and void.

Anyway, I hope those that know how to model will catch on to this.

The patch is for the "outdated PYFFI'd Patch scripts Patcher"
NO it is not outdated. The patches just need remade from BYFFI'd meshes.
Sorry to say some people have been leading a lot of user with not-so-correct info for a long time.

If you do not know how to model, PYFFI is better than nothing. Anyway I gave you your first mesh. Joy.
All BYFFI'd meshes can only be realized as a community project. As far as the far meshes. simple. done. quick.

Maybe when I get some real time, I will start a thread detailing all of this. Maybe. But modelers must take notice first.
EDIT: WHY should modeler take notice? Because I alone do not have the time to do it all, nor does anyone else alone I would suspect.
Proof of concept.

Metalio Bovinus
User avatar
Danii Brown
 
Posts: 3337
Joined: Tue Aug 22, 2006 7:13 am

Post » Wed Mar 09, 2011 11:46 am

It seems this would be a worthwhile effort for those who have worked on past projects such as RAEVWD or Operation Optimization, that were interested in improving Oblivion's game performance without severely impacting graphical quality.
If I had any skill with Blender whatsoever I would volunteer to assist, but as I do not I can only hope that others will notice this thread and decide to work on such a project.

Given that vanilla Oblivion GOTY has well over 10,000 meshes, it might be a good idea to focus on a specific subset first, rather than just trying to tackle them all. For example, I would think some significant gains could be made just by focusing on buildings and city architecture, or armor and weapons, first.
User avatar
Euan
 
Posts: 3376
Joined: Mon May 14, 2007 3:34 pm

Post » Tue Mar 08, 2011 11:33 pm

Maybe one of these days some people will realize that PYFFI alone is not the complete answer to the best possible performance that can be achieved.


Well that would be great and wonderful, but not all of us are cut out to be Blender Gods. I look at that UI, and I cringe in horror at the sight of it. It makes my eyes bleed and my wrists throb in agony without doing a thing. Whoever cooked up that interface should be thrown back to 1985 where they belong.

Here is a proof patch. See with your own eyes.
http://www.4shared.com/file/9PYnx1To/icaugatewall01nifBYFFIPatch.html


It would be far more helpful to provide a working nif rather than a binary patch file. Most people won't know what to do with this. One mesh isn't likely to bring down the wrath of the legal team. It's only when someone decides that a wholesale repackaging of the entire BSA is fine and dandy - it's not.

BTW Arthmoor. You should really learn to model... Your projects would improve 10x what they are now. Especially RAEVWD.


See above. Blender and I are not on speaking terms. Besides, I happen to think I'm doing just fine without it. I'm not one of these people who feels that every new mod must also have new models.

And to boot all the far meshes for vanilla oblivion arthmoor has included in RAEVWD would be null and void.


I find that to be highly suspect without proof to back that up. The vanilla VWD meshes were already pretty lean to start with, all my cleanup of them did was strip the flags and node info they didn't/couldn't use properly.

Until they make Blender usable by the average joe (that would be me btw) something like this will remain in the realm of those who can decipher cryptic interfaces from hell.

In the meantime, you might want to elaborate on precisely what you mean by "hand optimization" because even with what I do know, I don't really have much of an idea of what that means in terms of the mesh, polygon counts, etc.
User avatar
Mark Churchman
 
Posts: 3363
Joined: Sun Aug 05, 2007 5:58 am

Post » Wed Mar 09, 2011 2:47 am

Well that would be great and wonderful, but not all of us are cut out to be Blender Gods. I look at that UI, and I cringe in horror at the sight of it. It makes my eyes bleed and my wrists throb in agony without doing a thing. --------SCRATCH THE REST-------.

See above. Blender and I are not on speaking terms. Besides, I happen to think I'm doing just fine without it. I'm not one of these people who feels that every new mod must also have new models.

I find that to be highly suspect without proof to back that up. The vanilla VWD meshes were already pretty lean to start with, all my cleanup of them did was strip the flags and node info they didn't/couldn't use properly.

Until they make Blender usable by the average joe (that would be me btw) something like this will remain in the realm of those who can decipher cryptic interfaces from hell.


I once also had that feeling..... I started out with AutoCAD. Still use it BTW For real life applications.
First I realized that AutoCAD is the BEST for Real-life production. Then I realized that after some little help I could produce my meshes (not for production, as quick as "blender gods") by learning how to use blender.
A Blender-GOD model will not cut it in the real-world production line BTW (so far I've seen) crippling.

Anyway... 2.5x is looking promising for Blender Noobs(Nifscripts haven't been released for it yet tho... so......)
If you would like me to guide you though this simple process of how to improve your meshes, send me a PM.

I didn't like to learn blender when I first started modding oblivion, but then again, I'm kind of a hard head, but guess what. It's kind of necessary for proofing.
I found it the same way as you did. First I looked at it and thought WTF. But after a little help, I caught on quickly.

I would like to see you succeed, just as I have.
Anyone else that would like to learn also is welcome to send a PM, but there is only so much time I can spend with a person.
I hope the time I spend reflects in their learning.


RAEVWD=298kb
RAEVWD BYFFI'd(Simple) = 111kb
http://www.4shared.com/file/CxXQmvZl/RAEVWDicexteriorwall01_farBYFF.html


Metalio Bovinus
User avatar
Kit Marsden
 
Posts: 3467
Joined: Thu Jul 19, 2007 2:19 pm

Post » Wed Mar 09, 2011 10:33 am

Even I am not certain what you mean when you say hand optimising in blender. I get the impression you haven't optimised the UV either on that one, if you really wanted to, you could have welded all the UV islands together, see it repeats itself and theres a probability of shaving 25% further in vert count. you can probably drop it to under 100kb. It's a sneaky one, the only thing you need to worry about is freaking of the tangent space calculation by mirror overlying the islands along UV seams, but I don't think the UVs do that on this asset.

I get the impression you welded split edges, which are almost always split for a reason, and unified the normals and perhaps deleting hidden faces and what not. the deleting anything hidden is good, the welding split edges and smoothing the mesh isn't going to be ideal for most assets. But the UV optimising is something most peple overlook, the vertex count adds to file size. And welding islands together has no ill effects.

Anyway that last nif is still a shape, is there any particular reason why far nifs have to be shapes?(I have no experience with them) if usable strips would shave off another fraction on the filesize and will actually draw faster on screen.
User avatar
Nicola
 
Posts: 3365
Joined: Wed Jul 19, 2006 7:57 am

Post » Wed Mar 09, 2011 3:35 am

You guys are both talking about 30,000 feet over my head so I'll leave you to it other than to say I'm intrigued at how the vertex count on this wall was cut in half without any visual indication of quality loss. Although it seems the triangle count is exactly the same?

I don't know what the technical difference is between being a shape or "usable strips" but _far.nifs don't have to have a lot of things that the close up versions do. Like tangent space data or vertex color nodes for example.
User avatar
Amiee Kent
 
Posts: 3447
Joined: Thu Jun 15, 2006 2:25 pm

Post » Wed Mar 09, 2011 4:15 am

You guys are both talking about 30,000 feet over my head so I'll leave you to it other than to say I'm intrigued at how the vertex count on this wall was cut in half without any visual indication of quality loss. Although it seems the triangle count is exactly the same?

Split edges is how. In http://www.vigville.com/forum_images/SmoothingGroups.jpg image the face count never changes, but at export the vertex count will be different. To get the 2nd cylinder to look faceted like that, Maya and Max use what they call smoothing groups. This is essnetially making psuedo extra vertices like http://3.bp.blogspot.com/_V4SYpI93l98/TLURoIrPfzI/AAAAAAAAExk/vEy8vUw5S58/s1600/BenMathis_SmoothingGroups_Excerpt.gif

In blender you have to manually split the that edge to get that hard shaded effect. :/

I think the vertex number that is stored in the nifs vertices field also include the vertices that are in the meshes UV as well.


I don't know what the technical difference is between being a shape or "usable strips" but _far.nifs don't have to have a lot of things that the close up versions do. Like tangent space data or vertex color nodes for example.

triangles or strips is just how the mesh is drawn.
A mesh can be organised into a number of strips, best would be a single strip, being in the same strip allows the triangle just drawn to be used as the edge of the next adjacent triangle, so you make a small performance gain. Even if all things being equal, if I export something stripped they seems to be slightly smaller in file size opposed to if I had exported as a triangle.

and if there isn't tangent space for the far nifs, then you can definitely weld up some of those UV islands without much fear. Without the tangents extra data node normal maps will be ineffective and simply not render at all. so if these far assets do have normal maps associated I would start trying out updating tangent space in nifskope, just to see what happens :shifty:

I will bet that vert colors will still work too, there isn't an extra node that enables them, they are contained in their own vertex array within the NiShapeData block, and other extra properties associated with them probably don't do anything in this engine
User avatar
Kahli St Dennis
 
Posts: 3517
Joined: Tue Jun 13, 2006 1:57 am

Post » Wed Mar 09, 2011 9:58 am

Specifically I'm talking about the NiVertexColorProperty block. My experience has shown that leaving this block in place leads to the possibility of seeing black LOD. It's not the only cause, but it's one I was able to deal with by stripping those blocks off of every _far.nif that had them.

Tangent space data does nothing at all on a _far.nif and therefore leaving it in place just takes up memory space. However I have confirmed before that the normal maps associated with the textures used on _far.nif files DO make a difference in the visual quality of the object.
User avatar
Kitana Lucas
 
Posts: 3421
Joined: Sat Aug 12, 2006 1:24 pm

Post » Wed Mar 09, 2011 9:48 am

Specifically I'm talking about the NiVertexColorProperty block.

This just does nothing afaik. iirc The civ4 exporter adds this to objects that have vert colors, Vert colors always work regardless of it's presence though.

as for the normal maps working on the far nif. :shrug: I presume the shader accounts for the absence of the tangents and calculates them in engine. and I assume in this case you aren't actually making a gain in performance. Need to ask the programmer...
User avatar
Jessica Stokes
 
Posts: 3315
Joined: Fri Jul 28, 2006 11:01 am

Post » Wed Mar 09, 2011 1:08 am

Split edges is how. In http://www.vigville.com/forum_images/SmoothingGroups.jpg image the face count never changes, but at export the vertex count will be different. To get the 2nd cylinder to look faceted like that, Maya and Max use what they call smoothing groups. This is essnetially making psuedo extra vertices like http://3.bp.blogspot.com/_V4SYpI93l98/TLURoIrPfzI/AAAAAAAAExk/vEy8vUw5S58/s1600/BenMathis_SmoothingGroups_Excerpt.gif

In blender you have to manually split the that edge to get that hard shaded effect. :/

I think the vertex number that is stored in the nifs vertices field also include the vertices that are in the meshes UV as well.

Nice pics. Visually they explain a little of what can be done to a mesh. You seem to explain the technical parts better than I.

But as far as BYFFI overall,
I realize yes, that every mesh should be looked at as a different problem.
So I have a set of questions I ask myself ( for each mesh )
1. Should I remove duplicate verticies? What are the reprocussions if I do?
2. Can I make 2 or more collision faces into 1 face? If so.. GREAT. What type of collision and will it effect the final product?
3. What about Vertex Paint? Will it effect graphical appearance? If so, by how much?
4. What extra nodes/etc will blender add on export? Do these need removed in nifskope before PYFFI'ing?
5. Is optimizing the UV worth my time? Remember Vertex Paint may need redone.
6. Think some more?
7. Think some more?

Label top node of exported mesh with BYFFI before PYFFI'ing
EX. ICPalaceTower01 BYFFI
Stick mesh in BYFFI'd Meshes folder.
User avatar
Lucky Boy
 
Posts: 3378
Joined: Wed Jun 06, 2007 6:26 pm


Return to IV - Oblivion