Is it possible to define custom domain/hull shaders for surface shaders, the same way we can define custom vertex shaders?
Thanks!
Is it possible to define custom domain/hull shaders for surface shaders, the same way we can define custom vertex shaders?
Thanks!
When using default tessellation, the vertex function will be called from the domain shader, instead of from the vertex shader. This is also why that function doesn’t quite accept as many arguments as the normal vertex function.
Other than that, I think you’ll have to switch to classic shaders to take control over the the hull and domain shader while still having the vertex function called from the vertex shader. (#pragma vertex [name], #pragma hull [name], #pragma domain [name], etc)
So, with the default tessellation, the vertex function is actually the domain shader (takes place after the tessellator)? If yes, that’s good news because I only need to modify the tessellated vertices (my actual vertex shader would be pass-through).
Yep, pretty much.
To be more precise, the vertex function isn’t the domain shader, it’s just called from the domain shader. You can use #pragma debug to have the processed but uncompiled code show up in the compiled shader, to see exactly where it is called.
After your custom function is called, it does all the work it would usually do in the vertex shader.
That explains all the confusion I had with vertex function parameters when using the default tessellation. Thanks a lot RC!