Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1023079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:33:37+00:00 2026-05-16T11:33:37+00:00

I’m looking to create a blob in a computationally fast manner. A blob here

  • 0

I’m looking to create a “blob” in a computationally fast manner. A blob here is defined as a collection of pixels that could be any shape, but all connected. Examples:

.ooo....  
..oooo..  
....oo..  
.oooooo.
..o..o..  

...ooooooooooooooooooo...  
..........oooo.......oo..  
.....ooooooo..........o..  
.....oo..................  


......ooooooo....  
...ooooooooooo...  
..oooooooooooooo.  
..ooooooooooooooo  
..oooooooooooo...  
...ooooooo.......  
....oooooooo.....  
.....ooooo.......  
.......oo........  

Where . is dead space and o is a marked pixel. I only care about “binary” generation – a pixel is either ON or OFF. So for instance these would look like some imaginary blob of ketchup or fictional bacterium or whatever organic substance.

What kind of algorithm could achieve this? I’m really at a loss

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:33:37+00:00Added an answer on May 16, 2026 at 11:33 am

    David Thonley’s comment is right on, but I’m going to assume you want a blob with an ‘organic’ shape and smooth edges. For that you can use metaballs. Metaballs is a power function that works on a scalar field. Scalar fields can be rendered efficiently with the marching cubes algorithm. Different shapes can be made by changing the number of balls, their positions and their radius.

    See here for an introduction to 2D metaballs: https://web.archive.org/web/20161018194403/https://www.niksula.hut.fi/~hkankaan/Homepages/metaballs.html

    And here for an introduction to the marching cubes algorithm: https://web.archive.org/web/20120329000652/http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/

    Note that the 256 combinations for the intersections in 3D is only 16 combinations in 2D. It’s very easy to implement.

    EDIT:

    I hacked together a quick example with a GLSL shader. Here is the result by using 50 blobs, with the energy function from hkankaan’s homepage.
    alt text

    Here is the actual GLSL code, though I evaluate this per-fragment. I’m not using the marching cubes algorithm. You need to render a full-screen quad for it to work (two triangles). The vec3 uniform array is simply the 2D positions and radiuses of the individual blobs passed with glUniform3fv.

    /* Trivial bare-bone vertex shader */
    #version 150
    in vec2 vertex;
    void main()
    {
        gl_Position = vec4(vertex.x, vertex.y, 0.0, 1.0);
    }
    
    /* Fragment shader */
    #version 150
    #define NUM_BALLS 50
    out vec4 color_out;
    uniform vec3 balls[NUM_BALLS]; //.xy is position .z is radius
    
    bool energyField(in vec2 p, in float gooeyness, in float iso)
    {
        float en = 0.0;
        bool result = false;
        for(int i=0; i<NUM_BALLS; ++i)
        {
            float radius = balls[i].z;
            float denom =  max(0.0001, pow(length(vec2(balls[i].xy - p)), gooeyness));
            en += (radius / denom);
        }
        if(en > iso)
            result = true;
        return result;
    }
    void main()
    {
        bool outside;
        /* gl_FragCoord.xy is in screen space / fragment coordinates */
        outside = energyField(gl_FragCoord.xy, 1.0, 40.0);
        if(outside == true)
            color_out = vec4(1.0, 0.0, 0.0, 1.0);
        else
            discard;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.