Shaders¶
Effects Shaders¶
Effects shaders use bitmap masks for Transparency
, parts of the mesh with assigned
mask are visible and some are not. This approach enables to have a lot of detail
with simple geometry and is often used in game development. It comes with disadvantages,
for example if you look at the geometry from a certain angle you can see the flatness. This can be
resolved by using Constraints
that copy the rotation of the camera.
Effects need volume for correct refraction
Refraction can be incorrect with effect shaders unless the effect has volume. This is not very
noticeable in most cases, that's why by default effects do not have volume - it is more demanding
on transparency samples. If you want to correct the refraction, add Solidify
modifier.
Cycles and transparency
By default Cycles render engine has maximum amount of Transparent Bounces
set to 8.
Meaning you can have up to 9 transparent polygons behind each other and still see through them.
However, if you exceed this limit remaining polygons will render black.
If you ever need to have multiple aquatiq
effects in a row, you may need to
increase the number of bounces in the Light Paths
settings.
Water Shaders¶
Multiple materials are using the same advanced NodeGroup "Waterial".
These are:
- aq_Water_Ocean
- aq_Water_Fountains
- aq_Water_Lake
- aq_Water_Pond
- aq_Water_Swimming-Pool
The NodeGroup will be redone in a future release of aquatiq.
Water material dilemma¶
Planet Earth's water is a very complex "material"
- It's fluid therefore animated,
- It refracts light like an animated lens would,
- It reflects light like an animated mirror would,
- On the ocean you also have the foam and waves on the shoreline,
- It has tiny particles / biomass inside so it needs proper volumetrics,
- It can also change itself like a transformer into vapor, fluid or ice,
- It also doesn't help much that everyone actually knows how it should look like.
The catch
Computing proper caustics through this animated refraction lens scenario in a raytracer like Cycles would be possible but is not implemented so far and would be performance intensive in any case. To "simulate" certain scenarios with water, you can skip the simulation part and just fake it. Optimizing the way how to deliver something similar is a good way to go but compromises have to be made.
How to animate water material?
Having 4 textures with moving UV mapping in different directions and then mixing them together correctly with MixRGB node creates an illusion of water-like movement if the geometry, volumetrics, textures, the animation speed and the mixing is correct.
To fake caustics you can use 4 textures moving in a different direction and mix them together to create a Transparent BSDF color input which says that the light that goes through the waves actually produces more light after coming through.
You also need to fake the large scale illusion where on some parts of water body the wind is stronger and somewhere else it's weaker which results in variable wave sizes. This is now being done with roughness but could be also done with scaling the mapping of the water textures on certain places depending on a mask texture.
And finally to create an ocean shore like shown in Ocean Beach scene, you need to "fake" the animated shoreline waves and to have some sort of a ground that the water is colliding with. Of course all of this means that the material has to be extremely complex and it can be hard to change something specific.
How to setup waterial
Proper geometry
a) Cube for water, make sure there is no space between the bottom of the water body and the ground on which it resides.
b) Plane for Shore + Seabed, can be the same object, doesn't have to be. Make sure it envelops the body of water otherwise light gets in the water from the side and can produce strange results.
Correct normals and mesh shading
All the normals should point outwards. You can select your mesh and press Ctrl+N. Often wrong normals happen when you add a Plane and then extrude it. The material is telling the light rays "you are leaving water territory" when the ray actually gets to the water and vice versa.
Applied scale
Make sure the scale is applied on the water object. Wrong scale can have an impact on many things, most often, parenting, modifiers.
Convert into Editable
Convert the material to Editable if you wish to change something in the Shader Editor.
Ocean Beach Scene¶
This is a scene that is using the waterial shader "aq_Water_Ocean" together with a couple more materials.