Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does this simulation implement the boundary conditions described in GPUGems? #81

Open
spencerkohan opened this issue Jun 15, 2022 · 1 comment

Comments

@spencerkohan
Copy link

Hi @PavelDoGreat, thanks for sharing the code, this is an amazing implementation.

I'm trying to translate this to compute shaders as a way of learning more about compute and also Vulkan. I've gotten pretty far, but my simulation doesn't seem to behave correctly at the boundaries, as yours does.

Reading through GPU gems, it looks like there should be a special case on the boundaries for both velocity and pressure. It looks like somehow you're handling this in your divergence shader with this segment:

        if (vL.x < 0.0) { L = -C.x; }
        if (vR.x > 1.0) { R = -C.x; }
        if (vT.y > 1.0) { T = -C.y; }
        if (vB.y < 0.0) { B = -C.y; }

But my question is, do you account for the boundary conditions in any other way, or should this be sufficient?

Best,
Spencer

@PavelDoGreat
Copy link
Owner

@spencerkohan Hey. I know little about compute shaders at the moment. I may assume that compute shaders doesn't do texture boundary checks as fragment shaders do. In my simulation when I initialize textures and framebuffers, I set parameter CLAMP_TO_EDGE, which clamps texture accessing coordinate in fragment shader to 0-1.

Repository owner deleted a comment from MiracleCK Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants