Skip to content

Cosmetic issue with the mandelbrot set definition #3

Open
@exaexa

Description

Mandelbrot set is usually rendered with 2 set as a divergence threshold, the example shader in the repo actually uses sqrt(2) -- what comes from the vector dot-product is a squared distance. Suggest this fix to prevent naming confusion:

diff --git a/shaders/shader.comp b/shaders/shader.comp
index a03f4a0..ca26283 100644
--- a/shaders/shader.comp
+++ b/shaders/shader.comp
@@ -38,7 +38,7 @@ void main() {
   for (int i = 0; i<M; i++)
   {
     z = vec2(z.x*z.x - z.y*z.y, 2.*z.x*z.y) + c;
-    if (dot(z, z) > 2) break;
+    if (dot(z, z) > 4) break;
     n++;
   }

As a result, the image becomes slightly neater.

Anyway, thanks a lot for packing the compute stuff in one repo, this has saved me a day of documentation crunching.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions