Okay folks, after I’ve finally found the material you were talking about, I managed to take a closer look. I want to give some background information, but if your not interested in this, simply fast forward to “What to do”.
Cause of problem:
When you open the material M_OceanWater_1 (which is hopefully the one you are talking about!), you see a lot of layouts like this:
It begins with the absolut world position, but then only the x and y coordinates are passed through via the Mask(R G) node. Then these xy coordinates are used as UV coordinates for the textures, which means that the side vertices, which share xy coordinates and only differ in z, are treated equally. That’s why there are these vertical stripes and it seams that the texture is projected onto the cube perpendicular from above.
Idea for solution:
The idea is to use a different pair of coordinates (xz or yz) as UV coordinates, depending on the side. So a side facing in x direction would need the yz coordinates of its vertices to be used as UVs.
The simplest way that came into my mind is to simply rotate the sides so that they are facing upwards (mathematically speaking). Then the rest can remain the same. So you simply look at the world normal of the vertex and turn it around the object center in such way that it equals the world z vector after the rotation. And luckily there’s already a material function for this.
What to do:
There are four ‘Absolute World Position’ nodes in the material. You simply extend these in following way:
This will rotate the faces upwards (mathematically speaking) and it should give you a result like this:
The main problem is, that the edges don’t fit together due to the displacement. So if a ‘plain’ cube is sufficient for you, you can just unplug the ‘World Displacement’ pin and you remove these gaps and everything’s fine.
But I tried something else to keep the displacement but remove the unwanted gaps. Also, the standard displacement only takes place in world z direction, but I wanted it to work in every direction. So heres the standard node layout that we need to tackle:
The ‘Add’ node directly plugs into the ‘World Displacement’ pin so you should find it easily. Now we change this layout to this:
The idea is to create our custom displacement vector with a direction away from the object center (absolute position - object position). Then we take the z value from the standard displacement (since only this is set, as I’ve described before) and multiply it with the normalized direction vector. The right ‘Multiply’ node plugs into the ‘World Displacement’ pin.
Now the problem with that is that the heightmaps used for displacement don’t fit together. I couldn’t think of a way to do this, so I simply created a ‘RadialGradientExponential’ node and multiplied it with the last result before plugging it into the ‘World Displacement’ pin. This disables the displacement at the edges, since the gradient equals zero there (with default values, i.e. no values plugged in). Here is the result without (left) and with (right) the gradient and a ‘Displacement’ value of 5:
I hope this helped you a bit and I would be glad if someone knows and posts a way that keeps the displacement at the edges but also closes the gaps.