Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Terrain - Runtime Virtual Textures?

Discussion in 'General Graphics' started by SunnySunshine, Jul 26, 2021.

  1. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    988
    Unreal Engine has very handy system for sampling terrain textures in shaders to make objects blend with it:



    https://docs.unrealengine.com/4.26/en-US/RenderingAndGraphics/VirtualTexturing/Runtime/QuickStart/

    Essentially it consists of 4 parts:

    1. Creating the virtual texture assets you're intending to use.
    2. Setting up a volume that uses these textures.
    3. Setting up a landspace that uses these textures.
    4. Setting up a shader for the object to sample these textures.

    My question is - does Unity have anything like this to achieve the same effect?

    Thank you.

    All the best.
     
    Ruchir likes this.
  2. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,770
    Unity and UE are 2 totally different engines. If your plan is to have features of UE, in Unity, im afraid your only going to get so far. Your better off using UE, if you want those features...
     
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,374
    The Runtime Virtual Texturing itself is not a feature Unity has built in, but it is something others have added similar type features to Unity themselves. For example:
    https://github.com/ACskyline/PVTUT

    However, the method you're asking about isn't actually directly related to runtime virtual texturing. Blending meshes with terrain has been something you could do in Unreal long before RVT was implemented. And it's something you can add to Unity as well. For example the MicroSplat asset has a module that adds this functionality.
    https://assetstore.unity.com/packages/tools/terrain/microsplat-terrain-blending-97364

    Unity's HDRP can do something similar with the layered shader, but it requires a lot more manual setup.
     
    hadynlander and SunnySunshine like this.
  4. kite3h

    kite3h

    Joined:
    Aug 27, 2012
    Posts:
    197
    RVT is a VT that is aimed at being used in the compute shader.
    Unity does not provide such a separate solution because the use of the Compute shader is very simple unlike Unreal. Because you can make your own.

    The biggest difference between VT used in Shader and VT used in Compute Shader is the presence or absence of a prebake process to remove the seamline.
    For example, Unreal's RVT means that it is used for purposes such as making roads and terrain close together. What you've shown can't be viewed as RVT in a dispassionate way.
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,374
    wat?

    The use of RVT in games predates the wide availability of compute shaders. The first several implementations I'm aware of were fully capable of running on OpenGL 2.0 level hardware.

    The absence of prebaking is the only difference between virtual texturing and runtime virtual texturing. If there's support for render textures, you can do RVT.