How do you use Mathf.PerlinNoise in a compute shader?

Hello there,

I made a terrain generator and a texture generator for the terrain, but the performance wasn’t really good.
And since the texture is 10x more detailed then the terrain (because I didn’t want the terrain to be really detailed) I wanted to move my texture script to a compute shader, but as you can see from the question I couldn’t find a way to use Mathf.PerlinNoise in a compute shader.
Does someone know a way to use the function?
If not it’s not the biggest problem, but differently I have to

  • First generate the terrain and store the height in a low resolution image to pass to my compute shader
    or
  • Create a perlin noise function myself that I can write in both c# and HLSL

If you need a bit more detail about what I actually want to make you can view my devlogs on Devlogs - YouTube
Devlog number 2 gives the best information about the terrain

Just add this one to your shader.

Also you can try this one

Either use the noise function or implement one yourself. There are plenty of examples out there.