top of page

FLIP SOLVER

FOAM and BUBBLES

00. Exporting Ocean Foam as texture

ocean foam textures export.gif

A common question I see about ocean and foam is if it's possible to export it as texture for Maya or another 3D program. The answer is yes and in the following lines I'll explain briefly how to do it, or at least I'll give you some ideas.

 

Let's start with the most important thing about this method. You absolutely need UVs. 

If you render the ocean in Mantra / Houdini with the current ocean shader, it's going to read back the ocean foam caches and change the look of the water based on that. In this case there is no need of UVs since it's based on the position of these points.

You can't do this anymore if you export this information as texture (as I am going to show below), that's why having UVs is a must.

 

It's kinda hard and can easily get confusing writing everything in details so I'll describe the main steps and you will find the hip file below.

HOW TO DO IT

 

 First of all I created a basic setup with a grid, ocean spectrum and ocean foam.

Then, as mentioned before, I created the UVs for the grid. In a wrangle I moved the grid to uv space using a simple expression which is v@P = v@uv

 

Inside the Ocean Foam SOP place another UV project node as shown in the hip file (you need to dive into it, and you will find 2 red nodes and a text). Make sure that the UV project is set to Orthographic and that scale is correct. We need to match the UV Project of the Ocean Grid that we created before. You can also copy and paste it. The timeshift is there just for the sake of simplicity and so you can see it faster. If you need to export it as an animated texture of course you have to disable it.

 

After these steps we are ready to create the setup for exporting the foam texture. And that's the funny part..

Create a copnet where you prefer. Since it is strictly related to this SOP network, I created it inside the node "ocean foam to texture". Inside of it, create a "VOP COP2 Generator".

 

Create also an ocean_surface material. Again, create it where you want. We need it just to copy partially the setup that it's inside of it. You can delete it later. What needs to be copied from the ocean surface material is the foam part. If you don't know how to find it look at my hipfile. If you go inside /mat /oceansurface I have marked the nodes that need to be copied. So copy this nodes and paste them inside the VOP COP2 Generator previously created. 

 

Now you need to lay down some nodes (the nodes colored in red) and connect them as I did in the hipfile. Pay attention to the nodes xyz dist and prim uv. This two nodes are responsible to read the position informations from the foam and transfer it to uv space so you can export them as textures. Their inputs are very very important.

 

What they do? We are in COP context which means we are working with textures in UV space. XYZdist and PrimUV are there to understand where each pixel of the texture is in 3D space ( aka world space). This is a pretty powerful concept if you think about it that opens many doors. Now that we know where is each pixel in 3D space we can see how close is to the foam particles and that's exactly what the foam part that we copied does. And then voila, we get the foam texture   

 

 

 

 

Finally you can create the ROP File Output and export the texture

bottom of page