Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implementation without vertex texture fetch #2

Open
slapin opened this issue Nov 16, 2020 · 5 comments
Open

implementation without vertex texture fetch #2

slapin opened this issue Nov 16, 2020 · 5 comments
Labels
question Further information is requested

Comments

@slapin
Copy link

slapin commented Nov 16, 2020

Hi,
lots of embedded/mobile GPUs can't do texture fetches in vertex shader,
what would be your suggestion to implement something similar which
would work on these GPUs? Thanks!

@CaptainProton42
Copy link
Owner

Hey,

I'm not very familiar with embedded/mobile systems so I can't really give you a qualified answer. I see that compute shaders are supported since OpenGL ES 3.1 but my guess is that they are not well supported on the systems you are talking about as well?

Sadly, I can't really think of another solution off the top of my head. There seem to be quite a few disussions on the internet about this problem in general, maybe you will find a workaround there. You could of course also just skip the vertex displacement entirely and write a pure fragment shader, from the right angle this might still look fine.

@slapin
Copy link
Author

slapin commented Nov 16, 2020

The most common version of OpenGL ES is 2.1 :(
I think it should be somehow done via fragment shader... or displacement should be provided by a set of vec4 to a vertex shader
which is still available...

@CaptainProton42
Copy link
Owner

Oh, okay. I was under the impression that >= OpenGL ES 3.1 might be more common due to this page: https://developer.android.com/about/dashboards But nevertheless, lower versions still make up a substantial margin.

I'm sorry that I can't give you a more specific answer. I'm afraid you will need to find some sort of workaround. Keep me posted if you do!

@slapin
Copy link
Author

slapin commented Nov 17, 2020 via email

@Firepal
Copy link

Firepal commented Jun 1, 2021

You can comment out the vertex shader from the Water mesh material and it just does the fragment-space normal displacement.

If you absolutely wanted truly-displaced water (which, let's face it, is asking a lot of an embedded device), you could theoretically go through the trouble of modifying the Water mesh's vertex data using the simulation texture data on the CPU, maybe using Godot's SurfaceTool. You check each vertex's color, and if it's red you use the simulation texture image data to raise or lower the vertices.

But of course, that's really inefficient, and is the very reason we have vertex shaders. So maybe try and aim for something that fits within the limitations of your target device, like the fragment-only simulation, or blending/alternating in time between two water normal maps. Real-time computer graphics is all about compromise :)

@CaptainProton42 CaptainProton42 added the question Further information is requested label Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants