FShade error: SourceVertexIndex not available

I included a shader to calculate per Vertex Normals based on the triangle. After adding it as Effect (toEffect Shaders.mkNormals), I get an error message after startup: "System.Exception: '[FShade] cannot add output "PhaseDistances" to GeometryShader since no SourceVertexIndex was available'"

  let mkNormals (tri : Triangle<Effects.Vertex>) =
    triangle {
      let a = tri.P1.wp.XYZ - tri.P0.wp.XYZ
      let b = tri.P2.wp.XYZ - tri.P0.wp.XYZ
      let n = V3d.Cross(a,b)
      yield {tri.P0 with n = n}
      yield {tri.P1 with n = n}
      yield {tri.P2 with n = n}
Posted 1 months ago
Votes Newest


The Problem was, that our falsecolorshader uses a different type of Vertex (with other Information than Aardvark.Base.Rendering.Effects.Vertex). Therefore information was missing - in this case the SourceVertexIndex. Using the same Vertex type solved the problem.

Posted 1 months ago
Alternatively, add the SourceVertexIndex to your custom Vertex type - mixing and matching vertex types is OK as long as the inputs and outputs fit together Attila Szabo   1 months ago Report
1 Answers
1 months ago
1 days ago