Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

result of FNL_NOISE_CELLULAR in HLSL is not match the same in CPP #89

Open
rfvtgbzxc opened this issue Mar 22, 2022 · 0 comments
Open

Comments

@rfvtgbzxc
Copy link

I used follwing parameters:
cpp:

FastNoiseLite noise;
noise.SetNoiseType(FastNoiseLite::NoiseType_Cellular);
noise.SetFrequency(0.02f);
PictureB aBmp(128, 128);
// Gather noise data
for (int y = 0; y < 128; y++)
{
	for (int x = 0; x < 128; x++)
	{
		aBmp.SetPixel(x,y,noise.GetNoise((float)x, (float)y)*255,0,0);
	}
}

HLSL:

fnl_state voronoiNoise = fnlCreateState();
voronoiNoise.noise_type = FNL_NOISE_CELLULAR;
voronoiNoise.frequency = 0.02f;
float sampledPixel = fnlGetNoise2D(voronoiNoise, tc.x * 100, tc.y *100);
return float4(sampledPixel, 0, 0, 1);

The texture coord is form 0 to 1, go through it. I mul it with 100 to match the size as the cpp one.

The result of cpp is as expectation, a noise like reflection on water suface. However in HLSL, there are only a little highlights scattering on the surface, other most field of the surface is black, which indicates the value after sampling is 0. The default noiseType, FNL_NOISE_OPENSIMPLEX2 in HLSL is running good. I tried to change the other parameters , simulating the setting in Readme.md of the homepage, but get the same result.

I use Directx11. The version of HLSL is 5.0 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant