Add methods to retrieve noise parameters for WebGL shaders#8162
Add methods to retrieve noise parameters for WebGL shaders#8162hxrshxz wants to merge 2 commits intoprocessing:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds WebGL shader support for p5.js noise parameters by exposing the current noise detail settings (octaves and amplitude falloff) to shaders as uniforms. This enables p5.strands to implement GLSL noise functions that respect the current noiseDetail() settings.
- Added two private getter functions to expose noise octaves and amplitude falloff values
- Updated all default WebGL shaders to include noise parameter uniforms
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/math/noise.js | Added private getter functions to expose current noise octaves and amplitude falloff values |
| src/webgl/p5.RendererGL.js | Added noise uniforms to all default shaders (base material, normal, color, point, and line shaders) |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Hi! This doesn't quite do what the original issue was asking for. The original issue is for p5.strands -- a feature of p5.js 2.0, which is on the I linked in the original issue to some spots in the code where this modification will have to take place, but the main part is that we'll need to pass the current values in when the user calls p5.js/src/strands/strands_api.js Lines 128 to 141 in 6c6ac6c |
|
Thank you for clarifying @davepagurek I have closed this one and opened a new one #8163 |
Resolves #8160
Changes
Added support for
noiseDetail()in p5.strands shaders:src/math/noise.js: Added two private getter functions_getNoiseOctaves()- Returns current octaves value_getNoiseAmpFalloff()- Returns current falloff valuesrc/webgl/p5.RendererGL.js: Added noise uniforms to all default shadersuNoiseOctaves(int) anduNoiseAmpFalloff(float) uniformsHow It Works
When
noiseDetail()is called, the values are now automatically passed to shaders as uniforms. This allows p5.strands to implement GLSL noise functions that use the current noise detail settings instead of hardcoded values.PR Checklist
npm run lintpasses