How To Render 2 Million Objects At 120 FPS

How To Render 2 Million Objects At 120 FPS

Tarodev

1 год назад

137,911 Просмотров

Project files: https://github.com/Matthew-J-Spencer/pushing-unity

Let's discover the true potential of Unity by pushing its limits. In this video, we'll explore a variety of techniques, from straightforward tweaks like data-oriented design, to more advanced methods such as direct GPU rendering and compute shaders. Join us as we uncover the power and flexibility that Unity has to offer!

Some techniques used:
Unity DOTS (burst, jobs, ecs)
RenderMeshInstanced
DrawMeshInstancedIndirect
Data-Oriented Design
Avoiding extern calls


❤️ Become a Tarobro on Patreon: https://www.patreon.com/tarodev

=========

🔔 SUBSCRIBE: https://bit.ly/3eqG1Z6
🗨️ DISCORD: https://discord.gg/tarodev
✅ MORE TUTORIALS: https://www.youtube.com/tarodev

Тэги:

#RenderMeshInstanced #DrawMeshInstanced #DrawMeshInstancedIndirect #RenderMeshIndirect #unity_dots #ecs #burst #job_system #gpu_instancing #compute_shader #unity_shader #data-oriented_design #benchmarking #millions_of_objects #framerate #performance
Ссылки и html тэги не поддерживаются


Комментарии:

Tarodev
Tarodev - 26.03.2023 16:09

Let me know if you'd like to see anything else benched, or whatever else you'd like me to cover :)

My specs:

Ryzen 9 5950X 16-core
GeForce RTX 3090
64GB Memory

Ответить
Fury Project
Fury Project - 13.11.2023 20:38

Is it unity? That’s looks insane that I don't believe at all. I think there must be a lot of downsides, also all of those objects are just images of one object. If you make all those objects different...

Ответить
LordBailey
LordBailey - 09.11.2023 13:33

Very cool my friend.

Ответить
Simon Codrington
Simon Codrington - 06.11.2023 08:31

This one was fascinating mate, really liked the visually focused explanations, showcasing the tangible FPS improvement along the way.

Ответить
3D Mage
3D Mage - 03.11.2023 18:27

On a blank scene on Unity 2023, I only get 40 - 60 FPS.

My computer has like 32 GB of RAM, a GTX 1080 and four cores using Intel i5 processors. How do you get insanely high framerates to begin with?

Ответить
TheInvertedDonkey
TheInvertedDonkey - 01.11.2023 22:20

So I got the GPU Instancing stuff working, but was wondering if there was a way to change the material of a single index of the matrices. Right now I have 3 Matrices overlapped with 1 unique material each. Whichever material I want showing at a specific index, I throw the other 2 matrices positions at that index off screen (say new Vector3(-10000f, -10000f, -10000f)). But this seems really inefficient. I'm basically trying to do an RTS grid system. Undiscovered tiles are black, tiles currently in-sight are lighter material, and tiles discovered, but not currently in vision are slightly darker material. None of the tiles move, so I really just need them for visual representation which this GPU Instancing seems to be really efficient at, but I can't figure how to just use one matrix and change the material at a given index.

Ответить
Glorious 11
Glorious 11 - 30.10.2023 14:30

is this similiar to vfx graph?

Ответить
Connor Smiley
Connor Smiley - 28.10.2023 01:46

Basically an entire intermediate computer graphics course in 10 minutes. Bravo!

Ответить
flanker
flanker - 25.10.2023 23:31

Amazing stuff. I'd bet anything a lot of triple A devs would get to about 4 on your list and call it good enough. On that note, you should give Colossal Order a hand to fix the mess that is Cities Skylines II.

Ответить
Quick Learner5G
Quick Learner5G - 25.10.2023 15:16

unreal engine: "just enable nanite"
although it cant quite reach 120 fps in every situation

Ответить
James Clark
James Clark - 19.10.2023 14:41

Fun video to watch. I was a bit surprised to see that people are still debating the whole 'Camera.main' thing though. It's pretty well known by now that it uses FindObject internally. There are like, two or three videos where Unity's own optimization specialist contractor went over this stuff and explained it and this one topic specifically was one of his dramatic jokes during the presentations.

Ответить
M Karam
M Karam - 17.10.2023 20:08

How come you’re not making Udemy courses! I’d buy all of them!

Ответить
PeregrineVroom
PeregrineVroom - 17.10.2023 04:12

bro i cantr even get 40 fps on just runnoig woindows

Ответить
FriedCrumpets
FriedCrumpets - 16.10.2023 13:03

Thank you :) This was a really useful video. I've been trying to dive into DOTS for a while after reading Data Oriented Design by Richard Fabian. The Dots documentation doesn't seem all that clear to me and I've been unable to locate resources that are massively up to date that explain it clearly. Can you advise anywhere I can find a fantastic up to date video or Documentation?

Ответить
SCM Soccer Club Manager
SCM Soccer Club Manager - 15.10.2023 17:46

you are a wizard Matthew

Ответить
fbi agent miyako hoshino
fbi agent miyako hoshino - 14.10.2023 22:55

fix the number formatting in title, it had me so confused on what it meant

Ответить
Alex Denford
Alex Denford - 10.10.2023 00:09

Incredible video, well done!

Ответить
M
M - 07.10.2023 04:49

terrific video! subbed

Ответить
GiMiat
GiMiat - 06.10.2023 00:33

can you use gpu instancing indirect in URP/HDRP?

Ответить
Space Viking
Space Viking - 28.09.2023 00:23

This is massive, I'm making a satellite tracker that I've been trying to optimize forever and this is what I've been looking for, thank you.

Ответить
EvansdiAl
EvansdiAl - 27.09.2023 18:43

Is there a way to see a tutorial for this? Im so noob I have no clue what Im doing. I basically want to turn 5k 2D sprites into this..

Ответить
James
James - 24.09.2023 15:29

pointless video now lol

Ответить
levayv
levayv - 21.09.2023 01:25

Rider yells at me too bro :)

Ответить
GameDev Chris
GameDev Chris - 17.09.2023 00:30

-> 13,086,178 Objects At 120 FPS <- So how ? xD

Ответить
Typhereus
Typhereus - 16.09.2023 07:33

This is mind blowing.

Ответить
Yurii Lunha
Yurii Lunha - 15.09.2023 08:02

Amazing!! Thank you!

Ответить
bone circuit
bone circuit - 15.09.2023 06:49

great content! thanks mate

Ответить
Fatih Turker
Fatih Turker - 08.09.2023 15:19

Finally you have hat made of hair😅

Ответить
weckar
weckar - 07.09.2023 01:21

I'm confused. Your title says 13m at 120FPS, but your example only goes up to 2.7m at 20fps?

Ответить
Apickle
Apickle - 06.09.2023 03:44

Lmao the clash of clans font

Ответить
enitalp
enitalp - 05.09.2023 15:40

Very nice video, this is the way I always work, Test everything , learn the best practices, from actual experimentation. I’m caching everything, coded for years on mobile/ switch, and those caches have an impact on a 10 to 20 times, slower Cpu. Input. For exemple is costly, more on some hardware. Plus it’s not just the call of an external function, taking time, it’s also the need for the cpu to trash the data and code cache. Making the functions coming after slower, because of it

Ответить
Tiêu Phong
Tiêu Phong - 04.09.2023 04:37

"I have a question; I'm working on an MMORPG game. Should I switch from GameObjects to ECS? If I go with GameObjects + Burst + Jobs, is it feasible for handling a game with potentially thousands of concurrent players?"

Ответить
Evgenii S
Evgenii S - 26.08.2023 21:54

I am building my first physics based platformer and am getting into collision detection issues. I thought "well, that's all I can push unity to so I have to limit my game design. Doesn't feel too good, but I guess limits are limits and I have to accept them." But from now on I guess I don't have to worry anymore that my character will miss anything (collisions). This tutorial was godlike to me. Thank you so much!

Ответить
Dimo Petkov
Dimo Petkov - 15.08.2023 00:23

This video is pure gold 🥇, thank you❕

Ответить
Fearofthemonster
Fearofthemonster - 14.08.2023 22:38

I am drawing my trees using render mesh instanced but they have no shadows. How can I fix it?

Ответить
AJ213
AJ213 - 13.08.2023 21:52

I use Graphics Draw Mesh Indirect for a voxel game like minecraft for the tile entities so I can get good FPS with many tile entities. The only thing is, I have not gotten into animating these meshes yet or doing anything special like that.

Ответить
Flynn Mc
Flynn Mc - 09.08.2023 04:54

Insanely helpful to see these steps broken down like this, thanks for the video :)

Ответить
Electrotuts
Electrotuts - 08.08.2023 20:36

Nice, but I don't see the point in the video where you achieve 13 million objects at 120FPS

Ответить
Paul Ward
Paul Ward - 08.08.2023 08:58

I can't mentally get my head around how unity dots works. I really hope we get some really good resources on how to use this system ASAP because I could benefit from that knowledge hugely

Ответить
Makra
Makra - 07.08.2023 22:09

Hope my potato renders 120 slices per second!

Ответить
Shibe
Shibe - 05.08.2023 21:31

Another benefit to rendering everything on the GPU is that I can then use it to cook my dinner when rendering the scene

Ответить
Paul MEYNCKENS
Paul MEYNCKENS - 02.08.2023 12:54

Waouh! What an amazing and instucting video ! Thank you so much.

Ответить
Dair
Dair - 27.07.2023 21:41

Will you possibly make more tutorials on ecs?

Ответить
jae jay
jae jay - 26.07.2023 14:16

Excellent as always. Would using the C# AsParallel make any difference?

Ответить
elsporko321
elsporko321 - 18.07.2023 19:17

Quick question..what are some examples of best use cases for this?

Is it pretty much only in scenes where you have many of the same object doing the exact same thing and performance is limiting design? Say you want 1,000 dumb zombie AI in a bullet hell game, but you can only reasonably get 200 on screen at a time with reasonable FPS.

I guess I struggle with the design part..where does it make sense to consider this method vs. doing it the "less than ideal but it works and is good enough" way?

I'm curious where someone who really knows their stuff (not me) and has all these tools in their toolbox available to them considers this.

Thanks for the video! Very cool stuff.

Ответить
Eduard
Eduard - 18.07.2023 14:56

Very good tutorial thanks, but unfortunately in mobile devices multithreading frameworks from unity doesn't give good fps boost ( maybe 5-7fps, I find solution in render scale, and URP - SRP rendering, which was huge boost, ability to render 400k triangles at 60fps in 2gb RAM mobile

Ответить
Ahmad Moussa
Ahmad Moussa - 17.07.2023 06:27

Epic video nothing more to say

Ответить