Ch11: Normals for the surface

Im trying to integrate the tessellation code into the game engine of Ch9. For the lights I need to compute the normal vectors, I found an article (Smooth normals and Tessellation - Graphics and GPU Programming -, which they are utilizing a domain shader in D3D. Is there another way in Metal?

Thanks in advance

1 Like

I haven’t done the math, but you should be able to do it in the vertex shader.

From the Apple docs on tessellation: “The Metal post-tessellation vertex function performs the equivalent computations of the DirectX 11 domain shader”.

If you come up with a solution, I’d be very interested to know.

Apples example project DynamicTerrainWithArgumentBuffers has an example of creating normals for tessellated terrain

Ah yes. Thank you. That’s a great sample