I’m using LWRP in my project and I would like to implement a flat shading for my graph shader using a geometry shader described in this tutorial. Is there a way to add a custom geometry shader to my graph shader or maybe a custom node that uses this geometry shader?
Nope. Shader Graph does not support geometry shaders, and is unlikely to add support for it due to some current (and likely more in the future) graphics APIs and hardware removing support for them. Also because Shader Graph is missing a ton of features still.
Also, there’s a specific sub forum for Shader Graph here:
However, you can still do flat shading using the derivative based method from that same tutorial.
Thank you for the graph example. It almost works.
Here is the shader applied to a mesh. It should have a solid color but it seems that still, some shading is applied as you can see on the grey road or the green ground a bit as well. Can something be done about that?
Here is another example:
This as well should be one solid colored face. Also, I can’t figure out why there are those shadow artifacts.
What do those surfaces look like with out this shader? The meshes still need somewhat proper normals otherwise you may get shadow artifacts from lack of proper normal biasing causing acne like you see in the second image, and potentially self shadowing, which might explain the first.
The meshes are generated from vertex and index arrays and have normals generated with mesh.RecalculareNormals
. Before upgrading to LWRP there were no artifacts like in the second image.
LWRP and the built in renderers work slightly differently in how they apply their shadow bias. The built in renderer was far more liberal with its application, where as the LWRP is a lot more conservative. This means smaller values in the built in renderers would eliminate shadow acne much more readily. Basically, increase your light’s bias settings by ~2x.
Unfortunately I don’t have any real explanation for the other artifact.
Can you please source this? I can’t seem to find any places where they are deprecating or removing support for Geometry Shaders.
Apple’s Metal API doesn’t support geometry shaders, and never will.
Oculus Quest also doesn’t support them with the custom OpenGLES extensions that hardware uses.
But they’re not removing support, just unsupported (as of yet). This is a large difference than removing. (as removing is hinting at deprecating)
As a counter point to the “yet”, Unreal Engine has never and will never support geometry shaders in their node based material system either. Do not ever expect this feature to show up in any official capacity for Shader Graph. They’re a difficult thing to add to node based editors anyway.
Metal not supporting them, even though the desktop hardware it runs on does, is no mistake. Apple mobile devices have never supported geometry shaders in any capacity (though, again, the last PowerVR based devices did support it in the hardware). Same with not supporting geometry shaders for Quest, the Mali GPU supports geometry shaders, but the VR rendering extensions were written explicitly without supporting them. They “work” but they only draw in one eye, and might not draw correctly.
Not here to argue :), I’m just educating other readers that come by thinking that Geometry Shaders might be deprecated or are being removed in general because of your statement.
Take care and have a good day.