Thursday, December 17, 2020
Friday, November 27, 2020
- Disabled CastShadows, ReceiveShadows, & UseLightProbes on all meshes and fragments where applicable.
- Set a handful of shaders from Standard (Spec) to mobile diffuse.
- Separated shutters and swinging doors into two separate occludible GOs.
Working on optimization now. Thus far, controlling enabling and disabling of the fractured objects has worked well, but the FPS still has noticeable hitches from time to time--namely when the camera pans from stage to stage & also the hotel due to the sheer # of fractured objects. Reports (from Harry, done on the test machine) states that the FPS, "...actually seems to be doing very well, there's a few places where the FPS will drop for around 40 if you've been machine-gunning with the shotgun..." A quick look into the profiler while viewing only the saloon indicates that the drawing of opaque geometry is taking the longest to process, with physics.processing, and the animators.update being 2nd and 3rd respectively
- Disable the shadow casting on all of the fragments (maybe disable receive shadows as well?).
- Using a more simple shader on the secondary material of the fractured pieces.
- Adding the ability to enable & disable the shutters and swinging doors one at a time.
- Disabling the fragmented lg windows that are covered by shutters.
- Grouping together of multiple fractured GOs. This could be time intensive as it would require both placing & grouping unique building pieces together in Blender.
Wednesday, November 4, 2020
During the process of optimizing the meshes and maintaining material ID consistency (see previous post), I was merging verts based on a distance threshold, which while good, was still leaving a fair number of coplaner verts. For example, the verts on the right would be merged, but not the verts on the left.
Regarding fracturing, I am now addressing an issue that I've been aware of for quite some time but have yet to confront--the random reordering of Material IDs. This issue is brought to bear by the need to reuse the door mesh, which uses different, unique materials for the jail, the saloon, & the hotel.
Evidence of the swapped material IDs is exhibited when attempting to manually reassign materials to the individual fragments. ID 1 should be the facade of the door and ID 2 should be a generic wood, yet it can be clearly seen that this is not the case.
After some searching I found this thread on the Unity forums indicating that on import Unity correlates vert/face values with material ID values. For example, whatever material the very first face (however that is defined) is using would be material 01, whatever material the second face is using would be material 02, etc. In essence, the specific sequential ordering of the faces directly affects the order of the materials on those objects, so despite the objects displaying the correct material ordering in Blender, the import into Unity does not.
I found a solution here, and (in Blender) select all of the verts of every fragmented object and then "sort mesh elements" by material (ensure the "faces" option is selected). This will effectively reorder the faces according to materials, which is what we need.
As a side note, I also merged verts by distance and was surprised to see that it removed 6000+ verts without noticeably affecting the mesh. I should do this for all fractured pieces and reimport.
Thursday, October 29, 2020
Tuesday, October 27, 2020
Let's see what happens when attempting to integrate a fractured target. The target itself has both a mesh collider and a rigidbody, which are typically not on the initial mesh, so I'm unsure whether or not that will create problems or even if those components will be necessary when all is said and done. Also, the cell fracturing may not play nicely with this complex of a mesh; typically it likes quads, and quading out this mesh could be a headache. Oh well, here goes...
Friday, October 23, 2020
Box colliders instead of mesh colliders on the windows was apparently a not great thing as the BreakableObjects script specifically looks for a MeshCollider when disabling it on shot. I could probably fix this without breaking anything, but to be safe I'm not going to bother with it; at least, not yet. Anyways, as I said before, I imagine the performance benefits (if any) are negligible compared to the physics hit I'm getting on the fragmented objects.
Running into frame rate issues, which doesn't exactly come as a surprise. Spamming the P2 shotgun (the equivalent of 9 shots) & the sheer number of fractured objects on screen at any given time both seem to impact performance more than anything.
I've already made a couple of adjustments--namely reducing the time until the CombineInstance function fires & drastically reducing the life time of the particle fragments--which seems to have helped, but the performance is still not where it should be. I've also replaced the mesh colliders on the window panes with box colliders, which I would assume is also less expensive, if only barely. Other than that, I'm not yet entirely sure how I'm going to handle this...
Thursday, October 22, 2020
Going back to the fence, which was one of the first, if not the first object that had UV distortion issues, and after a bit more reading and trial and error, I have come to 2 conclusions
- there's something about tiling UVs that fracturing does not like. This can be solved by manually applying the boolean modifiers; however
- doing so somehow affects the maximum # of fragments that the CombineInstance function can handle.
In addition to the UV errors in the corners of the window mesh, I am still experiencing this error.
Tuesday, October 20, 2020
Now working on the large window and despite the UVs all seeming to be in order, for some reason the cell fracture was still distorting the UVs at these corner points. I would suspect that it is likely this is due to those points being poles, but if so, why did this not happen before? ...regardless, setting the debug boolean, manually setting the auto smooth of each piece and then converting to a mesh appeared to solve the problem. Nevertheless, WTF. This process still seems to have some kinks I don't fully understand.