dFdx and dFdy not found in WebGL2 context

This is really a confusing issue, the functions are avialable in WebGL1 with the derivatives extension, but are built-in in WebGL2. According to this example, it also works perfectly fine.

The shader code is set for 3.0 (#version 300 es) and i’ve been using several features of WebGL2 without issues already. The functions though cannot be found and trying to use the extension obviously fails since it isn’t available.

Does anyone know why it possibly can’t find these functions? I can’t see anything else than hinting to 3.0 according to the example link above.

This seems related: https://forum.playcanvas.com/t/accessing-un-interpolated-face-normals/3548

I’ve copied the code of the linked example to this fiddle: http://jsfiddle.net/f2Lommf5/10412/

It works on my machine. What are you doing different? Please share your code as a live example.

There is basically nothing different, except that THREE might interfere somewhere, it’s only the THREE core testing with a phong material and a normal map (which enables the normal mapping function using these). Since the function isn’t found this is rather strange, the linked thread experiences a similar issue it seems.

If no one knows about this issue or internals that might interfer i’ll setup a fiddle as soon as i’ve got time. According to the shader code there is no difference, the only thing relevant seems the version hint.