Title: Bug in GLSL code for examples/Topics/Shaders/Nebula · Issue #20 · processing/processing-examples · GitHub
Open Graph Title: Bug in GLSL code for examples/Topics/Shaders/Nebula · Issue #20 · processing/processing-examples
X Title: Bug in GLSL code for examples/Topics/Shaders/Nebula · Issue #20 · processing/processing-examples
Description: 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 freq...
Open Graph Description: 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 t...
X Description: 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 t...
Opengraph URL: https://github.com/processing/processing-examples/issues/20
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bug in GLSL code for examples/Topics/Shaders/Nebula ","articleBody":"### Issue description\r\nWhen 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.\r\n\r\n### URL(s) of affected page(s)\r\n\r\n\r\n\r\n### Proposed fix\r\n\r\n float surface3 ( vec3 coord, float frequency ) {\r\n\t\r\n\tfloat n = 0.0;\t\r\n\t\t\r\n\tn += (0.5 + 0.00625) * abs( cnoise4( coord * frequency ) );\r\n\tn += (0.25 + 0.00625) * abs( cnoise4( coord * frequency * 2.0 ) );\r\n\tn += (0.125 + 0.00625) * abs( cnoise4( coord * frequency * 4.0 ) );\r\n\tn += (0.0625 + 0.00625) * abs( cnoise4( coord * frequency * 8.0 ) );\r\n\tn += (0.03125 + 0.00625) * abs( cnoise4( coord * frequency * 16.0 ) );\r\n\t\r\n\treturn n;\r\n }\r\n\r\nThis 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.\r\n\r\nThe 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.\r\n","author":{"url":"https://github.com/pjfordham","@type":"Person","name":"pjfordham"},"datePublished":"2023-05-02T00:19:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/20/processing-examples/issues/20"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ede65837-b873-69b3-16a7-35650fc34973 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D368:38354B:327C16F:44432D2:69708D98 |
| html-safe-nonce | edb5d0fc5a2a20d27ed26ae8da86deca9e2a63185f832552f32be83d12d4d320 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzY4OjM4MzU0QjozMjdDMTZGOjQ0NDMyRDI6Njk3MDhEOTgiLCJ2aXNpdG9yX2lkIjoiNDYyMjk2MzQ0MDM3OTUzMDY0OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3659583e791d6f0f82d14db7f0056302403912dfcb53f503081c6d2f1e242bc4 |
| hovercard-subject-tag | issue:1692052171 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/processing/processing-examples/20/issue_layout |
| twitter:image | https://opengraph.githubassets.com/be37e3b03cc7b7eb3c677a4e4af544249234c8007d6d7a38b381f02ca7663f4d/processing/processing-examples/issues/20 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/be37e3b03cc7b7eb3c677a4e4af544249234c8007d6d7a38b381f02ca7663f4d/processing/processing-examples/issues/20 |
| og:image:alt | 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 t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pjfordham |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| turbo-cache-control | no-preview |
| go-import | github.com/processing/processing-examples git https://github.com/processing/processing-examples.git |
| octolytics-dimension-user_id | 1617169 |
| octolytics-dimension-user_login | processing |
| octolytics-dimension-repository_id | 394096315 |
| octolytics-dimension-repository_nwo | processing/processing-examples |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 394096315 |
| octolytics-dimension-repository_network_root_nwo | processing/processing-examples |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7d6181066430cc06553c8396ca201e194ae33cb9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width