Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Blendshapes, URP, and KTX/glTF

Discussion in 'Graphics Dev Blitz Day 2023 - Q&A' started by smash-ter, May 24, 2023.

  1. smash-ter

    smash-ter

    Joined:
    Sep 6, 2020
    Posts:
    22
    This is more or so general questions I want to ask in regards to the future of Unity in terms of improving optimization and uniformity beyond 2023. To those of you that are well versed in Unity, allow me to apologize in advance if I sound a bit uninformed, I just want to have some clarifications.

    1. Currently, blendshapes take up a lot of space in VRAM. It's 40 bytes per moving vertex per blendshape. This does not seem a lot, but that can quickly add up the more verticies and blendshapes your model may have. And while 2021 fixed a few bugs with regards to blendshape calculation and reduced the load on the GPU, the amount of memory blendshapes take up is still high. Are there any plans to reduce how much memory blendshapes take up?
    2. Since the Unite conference a few months ago the Unity dev team has mentioned that they plan on trying to get the pipelines to be on feature parody in the foreseeable future, especially in regards to URP and the built in pipeline. My current concern is with this information that it is likely that built in will get deprecated in a few years. Since feature parody between built in and URP is considered a top priority would that include adding backwards compatibility with built in's shader features, including a pipeline that can translate cg files to hlsl without having to manually update older projects to support URP?
    3. Is there any possible chances that we can have ktx2 and glTF files natively supported in the Unity engine without having to manually import KtxUnity, glTFast, and other packages that help with import? Because as much as these programs exist, it would simplify the process to be able to do all of this without having to import these packages, and possibly any performance gains that could be had with using ktx2 textures.
     
    GDevTeam, mandisaw and Lars-Steenhoff like this.
  2. mandisaw

    mandisaw

    Joined:
    Jan 4, 2018
    Posts:
    80
    Just a tip - may want to split these into 3 separate posts, since they're unrelated questions. No guarantee that the same person would be able to answer all of them.
     
  3. Jebtor

    Jebtor

    Unity Technologies

    Joined:
    Apr 18, 2018
    Posts:
    113
    Hi, thanks for raising the memory footprint as a concern. We do not have any immediate plans to make improvements to this right now. It would be interesting to investigate as reducing the footprint could be beneficial for performance too. Please submit a new idea on our roadmap here if you would like to raise the priority.

    I have reached out to some colleagues about your other questions.
     
    smash-ter and mandisaw like this.
  4. smash-ter

    smash-ter

    Joined:
    Sep 6, 2020
    Posts:
    22
    It seems like what I've raised in regards to blendshapes has been brought up in the roadmap, but nothing is mentioned on improving the memory footprint. I've gave it feedback so I'll see where it goes from there.

    As for my other two questions, the second question is more for platforms that have user generated content so that when built in becomes deprecated in favor of URP, all the content can still work even though the shaders date back to Unity 5/2017. This I feel is what holds URP back from being adopted more compared to using Built in.

    For the ktx/gltf stuff, I'll submit the idea on the roadmap as there are a lot of benefits to using ktx2/basis, especially for UASTC/ETC1S as having a smaller memory footprint means everything for both PCVR and standalone VR development.
     
    tteneder likes this.
  5. tteneder

    tteneder

    Unity Technologies

    Joined:
    Feb 22, 2011
    Posts:
    174
    1. We're working on bringing said packages into UPM, so the hassle of running an install script or adding a scoped registry won't be required anymore. Would that resolve your concerns about project setup?
    2. Regarding potential performance gains: The C# job system, the Burst compiler and support for native C/C++ plugins allows us to make surprisingly fast software without the need to integrate it into the core engine. I only identified two bottlenecks in the Unity API thus far:
      1. Texture to GPU upload (for both PNG/Jpeg and KTX 2.0) can block the main thread unnecessarily. This is a problem that can be solved with a native plugin though. There is a working prototype that needs to be finished. I'm also in contact with third parties that solved this.
      2. glTF's mesh(primitive) buffer layouts are more flexible than Unity's C# Mesh API. Therefore it can happen that for certain models glTFast creates copies of vertex buffers that you wouldn't need if you'd have direct access to low-level GPU buffers. In practice I stumbled over such a model once (1!) in 5 years. All popular glTF generators I'm aware of don't create such glTF buffer layouts.
        glTFast will warn you about such files and there are plenty of tools to optimize them.
    That being said, if you feel like I missed something, go ahead and share. Always happy for input and feedback.
     
    smash-ter likes this.
  6. ali_mohebali

    ali_mohebali

    Administrator

    Joined:
    Apr 8, 2020
    Posts:
    119
    We have looked at this and investigated this in the past. Unfortunately, this is not something we are planning to solve. It's not just about the shader language and syntax; there are significant differences in the pipelines and shader functionality that, combined with custom user logic, make it difficult to have an upgrade path.
     
    mandisaw and smash-ter like this.
  7. smash-ter

    smash-ter

    Joined:
    Sep 6, 2020
    Posts:
    22
    If this could be integrated at the minimum for 2021 LTS and 2022 LTS that would be well appreciated. Would the packages be in the default packages? And for KtxUnity would it be possible to have it match some of the features from png imports like disabling transparency for the alpha channel (for texture channel packing) and height to normal map?
    I did not know that was a thing. Glad to see that a fix is being worked on
     
    tteneder likes this.
  8. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    867
    Wouldn't it be better to consider USD since that's seeing more universal support lately?
     
  9. tteneder

    tteneder

    Unity Technologies

    Joined:
    Feb 22, 2011
    Posts:
    174
    Confirmed it will!

    What's your use-case there? KTX is typically used for runtime loading, but your description implies you want to use it in authoring workflows, as a PNG replacement?
     
  10. smash-ter

    smash-ter

    Joined:
    Sep 6, 2020
    Posts:
    22
    As of right now, this is a correct assumption. So far it does compress better on disk without the runtime scripts for the time being, hence I was hoping that it could be natively integrated without the need to have those scripts used.
     
  11. tteneder

    tteneder

    Unity Technologies

    Joined:
    Feb 22, 2011
    Posts:
    174
    Understood. Keep in mind that the size advantage comes at the cost of compression artifacts (whereas PNG is lossless).