p5.js icon indicating copy to clipboard operation
p5.js copied to clipboard

Support noiseDetail in p5.strands

Open davepagurek opened this issue 2 months ago • 5 comments

Increasing access

In p5.js, the fractal application of noise() is controlled by noiseDetail(). Inside of p5.strands, we now also support noise(), but confusingly to newcomers, noiseDetail() will not affect it. To make this aspect of p5.strands shaders as approachable as possible, we should make the noise behaviour of regular p5 also work in p5.strands.

Most appropriate sub-area of p5.js?

  • [ ] Accessibility
  • [ ] Color
  • [ ] Core/Environment/Rendering
  • [ ] Data
  • [ ] DOM
  • [ ] Events
  • [ ] Image
  • [ ] IO
  • [ ] Math
  • [ ] Typography
  • [ ] Utilities
  • [x] WebGL
  • [ ] Build process
  • [ ] Unit testing
  • [ ] Internationalization
  • [ ] Friendly errors
  • [ ] Other (specify if possible)

Feature enhancement details

In p5, parameters of noise are currently set via noiseDetail.. There is some discussion in https://github.com/processing/p5.js/issues/7430 about possible changes to that behaviour in the future, but whatever the current state of noiseDetail is, we should match that behaviour in p5.strands.

noiseDetail sets a falloff multiplier and number of octaves. In p5.strands, these values are currently hardcoded in our GLSL implementation: https://github.com/processing/p5.js/blob/6c6ac6c73cf1ed74a2896e0edfcdf1fcfff0bb28/src/webgl/shaders/functions/noise3DGLSL.glsl#L97-L105

To make this work correctly, we'll need to dynamically pass in those values from p5 as an argument. Currently, we translate users' arguments into a single vec3 input. Maybe what we need to do it, at the time we do this, grab the current noise falloff and octaves, and pass those in as additional parameters?

davepagurek avatar Oct 15 '25 21:10 davepagurek

Hey @davepagurek I would love to work on this issue , Can you assign me this, thanks

hxrshxz avatar Oct 16 '25 08:10 hxrshxz

Thanks @hxrshxz!

davepagurek avatar Oct 16 '25 13:10 davepagurek

Hi @davepagurek just wondering if I could work on this issue since the previous assignee's most recent update was nearly a month ago?

ZhYGuoL avatar Nov 14 '25 23:11 ZhYGuoL

Thanks @ZhYGuoL! Do you mind explaining a bit about what your approach will be, since this is a slightly advanced task?

davepagurek avatar Nov 15 '25 17:11 davepagurek

hey @davepagurek @ZhYGuoL I will update the changes I am sorry I got busy with my university exams

hxrshxz avatar Nov 15 '25 17:11 hxrshxz