The Ocean and Easily Animated Foam
First off, I'm not the one that came up with this method, and unfortunately, I don't recall who did, as that information is lost in the pit of the Old Forums. If you posted about this in the past, then please step up and take a well deserved bow!
To create animated foam on the Ocean Primitive, you can use some basic shader functions in a creative way.
Here's a link to a zip file that includes the shader .cbr file, and a scene file where it is applied to an ocean in a replicator.
https://dl.dropboxusercontent.com/u/7370483/Water_scene_and_shader.zip
This is a medium scaled scene, so units of measure are based on that. Also, this is meant as a suggested method, not a definitive way to create foam. Scenes vary so this just outlines the steps I took and why.
The first thing I did was to load an Ocean primitive and change the size to 100 ft. I think you will find this looks better later on, when the ocean is replicated. For now, I would leave the wave height alone, unless you wish to increase it. A lower height wave may make it harder to find the right settings for the shader that will be created or modified.
The next step is to create the shader. You can modify the existing shader or create a new master shader. Personally, I found it easier to create a new master, and then work my way down, beginning at the Color channel.
In the Color channel, I added a color gradient and set the right side to white, and the left to a blue color. The white end of the gradient will be the foam. To drive the gradient, I chose to use Snow under Terrain Distribution. I then tweaked the coverage and noise, and lowered the noise scale to .02 ft. I then selected the Altitude tab and adjusted the settings, keeping an eye on preview window. Depending on the desired effect, the parameters will vary.
Next, I copied the snow distribution shader from the Color channel and pasted it in the bump channel.
I then added a color gradient in the Reflection channel, The gradient used black to the right, and white to the left. The reason for the black on the right, is because the foam isn't really reflective, and black doesn't reflect. To drive the gradient, I placed a Mixer, and in the top slot of the mixer, I left it empty, which for all intents and purposes is treated like pure black- meaning no reflections. I copied the snow shader from the color channel and pasted it into the second slot of the mixer. Remember, the gradient is reversed from the color channel with white (100% reflective) being the main body of the ocean, and the "foam" snow being black and not reflective. I placed a 1-100 value slider in the Mixer slot and adjusted the slider until I had the desired amount of reflection.
The Transparency channel also uses the reversed color gradient, but instead of pure white on the left, I placed a grey color. To drive the gradient, I again copied the Snow distribution shader from the Color channel and pasted it into the grey/black color gradient in the Transparency channel. The idea being that black is opaque, and by comparison, the foam is fairly opaque. The grey color on the other side of the gradient means the main body of water is not totally transparent. The grey color also means that it doesn't add unwanted color to the water.
I did use Absorption and In-scattering. Check the settings out to see how it works.
Comments
More shader nonsense. ;-)
To set up the ocean, I mentioned above that I changed it to 100 ft. The reason being is that I wanted to place it in a replicator, and the more area the ocean had, the less obvious it was being tiled.
So, at the top of the Menu Bar I chose Insert--> Replicator. I then selected the Replicator in the Instances Palette and clicked the wrench icon at the top right of the screen to open the Replicator editor. The first thing I did was to change the grid size in the X and Y coordinates to match the size of the ocean. After that, I enabled the Seamlessly checkbox in the lower left corner of the editor. In my scene, I left the replications at the defaults, but you can enter whatever value you want.
Now, the really cool thing about the oceans (and also terrains generated with the terrain editor), and why I enable the Seamlessly option, is that they tile seamlessly, which is pretty cool when you consider that the ocean primitive is animated.
Remember that the foam is animated by the changing height of the waves due to the elevation parameters of the Snow Distribution shader. The higher the wave goes, the more "foam" or snow it gets. As the wave lowers, the foam disappears.
I haven't yet had the chance to go through all your description, but the result looks great!
Really splendid, thousand thanks Kevin !
I made screenshots of all this thread to follow your explanations on my work computer.
I'm also interested to use this method to create lava (slow motion).
I believe that I will remake my sequence on the ocean with this.
Many thanks again !
PS: could I post the link on this thread on Carrarators ?
Wow, that looks surprisingly nice...
Especially for distance shots.
Or, for semi-realistic animations, just like I'm doing...;-)
Awesome. thanks e.p.
Thanks. Looks great in high resolution too.
Is it OK to make an article at CarraraCafe and post the scene/shader there as well?
Wow! I'm giving you eleven out of ten for this ! ;)
You are very welcome to post it over there!
BTW, I owe Joe a big thanks for setting me on the right path as to how color works in the Absorption sub-channel under Transparency a few weeks back in the Post Your Renders thread.
Alright, here is the tutorial at CarraraCafe:
http://carraracafe.com/tutorials/tutorial-ocean-with-easily-animated-foam/
A separate download is created at:
http://carraracafe.com/downloads/?did=42
Is it OK to mark the download as Public Domain or do you want any other license?
http://creativecommons.org/publicdomain/mark/1.0/
Public domain is fine by me. I didn't come up with the method, so I don't think I should take credit for it. I certainly don't mind being credited for the tutorial though. ;-)
3drendero, since I don't have the authorization of EP to publish the link of this thread on Carrarators, do you accept that I place the link to CarraraCafé ? ;-)
EP, excellent !
I composited a render of your scene with my images (with a masking of blue colors), and I arrive at very good results.
Very cool!
I tried lowering the wave height from 2' to .5' and I had less foam, but on the down cycle of the wave it didn't disappear as dramatically, which I think helped with the realism. I was going to post an animation, but there was something else I was trying that didn't work out as well, because I forgot to change a setting. I'm trying again to see if I have success.
Well, poop! I just crashed Carrara trying to get all fancy trying to make a boat float by using a hidden, non replicated ocean and a surface replicator.
Very cool, ep! Thanks a bunch!
EP,
Perhaps Sparrowhawkes pin modifier would "float your boat" :cheese:
EP,
Perhaps Sparrowhawkes pin modifier would "float your boat" :cheese:...and/or BrianOrca's fine Ocean plugin!
This should aso work with a plane using animated displacement
and EP bullet physics works with displacement in 3D view!!
And for that matter the ocean primitive.
You can use a cube and parent your boat to it after hiding the cube.
Very simple method of getting a boat to bob on the waves - replicate the boat and hide the original.
Just don't animate it - gets pretty violent :)
https://www.youtube.com/watch?v=lbyQ22kpliw
Very simple method of getting a boat to bob on the waves - replicate the boat and hide the original.
Just don't animate it - gets pretty violent :)
https://www.youtube.com/watch?v=lbyQ22kpliw
yeah what EP was trying
I made wildly bobbing longboats by animating it recently https://www.youtube.com/watch?v=deK8POGKJds
the physics idea was just a suggestion as EP now has C8.5 and bullet is just so cool any excuse to play worth it.
Absolutely awesome, Wendy!So cool!
OK for the tutorial.
The file is Public Domain so go nuts.
It was to smile…:-)
In any case, the link on CarraraCafé is better than on this forum where the ancient threads are difficult to find.
Thanks to you and EP.
Wendy, it's very original !
You must try the same animations but with frogs, that could be nice too...%-P
Thank you EP! Great tutorial. I was going to have to tackle/figure out sea foam for my project but don't need to anymore :-)
Awesome EP... and pretty educational when you follow the tutorial. TY very much!
- Don
I'm glad I could help. I just wish I could remember who wrote about it originally.