Unity 5 and adding geometry trough Geometry Shaders

In older versions of Unity I remember Geometry Shaders weren’t a thing and I’d like to know if it’s already possible to add geometry with custom Unity 5 shaders.

I’m coming from a HLSL background were I could add geometry in geometry shaders using
TriangleStream::Append(…), is something like that possible in Unity too? (I have to add a lot of vertices each frame so I’d rather do it on the GPU than on the CPU)

Yeah, I just implemented this yesterday actually. Geometry shaders work just fine!

Any chance you have a custom geometry shader to share???

Cool! But I don’t suppose I could just paste in HLSL shader, you have any pointers to references or an example shader that creates new geometry?

I started from this;

Worked great.

I’m using it to implement this right now - Rendering field of grass...Grid Autosport tech - Unity Engine - Unity Discussions - as the fins that are expanded into geometry.

On the HLSL note, you actually can just paste in HLSL code generally. MSDN documents are just plain awful though. I’d have to look up how to do it for something besides a point input if you needed something besides that. If you have an HLSL background though, you might know more about it than I do. Unity works in HLSL and converts automatically to GLSL when necessary, unless you specifically design a GLSL program. For example: in some of my other shaders I use Sample and SampleLevel instead of the built in tex2D calls, to bypass the sampler limits and allow more than 16 textures in a single pass.

I don’t think everything is supported… but most things I’ve worked with are (at least with some fiddling).

i would really appreicate it if you were to share the shader, i nver even looked into how to make shaders, since its only recently became a problem when my freind (who does all the models) learnt some new tricks on blender, tricks i havent been able to do in Unity… and as close as i can get them well looks crap heres an example…

apperenly he just adds geometry something unity apperenly lacks

I think you might be misunderstanding the concepts? A geometry is a shader that dynamically generates new vertexes based on an algorithm. It’s all based on the use case. If you want just general case, more detail, then tessellation might be what you’re looking for.

Geometry shaders are very specific use-cases, though, it’s not something you just apply to a model and it looks better, for ex.

god knows, i dont have a clue about modeling, i just deal with scripts, i dont know the first thing about shaders, but cheers neway, time to look into tessellation then am guessing =)

Here, take a look at this!

Use those shaders on the models. Some just smooth, others require a heightmap. These are fairly simple versions of what you can do, but maybe it’ll get you started.