Search Unity

Quad Tesselation?

Discussion in 'Shaders' started by JonathanPearl, Aug 12, 2017.

  1. JonathanPearl

    JonathanPearl

    Joined:
    Jan 25, 2015
    Posts:
    15
    Has anyone had any luck trying to get quad patch tessellation working in Unity? Triangle patch tessellation looks awful. Quad tessellation would make much better vertex distribution for things like heightmap tessellation but I can't seem to find a way to make quads when procedurally generating a mesh.

    Edit: I'm messing around with the hull shader trying to do silly things with triangles to "generate" a quad, but I can't even make a quad patch because I get the following errors:

    Code (csharp):
    1.  
    2. struct PatchTess {
    3.    float edges[4]        : SV_TessFactor;
    4.    float inside[2] : SV_InsideTessFactor;
    5. };
    6.  
    Is Unity artificially disabling quad patches?
     
    Last edited: Aug 12, 2017
  2. JonathanPearl

    JonathanPearl

    Joined:
    Jan 25, 2015
    Posts:
    15
    Is there anyone that could provide some insight to this? How feasible would it be to create the shader inside a native plugin using C++? I'm only targeting PC, so I could start by just including the DX11 shader compiler. I'm not sure how to transfer over Unity's notions of shader passes or the macros Unity uses for Texture2DArrays. Luckily, I'm not using surfaces shaders. I just want this tessellation to look nicer. I can't do this in the geometry shader as I need the 64x64 tessellation that the tess shader can do. (Geom can maybe do 4x4).

    In fact, I don't actually need quads in the mesh. I just need quad patch support. I can very easily pack the data for the 4th vertex inside the first three vertices (it's just position and uv, being a heightmap)
     
  3. Przemyslaw_Zaworski

    Przemyslaw_Zaworski

    Joined:
    Jun 9, 2017
    Posts:
    328
    customphase likes this.
  4. DogF

    DogF

    Joined:
    Dec 31, 2013
    Posts:
    29