Hello,
I am trying to build a house using Unity3d. I have imported the house successfully form Maya with all the textures.
However, when i run the game, the maximum fps i could reach is 25 fps. Is this normal ? even though i have no lights in the scene ? I need to add that the house has like 7 rooms, all are textured with Diffuse or bump diffuse, but the first person controller exists in 1 room at a time so why do i get only 25 fps as frame rate ?
On another Note, this is a snapshot of the kitchen where i am far from the water dispenser, the frame rate is 22 fps. However, when i get close to it, the frame rate becomes very low (3 fps). I can’t understand why at all.
There is only 1 light in that scene, with no shadows at all, and all the shaders are diffuse.
Does anyone have any idea why this might be happening ?
Thank you for the support as i am really confused regarding the above matters
A few suggestions: bring up the Stats window in the Editor so you can see how much you’re really rendering, use Occlusion Culling otherwise everything within the camera view frustum is rendered even if isn’t really visible, and adjust your Quality settings (e.g. the frame rate on my machine doubles if I turn off antialiasing)
Hi
thank you for yhe answer. I will do a research since i noticed that all the scene is being rendered even though a small part is visible.
Btw, i figured out why getting closer to the dispenser is decreasing the frame rate. It is because the default collider from the fbx importer is mesh collider and it id added to all meshes. I removed the unneccesssry ones and replaced the mesh with a box colkider which solved the issue.
So what is remaining is to figure out how to increase the framerate by rendering only what is neccessary from the scene
Hi
I know, and i am trying to find a way to minimize that, just not lucky yet.
I have added the occlusion area, and selected the Occluders and Occludees. The editor simulation is working fine, However, i don’t have any improvement in frame rate.
Also that i disabled Antialiasing, but i am still on the same frame rate
Yes,
I turned it off and i gained an additional 2 fps.
I am sure that the other rooms are being renedered/calculated even though they are hidden.
I have put light in a distant room, and this room is under an occlusion area…The frame rate dropped even though i am not in that room.
During the setup of the occlusion area, i have chosen the walls are the occluders, and the other inside objects as the ocludee, and then baked.
Is there anything else that needs to be done ?
You may get an improvment if you modify your mesh to support batching. In your second photo, of around 6k draw calls only about 100 were batched. There is a significant time lapse in each section of mesh that is sent to the processor. Therefor, simply batch your meshes, there are plenty of instructions, just ask Google.
And, like the guy below me just pointed out, you have a ridiculous 4,500,000 triangles. For one house. Might want to go into Maya and fix that…
Ok,
I will see if i can reduce the triangle numbers
One question though, are All those triangle drawn and rendered even though they are not shown on the screen ?
Ok I need to add this.
I have removed all meshes from a distant room that was invisible by camera and the frame rate improved extremely (minimizing Triangles).
I than added a reflective shader to another element in another distant room which hit the frame rate.
There is something i am missing: Isn’t the objects rendered as soon as they enter the Far Clipping planes of the camera ? If so, why the above case is occurring even though i am sure that the distant images are further that the camera’s Far clipping plane property ?
Oh Wait, The reflective shader is using renderCubemap script to generate the cubemap.
(But i chose One Face per frame to speed up the calculation process)
The reflection requires the scene to be rendered from that vantage point so from the location of the mirror the scene is being rendered whether or not it is within the main camera’s view frustum.
The script used to control the camera rendering the texture for the mirror reflection needs to be de-activated. Occlusion culling only turns mesh renderers on/off. It does not deactivate scripts attached to game objects that contain mesh renderers.
The script you’re using for the mirror reflection may or may not be checking for an active mesh renderer component before rendering the render texture.
Also, I’m pretty sure you haven’t baked the occlusion culling solution properly yet. If you had then you would not have had to delete objects in other rooms and decrease your main camera’s far clip plane.
The high number of Triangle and vertices is not because of this room, it is because of the whole scene.
It seems Unity is drawing all the house not only the part visible to the camera.
I am using low poly meshes, however there are alot of curtains and curved objects causing a high number of triangles.
I have set all my objects to static, which slightly improved the performance.
I expected Unity to render only the visible part and the rest will progress as the player moves. However, all the scene is being rendered.
I am starting to test the Occlusion culling feature. I have added an Empty game object to each room to which i have attached an occlusion area. Afterwards, i have chosen the walls as the occluders and the rest of each room as the occludee. Then i baked.
Is there anything i am missing or anything else i need to do in order to use the occlusion culling successfully ?
This is simply how 3d rendering works and is not unique to Unity.
To simply things just create one occlusion area that encompasses the entire level (generally wherever the camera will go). Also to simplify just mark everything as static… don’t worry about differentiating between occluder/occludee. Make sure the cell size is small enough so that several cells are in each room. Bake that and then use the visualizer in the scene view to see if objects are properly being occluded.