# Any example or tips to render sea surface(shader+FFT)?

**URL:** https://discourse.vtk.org/t/any-example-or-tips-to-render-sea-surface-shader-fft/7432
**Category:** Support
**Created:** [December 19, 2021, 11:03am UTC](https://discourse.vtk.org/t/any-example-or-tips-to-render-sea-surface-shader-fft/7432 "2021-12-19T11:03:12Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![AlexLuya](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alexluya/32/4036_2.png) [@AlexLuya](https://discourse.vtk.org/u/AlexLuya)
#### Post date: [December 19, 2021, 11:03am UTC](https://discourse.vtk.org/t/any-example-or-tips-to-render-sea-surface-shader-fft/7432/1 "2021-12-19T11:03:12Z")

</div>

Any example or tips to do it?  
If can’t be done with VTK,any opengl integration mechanism suggestion is appreciated also.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 20, 2021, 2:31pm UTC](https://discourse.vtk.org/t/any-example-or-tips-to-render-sea-surface-shader-fft/7432/2 "2021-12-20T14:31:37Z")

</div>

Hi, Alex,

Can you give us a visual example of what you want to achieve? “Sea surface” can mean a lot of things in terms of computer graphics depending on your goal. For me, who makes petroleum reservoir models, the sea surface is just a flat plane painted in translucent blue. For a 3D artist making the next Pixar movie, it is a whole different game and so on.

regards,

Paulo

---

<div class="post-metadata">

### Author: ![AlexLuya](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alexluya/32/4036_2.png) [@AlexLuya](https://discourse.vtk.org/u/AlexLuya)
#### Post date: [December 21, 2021, 2:03pm UTC](https://discourse.vtk.org/t/any-example-or-tips-to-render-sea-surface-shader-fft/7432/3 "2021-12-21T14:03:28Z")

</div>

Thanks,something like this,[Shader - Shadertoy BETA](https://www.shadertoy.com/view/Ms2SD1), generated by FFT

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 21, 2021, 7:02pm UTC](https://discourse.vtk.org/t/any-example-or-tips-to-render-sea-surface-shader-fft/7432/4 "2021-12-21T19:02:32Z")

</div>

That example was made via shader. In VTK you can set shaders via one of the `vtkMapper` classes.

Please, take a look at this example: [https://gitlab.kitware.com/vtk/vtk/blob/v7.0.0.rc2/Rendering/OpenGL2/Testing/Cxx/TestUserShader2.cxx](https://gitlab.kitware.com/vtk/vtk/blob/v7.0.0.rc2/Rendering/OpenGL2/Testing/Cxx/TestUserShader2.cxx) .

I hope this helps getting you started.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [December 27, 2021, 9:13am UTC](https://discourse.vtk.org/t/any-example-or-tips-to-render-sea-surface-shader-fft/7432/5 "2021-12-27T09:13:17Z")

</div>

See this:  
[https://discourse.paraview.org/t/visualizations-of-water/4183/18](https://discourse.paraview.org/t/visualizations-of-water/4183/18)

and this:  
[https://www.kitware.com/screen-space-fluid-rendering-vtk/](https://www.kitware.com/screen-space-fluid-rendering-vtk/)

FYI @Timothee_Chabat

---

<div class="post-metadata">

### Author: ![Timothee\_Chabat](https://discourse.vtk.org/user_avatar/discourse.vtk.org/timothee_chabat/32/3234_2.png) [@Timothee\_Chabat](https://discourse.vtk.org/u/Timothee_Chabat)
#### Post date: [December 27, 2021, 9:30am UTC](https://discourse.vtk.org/t/any-example-or-tips-to-render-sea-surface-shader-fft/7432/6 "2021-12-27T09:30:18Z")

</div>

VTK is primarily designed to render actual data (ie geometry or volumes described in a finite way) so doing sphere/ray tracing like stuff you can find on shadertoy is a bit hard. So really depends of what you want :

- If you want a scene rendered using sphere tracing for a fully procedural scene then a trick I can think of is to render a quad geometry taking the whole camera frustum and then assigning it a custom shader like @Paulo_Carvalho suggested
- If you just want to render some sea surface with actual wavelet geometry then you can create a plane geometry, subdividing it, warp it along a scalar field that you created and that is the result of your fractal noise and use the visualizations trick that @mwestphal mentioned

I don’t have any example to link but VTK is just not really designed for doing the kind of rendering you’re thinking of imo.
