For a current project I am doing, I would need a way to render an ocean from low to high altitudes. Therefore, I would like to contribute to Blender by creating a node that could be use in Cycle (and maybe EEVEE) Materials. This node would simulate the ocean, and output three things: the actual displacement vector, the normals, and a roughness value, (maybe an anisotropic value as well). Those three values would then be use depending on the distance of the pixel to render.
Would this kind of contribution be accepted in the main branch of blender?
As this would be my first time working with the blender code, I do not really know what are the steps to add a new node. I saw that there are several files to create, or add to, in order to have a new node. Is there a “receipe” to know exactly what I need to add?
If this would be accepted depends a bit. We don’t have very specific texture types built in, but rather try to provide the basic building blocks. Part of the reason for this is that these things affect GPU kernel performance, and also because once you get into quite specific things it can be better to use and share node groups instead.
We don’t have documentation on how to add a shader node, but you can look at similar commits that did this in the past.
I’d suggest to prototype this first with an OSL shader, or shader node group.
Thank you for the answer.
I’ll try do prototype something over the next few days.
So I’ve made a quick prototype in OSL. There are still a few things that I need to figure out, but the main displacement feature is done enough to have a small demo.
Here is a first demo of an ocean of 3x3 km, flying from 2000m to 2m of altitude: https://www.youtube.com/watch?v=7iaFYoK3bfM
What do you guys think?
edit: the YouTube compression is quite bad, so here is better quality version:
It looks a bit repetitive and lacks realism. I’ve tried to simulate it with procedural bump maps. My best result so far is here.
I also have a blend file available in that same thread.