How to make caves with PerlinNoise

I used Mathf.PerliNoise to make a random terrain, but now I don’t know if I can use Mathf.PerliNoise to make the caves. I know that the caves can be made with two Perlin noise 3D, by making PerlinNoise1 * PerlinNoise2, and making empty the resulting blocks. But can I make this with 2D noises or I need to write a function for 3D noises?

Christoph_r is correct however I’d like to clarify on a few things.

First of all, you’re asking to make caves with 3D Perlin Noise but I don’t believe this is what you want as the result generally looks something like this. To get a result similar to caves, you’d want to look into Perlin Worms, which in 2D create this. You would just need to create you’re own function that implements this in 3D.

However, if you are using Unity’s terrain object combined with Perlin Noise heightmaps, you won’t be able to make caves because (as christoph_r said) “you’d have to assign at least two height values for parts of the terrain.” Which can’t be done right now.

The only way that I know of to create caves would be to create the terrain in modelling software such as Blender or Autodesk 3DS/Maya. But that would defeat the purpose because it’s no longer random terrain.