cypher2012 Posted November 23, 2017 Share Posted November 23, 2017 (edited) Finally! Figured out how to create custom collision/physics WITHOUT 3DS max and without having to recycle the physics data off of another object. I will post an update once I've got the work flow nailed down. I've so far successfully created both a static and an anim static. Thanks to user a_blind_man for sending me some examples of what gets exported from 3DS max! I'm going to create a template nif file that you can download, that's bare bones, but can be run through elric once the custom collision is added. Bare bones skeleton nif structure template (nif structure created from scratch. Will need ALL details filled in):Download (bhkConvexVerticesShape)Download (bhkNiTriStripsShape (NiTriStripsData)) Sample nif file exported from 3DS max. Can be used as a base: Download Export model from Blender 2.49. Don't use the specific game export settings. I just selected the 20.2.0.7. Creates basic nif with an NiTriShape. Export with 'Stripify Geometries' and 'Stitch strips' if you are going to use NiTriStripsData.(If using TriShape) Use nifskope: On the TriShape: Havok->Create Convex Shape (Creates 'bhkConvexVerticesShape')OR Use Nifskope: Copy NiTriStripsData that Blender created and copy it over to the NiTriStripsData template. I had varying levels of success. Vertices and Normals transferred, but I had to manually copy over some bits at the bottom, such as the points, num triangles etc. Using a template "pre-elric" nif file (I'll upload once I've created a bare bones version), add the bhkConvexVerticesShape shape created in the last step to the template nif fileYou can then edit the havok options in nifskope under bhkRigidBodyOnce you are happy with physics and anything else you want to edit, just run through elric We're essentially just trying to replicate a nif file that gets exported from 3DS max, but with a mesh created in Blender. That way it can be run through Elric to create the physics binary data. You can now either build upon you new nif file or you can now copy the created physics data to another nif file that needs collision I still need to refine this process. Also, when you create the convex shape, I don't think it exactly copies you model! If you know a way of exporting NiTriShape from body slide or a current version of blender, that would be a lot better! Edited November 23, 2017 by cypher2012 Link to comment Share on other sites More sharing options...
deadbeeftffn Posted November 23, 2017 Share Posted November 23, 2017 Exciting! Link to comment Share on other sites More sharing options...
deathleopards Posted November 23, 2017 Share Posted November 23, 2017 Hey Cypher, thanks for posting this. Just a heads up, I"m not sure you're aware but all three download links you posted are the same: https://drive.google.com/file/d/12Pc_gSyFtoVt3saaDuhD6oz7VmibQnfk/view Link to comment Share on other sites More sharing options...
cypher2012 Posted November 23, 2017 Author Share Posted November 23, 2017 Hey Cypher, thanks for posting this. Just a heads up, I"m not sure you're aware but all three download links you posted are the same: https://drive.google.com/file/d/12Pc_gSyFtoVt3saaDuhD6oz7VmibQnfk/view Thanks for the heads up! I've updated the links! :) Link to comment Share on other sites More sharing options...
cypher2012 Posted December 7, 2017 Author Share Posted December 7, 2017 So I've gotten a little closer to a refined process. I recompiled Nifskope with the import obj option enabled again. I don't know why it was disabled, it works really well. The NiTriShapeData can be converted to NiTriStripData, which can be added to bhkRigidBody. So you just have to export your collision from Blender, or whatever modelling software you are using, as .obj and then you can import to Nifskope. There's a couple of settings you need to make sure are correct in Elric. 'Save as' must be 'PC', not 'PC - 32 bit'. Under 'Mesh-conversion'->'Options', make sure to tick 'Endian convert meshes'. Link to comment Share on other sites More sharing options...
hexabit Posted December 8, 2017 Share Posted December 8, 2017 I recompiled Nifskope with the import obj option enabled again. I don't know why it was disabled, it works really well. The NiTriShapeData can be converted to NiTriStripData, which can be added to bhkRigidBody.(Assuming you are also the one in NifTools Discord discussing this matter) If you were working from the PR for dev7 like I suggested you wouldn't have had to re-enable anything. It was to prevent people getting (at the time) dev4 for FO4 and seeing the option and believing they could use it. I only wrote export for BSTriShape, not import. "Works really well" is quite an overstatement. The code is riddled with issues and you likely didn't correct all the things I did in the PR, like adjusting for nif.xml changes, which you're probably also not using the correct XML, as right now it's also in PR status and the development version only comes with my builds on Discord. I will be (finally) releasing dev7 in a week or so, as it's gone through months of feature creep and testing. AFAICT you also did not heed my warning about your bhkRigidBody being corrupt. Your NIF version is 130 (FO4) but for bhkRigidBody that means > 83 and 100 (Skyrim and SSE) which the nif.xml processes as "also Skyrim". However the bhkRigidBody that Max exports has the Cinfo properties and data alignment of FO3 (34). Since bhkRigidBody are not technically valid blocks in version 130 (FO4), I don't want to muck up the nif.xml version conditions solely for pre-Elric FO4 NIFs. I took a look at your bhkRigidBody in the supplied NIFs and indeed the info is wrong. You created the block with NifSkope and then filled in values, but that means the data alignment is that of Skyrim and not FO3, so Elric is actually reading the wrong values for things like Friction, Restitution, etc. because the data becomes misaligned after Time/Gravity Factor. So, I repeat, the data is completely wrong after Time/Gravity Factor, and you have to manually realign the data. I also brought up the issue of MOPP to you, which I don't see any kind of warnings issued here. Anything beyond primitives/convex shapes in FO3 and Skyrim need a bhkMoppBvTreeShape as the first shape, and the actual shape data is below that. MOPP is a program which accelerates raycasting for each shape/face/triangle in the shape or shape collection. You can technically use collision without MOPP but it will be monstrously slow. We tested on both FO3 and Skyrim by stripping their MOPP data and FPS plummet and it becomes a stutter-fest. I brought up that you need to verify whether or not the lack of a MoppBvTreeShape with valid MOPP data has a negative impact on the Havok binary produced by Elric after conversion i.e. does it also lack the acceleration or did it hopefully remake it. Link to comment Share on other sites More sharing options...
Recommended Posts