Git Product home page Git Product logo

mc-dc's People

Contributors

boristhebrave avatar leifniem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mc-dc's Issues

Ambiguous case: facing quads

Hi Boris. First of all thanks for your tutorial. Thanks to you I was able to start my own implementation of the marching cubes algorithm in the Godot Engine.

However I don't know how to deal with this case:
Screen Shot 2019-04-15 at 9 53 35 PM

It works ok if I don't use inverse cases:
Screen Shot 2019-04-15 at 10 00 16 PM

But if I invert the values of the vertices I get the ambiguos cases:
Screen Shot 2019-04-15 at 10 00 49 PM

Is there a way to fix this or should I just give up and move on to dual contouring?

What is the use of Quad.swap(bool)?

Hey there, I was trying to figure this out in another language, and I can't figure out what

Quad(Float, Float, Float, Float).swap(Bool) is supposed to be doing.

reference:

).swap(solid2))

I get that there is a Quad object, which I believe is x, y, w, h. But I'm not sure what the swap(bool) function does. Is this flipping the face or something? Sorry I can't find documentation for utils3d anyplace so I don't really know where to go.

marching cubes 3 extra cases

Just reading through your article series, enjoying it very much. You describe in the article about marching cubes 3D that there are 3 extra cases in additional to the original ones. How do you decide though if you use the extra case or the original one? I've checked your code, but it doesn't seem to do any kind of case distinction to facilitate this. So your code ignores those extra 3 cases?

Artifacts with different CELL_SIZE

hi @BorisTheBrave , I think it maybe better to open a new issue to make it clearer. thanks for your quick help and modification! We'are able to change the resolution by CELL_SIZE now. The new code seems all good but when I test with the [circle function, circle normal], there are some artifacts in the result .

CELL_SIZE = 0.1:
image

If I use [circle function, normal_from(circle function)], the result is better but still a flip face.
image

This is when i use CELL_SIZE 0.5, there are three artifaces areas.
image

Could you please help with this? Is it because the circal normal is not correct?

Question regarding article

Sorry for bothering with the question. I hope it is okay to ask here since your blog has comments disabled.

First of all thanks a lot for all the effort you put into your very elaborate and comprehensive tutorial. So my question regarding the dual contouring article is the following:

How would i know the gradients to adapt the vertex of a cell without external information? In your sample this is known information because it is known by inferting the x and y of a cell and the distance from the center - but how would this work in a rendering scenario where i am unaware of the volume i am trying to render?

I have looked at the implementation of lin20 but the code is not really optimized for comprehension, like your code , and i cannot yet comprehend how i would infer normals to adapt the vertex position in a scenario where i do not have information as to what exactly i am rendering.

Is there something i am missing or is that a case where i would just not adapt my vertex position at all (since getting normals would require external information)?

A bug in file`marching_cube_2d.py`.

Thanks for your wonderful work and demostration, which helps me a lot!
Yet there are some bugs in the file marching_cube_2d.py which may makes misunderstanding probably.
The correct file will be shown below :

 if case is 0 or case is 15:
        # 
        return []
    if case is 1 or case is 14:
        # 
        return [Edge(Node2D(x+0+adapt(x0y0, x1y0), y), Node2D(x+0, y+adapt(x0y0, x0y1))).swap(case is 14)]
    if case is 2 or case is 13:
        # 
        return [Edge(Node2D(x + 0, y + adapt(x0y0, x0y1)), Node2D(x + adapt(x0y1, x1y1), y + 1)).swap(case is 13)]
    if case is 4 or case is 11:
        # Single corner
        return [Edge(Node2D(x + 1, y + adapt(x1y0, x1y1)), Node2D(x + adapt(x0y0, x1y0), y + 0)).swap(case is 11)]
    if case is 8 or case is 7:
        # Single corner
        return [Edge(Node2D(x+adapt(x0y1, x1y1), y+1), Node2D(x+1, y+adapt(x1y0, x1y1))).swap(case is 7)]
    if case is 3 or case is 12:
        # Vertical split
        return [Edge(Node2D(x+adapt(x0y0, x1y0), y+0), Node2D(x+adapt(x0y1, x1y1), y+1)).swap(case is 12)]
    if case is 5 or case is 10:
        # Horizontal split
        return [Edge(Node2D(x+0, y+adapt(x0y0, x0y1)), Node2D(x+1, y+adapt(x1y0, x1y1))).swap(case is 5)]
    if case is 9:
        # Two opposite corners, copy cases 1 and 8
        return [Edge(Node2D(x + 0 + adapt(x0y0, x1y0), y), Node2D(x + 0, y + adapt(x0y0, x0y1))),
                Edge(Node2D(x + adapt(x0y1, x1y1), y + 1), Node2D(x + 1, y + adapt(x1y0, x1y1)))]
    if case is 6:
        # Two opposite corners, copy cases 2 and 4
        return [Edge(Node2D(x+1, y+adapt(x1y0, x1y1)), Node2D(x+adapt(x0y0, x1y0), y+0)),
                Edge(Node2D(x+0, y+adapt(x0y0, x0y1)), Node2D(x+adapt(x0y1, x1y1), y+1))]

Figure_1

Change of Resolution

Hi @BorisTheBrave , thanks for you amazing mc-dc tutorial. I'm new to marching cubes and really enjoyed your tutorial and code. I have a question, how can i modify the resolution of mc/dc? (i.e., change the grids resolution from 333 to 161616) I tried to change XMIN/XMAX etc but the number of vertices always the same. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.