# Ocean Water for curved surfaces

**URL:** <https://discourse.threejs.org/t/ocean-water-for-curved-surfaces/42166>\
**Category:** Questions\
**Tags:** geometry, shaders\
**Created:** [September 2, 2022, 8:50pm UTC](https://discourse.threejs.org/t/ocean-water-for-curved-surfaces/42166 "2022-09-02T20:50:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Attila\_Schroeder](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/attila_schroeder/32/36097_2.png) [@Attila\_Schroeder](https://discourse.threejs.org/u/Attila_Schroeder)\
**Post date:** [September 2, 2022, 8:50pm UTC](https://discourse.threejs.org/t/ocean-water-for-curved-surfaces/42166/1 "2022-09-02T20:50:55Z")

</div>

I like the water shader from the three.js example

[https://threejs.org/examples/webgl\_shaders\_ocean.html](https://threejs.org/examples/webgl_shaders_ocean.html)

Unfortunately, I have found that the shader is unsuitable if you assign it a spherical geometry. the shader only seems to make sense if all normal vectors are the same. who knows a similar solution that also works for curved surfaces?

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [September 2, 2022, 11:44pm UTC](https://discourse.threejs.org/t/ocean-water-for-curved-surfaces/42166/2 "2022-09-02T23:44:33Z")

</div>

[Reflector](https://github.com/mrdoob/three.js/blob/92b99264e8692546badf8ee1ce945ef38db443f4/examples/jsm/objects/Reflector.js) and the shader in the ocean example both work only on flat surfaces (since they use just usual cameras for rendering the reflection, instead of rendering it to a cube map.)

It may be kinda simpler to just take the [dynamic reflections](https://threejs.org/examples/?q=dynamic#webgl_materials_cubemap_dynamic) example - and put one or two scrolling normal maps / displacement maps on the [sphere material](https://github.com/mrdoob/three.js/blob/68daccedef9c9c325cc5f4c929fcaf05229aa1b3/examples/webgl_materials_cubemap_dynamic.html#L91) there - as to simulate waves on the surface of the sphere.

---

<div class="post-metadata">

**Author:** ![Attila\_Schroeder](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/attila_schroeder/32/36097_2.png) [@Attila\_Schroeder](https://discourse.threejs.org/u/Attila_Schroeder)\
**Post date:** [September 3, 2022, 8:41am UTC](https://discourse.threejs.org/t/ocean-water-for-curved-surfaces/42166/3 "2022-09-03T08:41:07Z")

</div>

As i already thought, the water example only works with flat geometries. But your suggestion sounds good. I’ll take a look at that now
