The Ocean and Easily Animated Foam

evilproducerevilproducer Posts: 9,050
edited April 2015 in Carrara Discussion

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.

Picture_5.png
644 x 245 - 55K
Picture_4.png
718 x 243 - 54K
Picture_3.png
762 x 327 - 76K
Picture_2.png
756 x 200 - 49K
Picture_1.png
790 x 590 - 319K
Post edited by evilproducer on
«13

Comments

  • evilproducerevilproducer Posts: 9,050
    edited December 1969

    More shader nonsense. ;-)

    Picture_8.png
    611 x 474 - 103K
    Picture_7.png
    697 x 535 - 122K
    Picture_6.png
    740 x 363 - 82K
  • evilproducerevilproducer Posts: 9,050
    edited December 1969

    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.

    ocean.gif
    480 x 360 - 4M
    Picture_12.png
    467 x 127 - 15K
    Picture_11.png
    931 x 152 - 14K
    Picture_10.png
    989 x 960 - 64K
    Picture_9.png
    299 x 783 - 90K
  • evilproducerevilproducer Posts: 9,050
    edited April 2015

    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.

    Post edited by evilproducer on
  • PhilWPhilW Posts: 5,145
    edited December 1969

    I haven't yet had the chance to go through all your description, but the result looks great!

  • DUDUDUDU Posts: 1,945
    edited December 1969

    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 ?

  • JoeMamma2000JoeMamma2000 Posts: 2,615
    edited December 1969

    Wow, that looks surprisingly nice...

    Especially for distance shots.

  • DUDUDUDU Posts: 1,945
    edited December 1969

    Wow, that looks surprisingly nice...

    Especially for distance shots.

    Or, for semi-realistic animations, just like I'm doing...;-)

  • DADA_universeDADA_universe Posts: 336
    edited December 1969

    Awesome. thanks e.p.

  • 3drendero3drendero Posts: 2,026
    edited December 1969

    Thanks. Looks great in high resolution too.

    Is it OK to make an article at CarraraCafe and post the scene/shader there as well?

  • HeadwaxHeadwax Posts: 9,996
    edited December 1969

    Wow! I'm giving you eleven out of ten for this ! ;)

  • evilproducerevilproducer Posts: 9,050
    edited December 1969

    3drendero said:
    Thanks. Looks great in high resolution too.

    Is it OK to make an article at CarraraCafe and post the scene/shader there as well?

    You are very welcome to post it over there!

  • evilproducerevilproducer Posts: 9,050
    edited April 2015

    Wow, that looks surprisingly nice...

    Especially for distance shots.

    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.

    Post edited by evilproducer on
  • 3drendero3drendero Posts: 2,026
    edited December 1969

    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/

  • evilproducerevilproducer Posts: 9,050
    edited December 1969

    3drendero said:
    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. ;-)

  • DUDUDUDU Posts: 1,945
    edited December 1969

    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é ? ;-)

  • DUDUDUDU Posts: 1,945
    edited December 1969

    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.

  • evilproducerevilproducer Posts: 9,050
    edited December 1969

    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.

  • evilproducerevilproducer Posts: 9,050
    edited December 1969

    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.

  • DartanbeckDartanbeck Posts: 21,623
    edited December 1969

    Very cool, ep! Thanks a bunch!

  • McGuiverMcGuiver Posts: 219
    edited December 1969

    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.

    EP,
    Perhaps Sparrowhawkes pin modifier would "float your boat" :cheese:

  • DartanbeckDartanbeck Posts: 21,623
    edited December 1969

    McGuiver said:
    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.

    EP,
    Perhaps Sparrowhawkes pin modifier would "float your boat" :cheese:...and/or BrianOrca's fine Ocean plugin!

  • WendyLuvsCatzWendyLuvsCatz Posts: 38,289
    edited December 1969

    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.

  • RoygeeRoygee Posts: 2,247
    edited December 1969

    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 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

  • WendyLuvsCatzWendyLuvsCatz Posts: 38,289
    edited December 1969

    Roygee said:
    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 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.

  • DartanbeckDartanbeck Posts: 21,623
    edited December 1969

    Absolutely awesome, Wendy!So cool!

  • 3drendero3drendero Posts: 2,026
    edited December 1969

    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é ? ;-)

    OK for the tutorial.

    The file is Public Domain so go nuts.

  • DUDUDUDU Posts: 1,945
    edited December 1969

    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

  • stringtheory9stringtheory9 Posts: 411
    edited December 1969

    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 :-)

  • DondecDondec Posts: 243
    edited December 1969

    Awesome EP... and pretty educational when you follow the tutorial. TY very much!

    - Don

  • evilproducerevilproducer Posts: 9,050
    edited December 1969

    I'm glad I could help. I just wish I could remember who wrote about it originally.

Sign In or Register to comment.