How do I import the Improved Noise function?

Hello everyone,

First post here, so I apologise for the beginner question.

I’m trying to use the Improved Noise function in the math folder and have been able to import it using:

import {ImprovedNoise} from 'https://unpkg.com/three/examples/jsm/math/ImprovedNoise.js';

But when I try to access the noise function using:

let val = new ImprovedNoise().noise(5);

It comes back with a 0 regardless of what the input value is.

I get the same response regardless of if I put the “new” in it or what value / number of values I give the function. So I’m at a bit of a loss of how to actually access this function.

Many thanks in advance,
chreeb

( Link to Improved Noise module here)

  1. Noise function takes 3 arguments - using just one will always return NaN (since you multiply stuff by undefined.)
  2. Noise (and quite a lot of other math functions / shader helpers / utils) works in range 0 to 1. Anything above or below will be modulated (tbh I have no idea if that’s the right word, this thing) back to this range. So (5,5,5) will give you the same output as (1,1,1) - but (.5,.5,.5) will already change the noise value.
1 Like

This makes a more sense, thank you for the help! :slight_smile: