Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6240499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:34:51+00:00 2026-05-24T11:34:51+00:00

I have written a 2D Perlin noise implementation based on information from here ,

  • 0

I have written a 2D Perlin noise implementation based on information from here, here, here, and here. However, the output looks like this.

public static double Perlin(double X, double XScale, double Y, double YScale, double Persistance, double Octaves) {
    double total=0.0;
    for(int i=0;i<Octaves;i++){
        int frq = (int) Math.Pow(2,i);
        int amp = (int) Math.Pow(Persistance,i);
        total += InterpolatedSmoothNoise((X / XScale) * frq, (Y / YScale) * frq) * amp;
    }
return total;
}

private static double InterpolatedSmoothNoise (double X, double Y) {
int ix = (int) Math.Floor(X);
double fx = X-ix;
int iy = (int) Math.Floor(Y);
double fy = Y-iy;

double v1 = SmoothPerlin(ix,iy); //          --
double v2 = SmoothPerlin(ix+1,iy); //        +-
double v3 = SmoothPerlin(ix,iy+1);//         -+
double v4 = SmoothPerlin(ix+1,iy+1);//       ++

double i1 = Interpolate(v1,v2,fx);
double i2 = Interpolate(v3,v4,fx);

    return Interpolate(i1,i2,fy);
}

private static double SmoothPerlin (int X, int Y) {
    double sides=(Noise(X-1,Y,Z)+Noise(X+1,Y,Z)+Noise(X,Y-1,Z)+Noise(X,Y+1,Z)+Noise(X,Y,Z-1)+Noise(X,Y,Z+1))/12.0;
    double center=Noise(X,Y,Z)/2.0;
    return sides + center;
}

private static double Noise (int X, int Y) {
uint m_z = (uint) (36969 * (X & 65535) + (X >> 16));
uint m_w = (uint) (18000 * (Y & 65535) + (Y >> 16));
uint ou = (m_z << 16) + m_w;
return ((ou + 1.0) * 2.328306435454494e-10);
}

Any input on what is wrong is appreciated.

EDIT: I found a way to solve this: I used an array of doubles generated at load to fix this. Any way to implement a good random number generator is appreciated though.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:34:51+00:00Added an answer on May 24, 2026 at 11:34 am

    I suppose this effect is due to your noise function (all other code looks ok).

    The function

    private static double Noise (int X, int Y) {
        uint m_z = (uint) (36969 * (X & 65535) + (X >> 16));
        uint m_w = (uint) (18000 * (Y & 65535) + (Y >> 16));
        uint ou = (m_z << 16) + m_w;
        return ((ou + 1.0) * 2.328306435454494e-10);
    }
    

    isn’t very noisy but strongly correlated with your input X and Y variables. Try using any other pseudo-random function which you seed with you input.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written my own Perlin Noise implementation and it works well. I can 'zoom'
I have written an AIR Application that downloads videos and documents from a server.
have written a stochastic simulation in Java, which loads data from a few CSV
I have written a generic class class MyClass : MyClass<string> { } //this line
I have written a Java program which I package and run from a JAR
I have written a xml/php document that is pulling from a Magento Commerce database,
I have written a database query to extract information in ColdFusion and I want
I have written custom delegate methods in ClassFile(B), now i am calling them from
I have written an artifical neural network (ANN) implementation for myself (it was fun).
Have written all the code in a silverlight class library (dll) and linked this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.