cancel
Showing results for 
Search instead for 
Did you mean: 

GO Geometry shader substitue [unity]

sweetclimusic
Honored Guest
I have a gemotry shader for PC build. where the uses input draws a new alpha texture and the geometry shader manipulates the mesh vertex based on the alpha texture. What shader level does the GO support.  What techniques do I need to research for vertex manipulation for oculus go?  so things I want to achieve is splitting procedual meshes that are randomly generated at run time.  right now I'm siding with the solution to pregrenrate 3-4 types of a assets including the splits of the those meshes, randomly choose one at spawning point and hope no one notices.
8 REPLIES 8

Slin
Expert Protege
I believe the go supports pretty much everything, but of course that doesn't mean you should actually do it, at least not a lot. Also it looks like OpenGL ES 3.1 does not include geometry shaders, so if you are targeting that or an earlier API with Unity, geometry shaders are not available to you.
I am not sure I understand your description correctly. Geometry shaders usually generate new data on the gpu, what you are describing sounds like something a base mesh with enough vertices and a vertex shader doing the manipulation would be good enough for. If you need more, you might be able to use tesselation for whatever it is you are doing, which has been introduced with OpenGL ES 3.1 (no idea what Unity uses...).

Some screenshots would likely help to describe what you are trying to do better and then me or others can maybe give you some ideas on how to do it.

panayot_cankov
Protege
I am using geometry shaders on Oculus GO, I just need to throw huge amount of points and curves on the GPU and have it rendered so I made a geom shader that will draw polygons for points and will split lines onto camera facing triangle strips that form Bezier curves.

It works well without antialiasing but with 2x antialiasing it just disappears and the framerate dies.
So Unity shader lab geometry shaders work on Oculus GO to some extent.

StephenLongNSC
Honored Guest
@"panayot.cankov" I can not seem to get the "Shader is not supported on this GPU" error to disappear for my geometry shader. Could you please give me some advice as to how to get past this? I keep getting conflicting information about OpenGL ES 3.1 supporting geometry shaders. 

panayot_cankov
Protege
@StephenLongNSC In the app that I have geom shader working, I explicitly turned off any MSAA and omitted the shader language level declaration from the shader code. The Unity docs say when they locate geom shader declaration they will bump the shader version but Unity does not complain about the incompatibility. I couldn't get it working with MSAA through, when I set it to 2 or more I get black screens or random drawings when the geom shader is used in the scene. In the end I compensated some of the jitter with eyeTextureResolutionScale.

nat42
Explorer
"right now I'm siding with the solution to pregrenrate 3-4 types of a
assets including the splits of the those meshes, randomly choose one at
spawning point and hope no one notices."

If that is even remotely an option, then why not consider generating the mesh once procedurally (or when the texture changes) on the CPU. It doesn't sound like using transform feedback is something you are doing with the geomtry shaders, and it thus sounds like you are doing work every frame to recompute something that isn't changing.

Also pretty sure GLES 3.1 doesn't support geometry shaders, and GLES 3.2 added them. Suspect the Go likely supports both. I think Unity 2019 may be adding ES 3.2 support?
EDIT: possibly you are using a 3.2 feature from a 3.1 OpenGL ES context, and that's why it's a bit quirky. Possibly undefined driver behaviour, kind of works because the hardware supports the feature even if the context is the wrong version for it to be exposed?

panayot_cankov
Protege
@nat42 I think Unity supports OpenGL ES 3.2: https://docs.unity3d.com/Manual/OpenGLCoreDetails.html
The #pragma target are a bit weird: https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html
I was building the app for rift, and didn't have much time to dig the behavior on GO. Maybe a combination of #pragma target 3.5 and #pragma require geometry will make a difference. #pragma target 4.0 is not supported on GO but it uses OpenGL ES 3.5 if I understand it correctly while the geometry requires 3.2. Any idea how to debug what's happening on the GO hardware, like figure out what OpenGL ES versions is the context and if I can get errors log from the rendering there?

nat42
Explorer


@nat42 I think Unity supports OpenGL ES 3.2: https://docs.unity3d.com/Manual/OpenGLCoreDetails.html
...but it uses OpenGL ES 3.5

I think you might be confusing desktop OpenGL versions with mobile OpenGL "ES" versions (they aren't directly comparable eg. in some ways GLES 2.0 is like GL 3.1). The linked page starts by declaring "OpenGL Core is a back-end capable of supporting the latest OpenGL features on Windows, MacOS X and Linux" (desktop OSes)

There is no such thing as "OpenGL ES  3.5", 3.2 is the latest specification.

The Unity 2019 Alpha release notes state: "Android: Added OpenGL ES 3.2 support".

And I suspect you've noted that 2018 and earlier versions refer to Vulkan, GLES 3.1 and GLES 2.0 in their API selection for Andorid builds.



The #pragma target are a bit weird: https://docs.unity3d.com/Manual/SL-ShaderCompileTargets.html


That's a Unity quirk, it transpiles the shaders from a variant of HLSL to the language expected by the API so you can target multiple shader languages and graphics APIs with common shader code. Note that there is no mention of ES 3.2 there (yet...) and it suggests equivalence between "#pragma target 4.5" (desktop OpenGL versioning) with "#pragma target es3.1" (mobile ES versioning)



Any idea how to debug what's happening on the GO hardware, like figure out what OpenGL ES versions is the context and if I can get errors log from the rendering there?

I just joined, I'm pretty new to Oculus development so too early for me to give Oculus specific debugging advice sorry, but as far as the above goes, I'd stay away from geometry shaders on GLES 3.1 / Unity 2018.3 or earlier, even if you kind of / sort of have them sometimes working. Perhaps trying the 2019 alpha if you can chance Unity 2019 releasing and being stable before you will finish your project, or as I said if the geometry only needs to change infrequently maybe try it on the CPU, perhaps in a thread.

panayot_cankov
Protege
For the things I do, geometry shaders are quite convenient. I hope they'll get support on Oculus GO and Quest with Unity. Otherwise I will have to explode geometry on the CPU and do fancy encoding in the uv channels to get the same effects that are possible with geometry shaders.