Search Unity

Resolved DOTS and Rendering, Where To Render?

Discussion in 'DOTS Dev Blitz Day 2022 - Q&A' started by Kmsxkuse, Dec 8, 2022.

  1. Kmsxkuse

    Kmsxkuse

    Joined:
    Feb 15, 2019
    Posts:
    306
    As I'm using sprites and other 2D rendering systems, it seems moving forward I will need to develop my own solutions to rendering entities in a purely DOTS format.

    The question is, where do I actually schedule the GPU execution? There seems to me 4 ways currently:

    1. Direct Graphics static class calls. Primarily the Graphics.Draw and Render methods.
    2. Graphics.ExecuteCommandBufferAsync
    3. URP / HDRP Render Pass API.
    4. RenderPipelineManager Begin / End Camera/Context Rendering events.

    Which one should I be using?
     
  2. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    Wherever possible, I would recommend using the URP and HDRP APIs (e.g. URP ScriptableRenderPass), as those are likely to be the best way for the drawing to get scheduled at the desired time (e.g. opaque rendering pass). They also give you access to the ScriptableRendererContext, which makes it possible to utilize BatchRendererGroup if necessary.
     
    JohngUK and Kmsxkuse like this.
  3. Tony_Max

    Tony_Max

    Joined:
    Feb 7, 2017
    Posts:
    352
    Sorry for necro.

    I now use the first way with direct static class
    Graphics
    calls to perform instanced renderer. I call it in
    ISystem
    in
    PresentationSystemGroup
    .

    Me and some other devs which uses my package get very odd graphics artifacts which looks like rendered objects settings messed up. It sometimes happens for me when I open some windows in Unity Editor like Profiler. For other devs it happens constantly but only in Editor. VSync heal issue for particular devs. It also depends on count of rendered objects (entities). So I assume that it is something about where and when GPU execution happens.

    Can you please give more details of other 3 ways of GPU execution, how they differ between each other and how to actually use them?
     
    dannyalgorithmic likes this.