Original Post
Afternoon all, I've been playing around with the new D3D11 tesselation features (Hull and Domain shaders - journal rambling here and here). Unfortunately the details on these features are a little limited, even if you're lucky enough to have the speclets that the docs are based on [headshake]. Currently I'm not getting errors but I'm also not getting anything rendered. I suspect my interpretation of some parts is wrong and was hoping someone here could clarify [smile] Barycentric Coordinates Choice details: Three control point vertices A 3D vector (uvw) SV_DomainLocation Patch constants (currently unused) Basically it's the middle part thats got me. As I understand it the barycentric coords are ratios of the 3 control points - and the tesselator (between the HS and DS) generates a number of new vertices defined in terms of a barycentric coordinate that the DS receives. Taking that further, I have three world space vertices and a 3D barycentric coordinate. I need to generate a new world space vertex from this information. From wikipedia and mathworld it seems that I can just use the 3D vector as a weighting of the 3 vertices. However all examples I've found deal with a float/2D triangle (ok, so all triangles are coplanar by definition) and 2D barycentric coordinates. This is what I've used before. Consequently I suspect my code is fundamentally wrong: If I'm generating rubbish vertex coordinates then it would explain why I get no errors but also see no output. Can anyone clarify whether my approach is correct or if its flawed? I'm a bit rustier with maths than I'd like [sad] Cheers, Jack
Quote:
For a tri patch, use a float3 (for barycentric coordinates)
Quote:Assuming my basic implementation is correct my domain shader has:
The tessellator generates a couple of things: (1) A set of domain points - UV for isoLine or quad domains and UVW (barycentric) for a tri domain. Each of these domain points is input to its own Domain Shader invocation. Each Domain Shader invocation also all sees shared input of all the Hull Shader output data.
float3 finalVertexCoord = float4( 0.0f, 0.0f, 0.0f, 0.0f );
finalVertexCoord += patch[0].position.xyz * uvw.x;
finalVertexCoord += patch[1].position.xyz * uvw.y;
finalVertexCoord += patch[2].position.xyz * uvw.z;