Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Topic: Optimisation research #52

Open
EloiStree opened this issue Jun 1, 2020 · 21 comments
Open

Topic: Optimisation research #52

EloiStree opened this issue Jun 1, 2020 · 21 comments

Comments

@EloiStree
Copy link
Owner

Ok plan to make a recap on the performance you need to keep in mind for your game for artist mainly and a bit for developer.

So... Here is a post about what i found on the web on the subject.

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 1, 2020

@EloiStree
Copy link
Owner Author

Remind me of tips I used

  • GPU Instancing from Blender for ship
  • Compute Shader for Kinect Juggling sphere
  • Compute Shader for ship trajectories

@EloiStree
Copy link
Owner Author

Reminder: ms milliseconds

60 fps = 60 frame/seconds
120 fps = 8.3 ms
70 fps = 14.3 ms
60 fps =16 ms
55 fps = 18 ms
45 fps =22.2 ms

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 1, 2020

Can we use Post-Processing in VR ?

Pro

  • Would be cool
  • Good lighting
  • Why would we want a ugly game when we want virtual immersion ?

Against

  • It kills your GPU
    • Because of double camera, it double kills GPU
      • Because you like light, shadow & transparent, it triple kills the GPU
  • When in 2018 Gear VR + Cardbaord game was at 1 000 000 devices, the VR on computer industry was about 250 000 if I remember well. And now, Oculus is back with the Oculus Quest. AR start to be back for the years in coming 2021-2023. XR happens mainly on device with low graphic card without ventilation and no overclocking power.
  • Any cost in on the CPU & the GPU is a cost in electricity. And every cost on electricity lead to more heat to deal with and less batteries for the player.
  • VR Sickness have high chance to be present on game under 60-70 FPS. Do you want to sacrifice 1-8 ms of your 14 ms available for good shaders ?

The question you need to ask yourself...

You don't need good tools to draw good art. You need good artists that can use the constraint of the tools and the environment he owns. So is Post-processing is essential to your game ?

  • Yes, then use it. But know the costs.
  • No, then try to avoid them. Be creative on the style of your game.

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 1, 2020

GPU & CPU ? What the difference ?

CPU will do one task at a time on what we call a thread.
GPU will do the a computable task to a large prepared group of data in the graphic card.
Youtube Video

What a Shader ?

The basic

Shader

Eyes Porn Shader

image

Compute shader

Youtube Video
Youtube Video
Youtube Video

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 1, 2020

Previous Unity workshop on the subject Link

AAA for VR

Youtube Amsterdam AAA VR
Full list of the photo here

Gear VR Performance

When I was working with Gear VR, I had a project to check the boundary of it.
The Galaxy Note 4 had in Unity 5 a bit bottle neck at 200 drawcall that I don't always find in following phone

Topic Limit State of phone
Drawcall <100 You are good but remeber that you have two camera so 50 max
Drawcall >100 The Gear VR start to have performance issue
Drawcall >160 You are definitely not in the > 60 FPS anymore
Trianble <50.000 You are good to go
Trianble <100.000 You start to play with fire
Trianble >100.000 Depending of your project you start to have problem
Trianble >250.000 You won't have your 60 FPS anymore

Max triangle 65.000

In unity object can only make 65.000 triangles max object.
Meaning that you will have for a house of 200.000 triangles.

  • Four drawcalls
    • Eight if you are in VR
      • 16 if you use two materials on the object
        • can have 32 if you use real-time lighting / shadow on it
          • ...

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 1, 2020

Unity Profiler

Manuel

Demo of how to read information:
Youtube Video

Full conference on the subject:
Youtube Video

Wi-Fi Unity Profiler

You can profile in development build if you check it/

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 1, 2020

Unity Conference on Optimisation

2016

For Mobile

Youtube Video

Content (Advance/Prog)

Youtube Video](https://youtu.be/n-oZa4Fb12U?t=94)

2017

for Beginner

Youtube Video

High Performance C# Script with Job System (Advance / Prog)

Youtube Video

Glossary

  • Call render pixed to the screen is call a frame
  • Frame rate = how many frames by time
  • Speed is not the most important, consistency is !
  • Bottleneck (GPU or CPU Bound)

@EloiStree
Copy link
Owner Author

Tmp List: to watch when I have time

@EloiStree
Copy link
Owner Author

Decimation

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 1, 2020

Vertex Color

Default Alt
Youtube Search: Vertex Coloring

You can use Vertex Colored asset to optimized some part of your game

Occlusion Culling

Default Alt
https://youtu.be/OmuQmydipGg

LOD: Level of detail

Default Alt
https://youtu.be/ifNyVS2_6f8

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 1, 2020

Mesh Baking & Atlas

Mesh Baking

Using Mesh Baker

MeshBaking
Using Mesh Baker in Unity

Do it by script yourself

Youtube Video

Atlas

Sprite example:

Atlas Atlas
Image Image

|

In Blender

Img
The tutorial: https://www.creativeshrimp.com/game-level-texturing-texture-atlas-part-35.html

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 1, 2020

Blogs found

Old but gold

  • Tips & Trick for Gear VR Optimization
  • VR Best Practice
    • Minimize (or eliminate) the use of post-process effects
    • Keep geometry as simple as possible
    • Minimize draw calls
    • Avoid using Standard Shader or other computation-heavy shaders
    • Use Physics wisely as it is very computation-heavy. If possible, replace Physics colliders with distance-checking logic.
    • Thermal Throttling: heat lead to hardware performance lowering
    • Render Scale: Change the resolution per eyes
    • Some Shaders are not design for VR
    • Standard shader are usually not design for mobile and performance in mind.
    • Use the Anti-aliasing given by the SDK of the headset builder if possible else MSAA
    • Check the Lighting Strategy Guide
  • Lighting Strategy Full guide of how to use light to have beautiful scene (not optimized)
  • Drawcall batching tutorial

Code

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 1, 2020

Play with Quality Parameters

Video about the Quality Settings
Youtube Video

@EloiStree
Copy link
Owner Author

Indian accent

You know ^^... Those video you don't want to hear but they rocked the subject.

Optimisatoin (Complete course, 48 min)

Youtube Video

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 1, 2020

GPU Instancing

Youtube Video

One Mesh Pool (My old alternative , time consuming)

Youtube Video
Sketchab - Unity Code Demo

  1. Create a Blender with all the objects in row.
  2. Link bones to each objects
  3. Export in Unity
  4. Use a pooling system to access the bone representation to move.
  5. Create script to access them and move them with the empty object linked to them

Pro:

  • Reduce to one drawcall by 65.000 Vertex
  • Performance don't vary anymore

Against:

  • You can't cull them
  • You lose some performance on the pool management.

Pro:

  • A game with 5.000 asteroids moving with 1000 bullets at the same time was running on a Gear VR with 60+ FPS when I tried this strategy for the first time.

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 1, 2020

Only video on the Quest

Unity 2018 Conf

Youtube Video

Must watch video 😁

Default Alt
https://youtu.be/w0n4fuC4fNU

  1. Don't make realistic game
  2. Don't use post-processing
  3. Adjust Project setting
  4. Turn GPU instancing on materials
  5. Combine your meshs (easy combine & Mesh Gamer)
  6. Use Google Seurat
  7. Amplify Impostors
  8. Use Static lighting & Baking
  9. Occlusion Culling
  10. Remove Detail When needed
  11. Use More Effective Coroutine
    More

Did not watch yet

@EloiStree
Copy link
Owner Author

EloiStree commented Jun 3, 2020

Baking Light

(Missing post about it, don't like light ;) )

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant