Hi, I followed this tutorial for an awesome looking low-poly water for a simple looking Android 3D game.

Unfortunately the code needs GLES3 partial derivative functions like dFdX() and dFdy(), which crashes when deployed on my Oneplu5 (Android 7.1.1).

Only GLES2 runs on my device, which means, no access to partial derivatives...

It seems OpenGL2 can run extensions including the one containing dFdx() and dFdy().

I see people using this define to enable the extension

```
#define GL_OES_standard_derivatives 1
```

Is there any way to either

- Use those extensions in Godot shading language

- I tried using uniform, no success

Calculate dFdx() and dFdy() in software (even if it's inefficient)

I came across a formula that goes like :

`dFdx(p(x,y)=p(x+1,y)-p(x,y)`

But it is 2D and I don't really know which how if what p() mathematical function we're talking about

Get the Vertex Normal in another way ?

I have a lot of C++ experience but not in OpenGL and not in Godot shading

Wow, thanks for answering that fast !

I guess, modifying the cpp file would mean re-compiling Godot right ? If so, I'll just try to calculate them as you said.

I'm not sure how to access the VERTEX neighbors though. I see in this tutorial that it's done through a heightmap with the following :

I don't have a height map, so I replaced "height" by "apply_distorsion":

I'm not sure if that was what you meant when you said -x and -z neighbor

Then I tried different ways of calculating the NORMAL, but I must admit I'm shooting in the dark here :

A)

B)

It runs, but it's giving me the wrong results. I'm sure there is something simple I'm not getting.

## EDIT :

I've been at it the whole night after work and I can't seem to come close to what the derivatives do. I would eally appreciate some help.

Here's the shader code, it's applied to a PlaneMesh subdivided 10x10y of size 10x10

I pretty muched tried to interchange everything with everything :

vX<-->vY<-->vZ<-->(VERTEX-vX)[...] with division by pt_size or not etc...

edited Feb 25 by julliansana