Skip to content

improved simplex noise#1690

Merged
zackees merged 1 commit into
masterfrom
improved-simplex
Aug 31, 2024
Merged

improved simplex noise#1690
zackees merged 1 commit into
masterfrom
improved-simplex

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented Aug 31, 2024

Optimizations lifted from https://github.com/aykevl

Copy link
Copy Markdown
Contributor

@aykevl aykevl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks the same. Untested (not using FastLED at the moment) but it looks reasonable.

A few nitpicks below, feel free to ignore.

Comment thread src/simplex.cpp
// The result is scaled to return values in the interval [-1,1].
int32_t n = n0 + n1 + n2; // .30
n = (n << 6) / 46360; // fix scale to fit exactly in an int16_t
n = ((n >> 8) * 23163) >> 16; // fix scale to fit exactly in an int16
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you meant int16_t?

Suggested change
n = ((n >> 8) * 23163) >> 16; // fix scale to fit exactly in an int16
n = ((n >> 8) * 23163) >> 16; // fix scale to fit exactly in an int16_t

Same for 3D noise (which was also wrong in my original FastLED PR).

Comment thread src/simplex.cpp
// The result is scaled to stay just inside [-1,1]
int32_t n = n0 + n1 + n2 + n3; // .30
n = (n << 6) / 64120; // fix scale to fit exactly in an int16
n = ((n >> 8) * 16748) >> 16 ; // fix scale to fit exactly in an int16
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
n = ((n >> 8) * 16748) >> 16 ; // fix scale to fit exactly in an int16
n = ((n >> 8) * 16748) >> 16; // fix scale to fit exactly in an int16_t

@zackees zackees merged commit d3f2029 into master Aug 31, 2024
@zackees zackees deleted the improved-simplex branch September 24, 2024 01:51
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

Successfully merging this pull request may close these issues.

2 participants