Skip to main content
Spelling, missing words, bored so editing...
Source Link
3Dave
  • 3.1k
  • 1
  • 23
  • 37

Just to expand on the other answers a bit:

Unity and Unreal both use separate threads for update (typically called the "game thread") & render, specifically to keep them from slowing each other down. You'll typically see the game rendering lagging a frame behind update / physics because of this.

In Unity, graphics operations are internally queued up in a device & API-agnostic queue in the main thread, and then dispatched by the render thread. The CPU overhead for that is minimal. This also allows the render thread to fast-forward through the queue if the render thread gets too far behind. Nothing new here, but synchronization can be challenging. Typically, the time to populate the queue is minimal, and takes far less than actually dispatching to the GPU.

This two-thread arrangement is very common. But, things are changing.

In Unity's the new(ish) jobJob system, candidate operations can be automatically vectorized to take advantage of all available CPU cores. This typically means SIMD-style vectorization of identical operations on different GameObjects & components.

I'm not sure of the current state of Epic's threading model, but, last I checked, this wasis a competitive advantage of Unity.

Implementing this in your own engine is not impossible, nor even extremely difficult. Keeping your thread sync points to a minimum, use of lightweight synchronization primitives and data structures and a very detailed sequence diagram will help.

If using multiple render threads, be aware that only the explicit APIs support actually rendering in that fashion, and it can actually be slower in some circumstances. My preferred approach is that used by Unity: threads populate a priority queue, while a dedicated thread actually dispatches the commands to the GPU driver. Keeping things in the proper order can be an issue, but is a solvable problem.

Just to expand on the other answers a bit:

Unity and Unreal both use separate threads for update (typically called the "game thread") & render, specifically to keep them from slowing each other down. You'll typically see the game rendering lagging a frame behind update / physics because of this.

In Unity, graphics operations are internally queued up in a device & API-agnostic queue in the main thread, and then dispatched by the render thread. The CPU overhead for that is minimal. This also allows the render thread to fast-forward through the queue if the render thread gets too far behind. Nothing new here, but synchronization can be challenging. Typically, the time to populate the queue is minimal, and takes far less than actually dispatching to the GPU.

This two-thread arrangement is very common. But, things are changing.

In Unity's the new(ish) job system, candidate operations can be automatically vectorized to take advantage of all available CPU cores. This typically means SIMD-style vectorization of identical operations on different GameObjects & components.

I'm not sure of the state of Epic's threading model, but last I checked this was a competitive advantage of Unity.

Implementing this in your own engine is not impossible, nor even extremely difficult. Keeping your thread sync points to a minimum, use of lightweight synchronization primitives and data structures and a very detailed sequence diagram will help.

If using multiple render threads, be aware that only the explicit APIs support actually rendering in that fashion, and it can actually be slower in some circumstances. My preferred approach is that used by Unity: threads populate a priority queue, while a dedicated thread actually dispatches the commands to the GPU driver. Keeping things in the proper order can be an issue, but is a solvable problem.

Just to expand on the other answers a bit:

Unity and Unreal both use separate threads for update (typically called the "game thread") & render, specifically to keep them from slowing each other down. You'll typically see the game rendering lagging a frame behind update / physics because of this.

In Unity, graphics operations are internally queued up in a device & API-agnostic queue in the main thread, and then dispatched by the render thread. The CPU overhead for that is minimal. This also allows the render thread to fast-forward through the queue if the render thread gets too far behind. Nothing new here, but synchronization can be challenging. Typically, the time to populate the queue is minimal, and takes far less than actually dispatching to the GPU.

This two-thread arrangement is very common. But, things are changing.

In Unity's Job system, candidate operations can be automatically vectorized to take advantage of all available CPU cores. This typically means SIMD-style vectorization on different GameObjects & components.

I'm not sure of the current state of Epic's threading model but, last I checked, this is a competitive advantage of Unity.

Implementing this in your own engine is not impossible, nor even extremely difficult. Keeping your thread sync points to a minimum, use of lightweight synchronization primitives and data structures and a very detailed sequence diagram will help.

If using multiple render threads, be aware that only the explicit APIs support actually rendering in that fashion, and it can actually be slower in some circumstances. My preferred approach is that used by Unity: threads populate a priority queue, while a dedicated thread actually dispatches the commands to the GPU driver. Keeping things in the proper order can be an issue, but is a solvable problem.

Source Link
3Dave
  • 3.1k
  • 1
  • 23
  • 37

Just to expand on the other answers a bit:

Unity and Unreal both use separate threads for update (typically called the "game thread") & render, specifically to keep them from slowing each other down. You'll typically see the game rendering lagging a frame behind update / physics because of this.

In Unity, graphics operations are internally queued up in a device & API-agnostic queue in the main thread, and then dispatched by the render thread. The CPU overhead for that is minimal. This also allows the render thread to fast-forward through the queue if the render thread gets too far behind. Nothing new here, but synchronization can be challenging. Typically, the time to populate the queue is minimal, and takes far less than actually dispatching to the GPU.

This two-thread arrangement is very common. But, things are changing.

In Unity's the new(ish) job system, candidate operations can be automatically vectorized to take advantage of all available CPU cores. This typically means SIMD-style vectorization of identical operations on different GameObjects & components.

I'm not sure of the state of Epic's threading model, but last I checked this was a competitive advantage of Unity.

Implementing this in your own engine is not impossible, nor even extremely difficult. Keeping your thread sync points to a minimum, use of lightweight synchronization primitives and data structures and a very detailed sequence diagram will help.

If using multiple render threads, be aware that only the explicit APIs support actually rendering in that fashion, and it can actually be slower in some circumstances. My preferred approach is that used by Unity: threads populate a priority queue, while a dedicated thread actually dispatches the commands to the GPU driver. Keeping things in the proper order can be an issue, but is a solvable problem.