GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Bug in GLSL code for examples/Topics/Shaders/Nebula · Issue #20 · processing/processing-examples

Bug in GLSL code for examples/Topics/Shaders/Nebula  #20

New issue
Copy link
New issue
Copy link
Open
Open
Bug in GLSL code for examples/Topics/Shaders/Nebula #20
Copy link
Labels
enhancementNew feature or requestNew feature or request

Description

@pjfordham
pjfordham
opened on May 2, 2023
Issue body actions

Issue description

When you run this example, opaque black regions occasionally appear in the visualization. This appears to be caused by the surface3 function returning values larger than 1.0 due to the way it sums various different frequencies of noise. When the value is larger than 1.0 the calculated color can end up negative which results in the opaque black sections.

URL(s) of affected page(s)

Proposed fix

float surface3 ( vec3 coord, float frequency ) {

float n = 0.0;	
	
n += (0.5     + 0.00625) * abs( cnoise4( coord * frequency ) );
n += (0.25    + 0.00625) * abs( cnoise4( coord * frequency * 2.0 ) );
n += (0.125   + 0.00625) * abs( cnoise4( coord * frequency * 4.0 ) );
n += (0.0625  + 0.00625) * abs( cnoise4( coord * frequency * 8.0 ) );
n += (0.03125 + 0.00625) * abs( cnoise4( coord * frequency * 16.0 ) );

return n;
}

This suggested new version of surface3 ensures that the return value is never greater than 1 by weighting the noise frequencies more appropriately. I have reduced the main weighting of each frequency by half and added back a small extra bit to ensure the total of all the weights is 1, while maintaining approximately the same intended distribution.

The result is a little more nebula heavy than the original so more tweaking might be needed by those with a better eye for graphic design than me.

Activity

  1. SableRaf
    added
    enhancementNew feature or requestNew feature or request
    on May 2, 2023
  2. SableRaf
    transferred this issue fromprocessing/processing-docson May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.