0
\$\begingroup\$

I'm new to game development and I'm not sure what I've done wrong. My game runs at about 60 frames per second until I add one instance of a model I made in Blender. As soon as I add it the frame rate drops between 5-6fps and even the Unity UI seems sluggish.

I created the model using Blender v2.77a and it has 25,925 vertices, 22,919 faces and 49,224 triangles in 3 objects plus an armature, camera and hemi light source (6 objects total). Two of the objects contain very little. They were made just for me to attach a line renderer in Unity. The third object contains the entire model so there is only 1 UV map. I created about 5 materials, Baked them to an image (using the Blender Game engine), then deleted the materials and made a single material to apply the image. Then I exported an fbx file (mainly so I could adjust the axis to match unity) and imported that along with the texture image in to Unity.

For some reason two volumes in my model also render in Unity with the faces facing the camera invisible. If I move the camera those faces become visible and the others become invisible.

My PC is a few years old now so it's not the fastest. But I didn't expect it to struggle with one object. I'm running an Intel Core2 Quad Q9400 (2.67GHz), 8GB RAM and a single Radeon HD5770. The hard drive is a standard SATA 2 with 7.2k spindle and I'm using Win 10 x64.

If you need any more info, please let me know.

Edit: Here's a screenshot of the Profiler. enter image description here

\$\endgroup\$
  • \$\begingroup\$ Unity doesn't have a hemi light source natively - what has the one from blender been imported as? It's possible the importer approximates this as a collection of many smaller lights, tanking performance. It may also help to use the profiler to see whether that narrows down where the bulk of the frame time is going. \$\endgroup\$ – DMGregory Sep 11 '16 at 17:10
  • \$\begingroup\$ Thanks for your reply. I've added a screenshot of the profiler to my question. I'm not sure what the Hemi has imported as, it doesn't show as anything in the scene, just shows its axis. I've disabled it in the inspector and it hasn't made any difference, but not sure if that rules it out. EDIT: I deleted the Hemi and Camera in Blender and exported the fbx again, but it didn't make any difference. \$\endgroup\$ – Daniel Sep 11 '16 at 17:23
1
\$\begingroup\$

I solved the problem so thought I'd post it for anyone else who may encounter it.

The problem is that I had two objects which contained vertices and edges but no faces. The purpose of these objects was for me to attach a line renderer in Unity. I noticed in warnings Unity's console for each of these objects saying "Can't calculate tangents because mesh doesn't contain normals".

The solution was to simply create a face in each of the two objects. My frame rate is now back to 60fps.

As for my other problem where faces were invisible when facing the camera, I discovered that the normals were facing the wrong direction. This was making the faces visible from inside the volume instead of outside. To fix this problem I selected all my faces and pressed CTRL + N to make them face outwards (if you're trying to render from inside a volume E.g. using the inside of a cube for a room. You can do the same thing and tick the 'Inside' option in the tools pane).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.