Adding a geometry shader into an existing shading model pipeline

Hello everyone,

I am trying to add a geometry shader to a custom shading model, but I am struggling a bit.
It does not seem like there are a lot of examples out there.

I am using UE 4.24.3 and added my custom shading model by following this tutorial https://medium.com/@lordned/ue4-rend…l-e2972b40d72d and adapting for 4.24.3.
At the bottom of the tutorial, it said that adding a geometry shader would come next, but it seems like it never did.

Any pointers to examples/tutorials would be much appreciated.

Cheers,
Sebastian

2 Likes

I have been looking into the same thing. I am trying to implement some molecular visualization techniques, and I need to write geometry and tessellation shaders to do it. I’m totally lost in the material system code, that I have no idea, if or how one might inject custom HLSL geometry shaders into the MSM_DefaultLit shading model.

@bavarianbasti Did you make any progress?

same boat.
the best docs I found are these. (Same as link above, but the second part.)

And it is definitely a time sink because you need to try and fail to get the proper understanding of it…

@bavarianbasti @timtimmy @MostHost_LA Do you guys have any progress regarding these problems? I appreciate your response, even a small detail is matters.

Not really.
For my purposes I have just been baking custom colors into vertex paint and using those.
It works well even if it’s painful to setup.
Instead of re-inventing the weel, at least it works with any engine…

I’ve done geo shader support for 4.16 back in the day. That is tremendous amount of work, barely justified by anything, and especially these days, when geo shader is pretty much a rudiment of the past. I suggest you to re-think your approach with geo shader, for in 2021 for whatever you might be using it for, better alternatives are available.

1 Like

But then how would you, for example, assign an index pointing to a texture array to a vertex, and then blend them based on some kind of a mask? Colors can achieve that, but they only allow 8bit indecies, which in my case is not enough.

Please excuse my ignorance, but how are they a rudiment (or perhaps remnant?) of the past? Isn’t dynamic tessellation achieved through geo? It’s love to know how to achieve dynamic mesh simplification (decimation) through geometry shades for animated skinned meshes. I cannot fathom how to do this otherwise.

Hello fellas,
I’ve been also looking into UE Geometry Shader for a few years to create an effect not possible in the material or HLSL. I too have read the Medium article by Matt Hoffman and hoped for his next article.
I’m not a graphics programmer and a beginner with C++, but I remembered bookmarking an article by YivanLee regarding Geometry Shader implementation, it’s in Chinese, but can be translated and I hope it’ll help anyone here.

3 Likes

Geometry shaders are pretty much depricated because they run slow on most hardware. As an alternative to generating geometry in the shader, consider creating a mesh with all the necessary geometry on the cpu. If you want to manipulate this mesh on the gpu, do it in a vertex shader. vertex animation textures are a good thing to look into. hope this helps!