# [Solved] ImprovedNoise giving me some grief

Hey all. So I’ve been thrashing with the Improved Noise class and I think I’m probably just being a bit thick here.

Below is the code I’m using to try to figure out what I’m doing wrong.

private void testNoise() {
ImprovedNoise theNoise = new ImprovedNoise();

for (float x = 0; x < 100; x++) {
float valueFound = theNoise.value(x, x, x);
System.out.println("Test Noise Value: " + valueFound);

if (valueFound != 0.0f) {
System.out.println("Bigger value");
}
}
}

I’ve tried setting scale, using different parts of the class etc.

All it ever spits out though is 0.0.

I’m reminded of an xkcd comic in this case: xkcd: Random Number

Any help our pointers? This is really starting to frustrate me. Thanks!

Standard perlin noise will tend to have the same values at grid boundaries.

Change this:
float valueFound = theNoise.value(x, x, x);

To:
float valueFound = theNoise.value(x * 0.01f, x * 0.0f1, x * 0.01f);

…and see what you get.

1 Like

I presume you meant x, y, z.

I have like 900 noise algorythms if you want them. I have a thing. Maybe not 900. I Should probably post my utils library if I ever get aroud to tidying it up.

3 Likes

I do not… maybe OP did… I merely duplicated the x, x, x of OP’s original statement.

Huh. That worked. I’m somewhat confused now though.

Say my x value that I get is 100. 100 * 0.01f = 1. But if I have a value of 1 in there it ends up as 0.

Or is there some hidden weirdness of noise that I’m just not grasping?

Ya. The reason I went with x, x, x was that I didn’t want to have my example with embedded for loops for simplicities sake.

What other noise libraries do you have? I jumped on this one from a previous question I posted because it’s already included.

WAAAAAAAAAIT! nvm. I figured it out.

Float values normally range from 0 to 1. Thus at a value of 0 or 1 or a multiple therein it’d land on a boundary of the noise.

Thanks again!

Yeah, my bad… I should have used an even smaller scale.

suppose someone wanted to page in chunks of noise, what could someone effectively use to scale the input against? would divide by chunk size work for infinite chunks? any other clever ways to avoid integer input to noise function?

You could use a noise function to set the seed values for a noise function.

That’s sort of my plan for my game. Noise applied across area chunks, which is used (in conjunction with its position values) to seed a noise function to define the stuff in that chunk.

Look at @normen infinite zoom example for ideas.

Huh TIL the engine has noise generation classes. Is there a list of stuff never discussed on the forums/not mentioned in the tutorials? I guess the long javadoc list of classes…

Yep.

Edit: and then you even know context and what library you have to have by a rough guess based on package name. (For example: the above are likely in the terrain plugin.)

Hah so I found something called a char serializer. Needed because obviously chars…aren’t…serializable…

The description is pure gold:

Char serializer.

1 Like

It’s part of:
com.jme3.network.serializing.serializers

…so the clue right there is that it’s part of NETWORK serialization.

And while the network serialization is tight and fast, it’s also ugly and stupid.

Edit: it’s dumbly based on Buffers instead of streams which makes everything a hundred times messier.

1 Like

I found the jme implementation to be very functional but lacking in documentation when i wanted to extend it. Perlin, improved, simplex, voronoi and sparseDot are the implementations i have. I found reading about them more interesting than anything else. Sparsedot for example. Great for stars and water splashes.

In regard to those, the main advantage of the built in jme noise is the pre and post passes you can add. I havent done those. They are the sugar. The wiki is getting a lot more love these days though.

And on another aside, there are a few noise textures floating about, too. I believe paul uses at least one for his wind and blend functions.