Search Unity

What does the "BEZIERPOS" semantic mean in Hull Shaders?

Discussion in 'Shaders' started by CHPedersen, Oct 7, 2014.

  1. CHPedersen

    CHPedersen

    Joined:
    Mar 2, 2011
    Posts:
    63
    Hi all,

    I'm trying to understand tesselation these days and studying various bits of documentation I can find online, though I think in general, the documentation level for this shader system is a little sparse. In Microsoft's article on How to Design a Hull Shader, they use a semantic called BEZIERPOS without specifying exactly what that means.

    This lack of documentation is also mentioned in this blog post, but one of the replies links to this page at MSDN, and claims in his post that it includes full documentation for all SM5 features. I disagree with that, I cannot find information on semantics on that site. So I'm kind of back to square one. ;) Can anyone help me? What exactly does that semantic do?

    Note: I'm familiar with Bezier mathematics for curves and patches, so my best guess is it probably tells the tesselator to interpret an (x,y,z) position as a bezier control point, I just wanna be perfectly sure I understand it. :)

    Thanks!
     
  2. CHPedersen

    CHPedersen

    Joined:
    Mar 2, 2011
    Posts:
    63
    Oh, I feel I should mention this article, just in case others come by this post and feel as lost as I have about these features:

    http://webserver2.tecgraf.puc-rio.br/~abraposo/pubs/SBGames2010/SBGames2010_Tutorial.pdf

    That one is probably the best in-depth tutorial for SM5 tesselation novices out there. It's the only one I've seen so far that takes the time to explain fully what most of the parameters do and how the shader stages work together.
     
    jlegrice likes this.
  3. jlegrice

    jlegrice

    Joined:
    Nov 21, 2012
    Posts:
    6
    Thanks so much for posting this. It is easily one of the best articles I have ever read on graphics programming (if not THE best). Super super helpful, thank you again!
     
  4. megagerm

    megagerm

    Joined:
    Sep 2, 2017
    Posts:
    1
    Well that sure got me confused as well.

    It means nothing, at least to DirectX:
    Variables passed from one shader to another have to have semantics.

    https://msdn.microsoft.com/EN-US/library/windows/desktop/bb509647(v=vs.85).aspx

    "Semantics are required on all variables passed between shader stages"

    Because that variable is returned by the hull shader, and passed to the domain shader, it needs a semantic.

    If you remove it, you get an error:
    "SimpleBezier11.hlsl(114,18): error X3503: 'BezierHS': function return value missing semantics"

    But if you rename it anything else, such as

    struct HS_OUTPUT
    {
    float3 vPosition : toto;
    };

    then it works beautifully.