I used a detail thing to get grass, and its lagging a lot, when i rmeove the grass i have 100+ fps, but with i have 30. How can i reduce the lag?
I used a detail thing to get grass, and its lagging a lot, when i rmeove the grass i have 100+ fps, but with i have 30. How can i reduce the lag?
here are the images i dont know why they doesnt load: Imgur: The magic of the Internet
@TheGlitchedPanda
In your second screenshot, it says that it’s rendering 2.9 million vertices. With the right settings you’ll be able to reduce that to below 1 million.
Could you take a screenshot of your Terrain Settings? It’s the last tab on the right in the Terrain component. Here’s what mine looks like:
There’s a lot of settings that affect how many grass details are rendered. I have “Detail Scatter Mode” set to “Instance Count Mode” because it allows me to change the grass density in-game using the “Detail Density Scale”. It gets rounded to the nearest 0.0001, so I use values of 0.0002 - 0.0005. Lower values have less dense grass and draw fewer polygons.
You can also improve performance by reducing the number of draw calls. If you press the button to the right of the “Play Focused” drop down during Play Mode, it will bring up the frame debugger. Make sure the Game view is selected instead of the Scene view. It will show you how many draw calls are used to render the grass.
Increase the “Detail Resolution Per Patch” and “Detail Resolution” settings to reduce the number of batches. “Detail Resolution” can actually go up to around 4000 but this gives you less control with the “Detail Density Scale” since that value gets rounded.
Detail patches currently allocated: 256
Detail instance density: 67108864
Even though my “Detail instance density” is high, the terrain settings limit how many of them are actually rendered.
Under the Paint Details tab, if you select one of your details and select Edit, you should see a tick box called “Affected by Density Scale”. It should be enabled so that the “Detail Density Scale” will control how many details are rendered.
What i see is a large patch of grass (placed with terrain tools), a terrain and 2 prototype meshes. Its what i see in editor view (to begin with) is your using 2 cameras. Why?.
Terrain Settings are also wrong, and with that small scale scene, you shouldnt be having any performance problems:
Auto Connect: are you planning to have more than 1 terrain? if not shut it off.
Draw Instanced: should be turned on.
Base Map Distance: way to high. drop to 200.
Cast Shadows: change to On, not 2 sided.
–Tree/Detail–
Reflection Probes: unless your planning on using them, shut it off.
Bake Light Probes For Trees: once again, shut off if not using.
–Mesh Resolution–
Detail Resolution Per Patch: too low should be 64-128.
Detail Resolution: 512 aint bad, could bump to 1024.
–Holes Setting–
Again, if not using shut off.
The rest is good, but you also need to check and set “Quality Settings” under Project Settings, for your target platform. Last thing is the actual grass. The type of grass you use can make a major difference, and at what density its placed at. Seeing how the grass is the biggest thing in the scene (as well as using 2 cameras, and wrong settings), the grass is your culprit, and the high vertices count sort of gives it away, lol.
Good luck bro, keep working!
thanks! still 30fps, but thanks anyway
@warthos3399 These are really good suggestions. I’d like to know if enabling Draw Instanced still offers better performance if you’re only using one terrain tile.
Just try to get it to draw less grass details by changing the settings under “Tree & Detail Objects” and “Mesh Resolution (On Terrain Data)”, as well as each of your grass details’ settings.
Also, from your screenshots it looks like your resolution is around 2560x1440. This can be pretty demanding on some graphics cards. In the Game view, select the third dropdown labelled “Free Aspect” and enable “Low Resolution Aspect Ratios”. This will render the game at 1/4 resolution when in Play Mode, although I don’t think it affects the Scene View. You may want to look into offering a resolution scale option in the game so it’s not always rendering at full resolution.
Try disabling Ray Tracing Support, since you probably want to get the game running nicely before experimenting with that. Maybe lower the Terrain Height as well since it’s unlikely you need the terrain to be 600 units tall when the x and z axes are only 200 units long.