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

Fix overflow of 2 sides in emulator mode #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LarsMichelsen
Copy link

@LarsMichelsen LarsMichelsen commented Mar 15, 2019

I started experimenting with your shaders some hours ago. The approach looks pretty interesting. The whole shader thing is new for me, but it looks pretty exciting.

During my first steps I tried to fill all sides of the cube with different colors in emulator mode. I noticed that the colors of two sides of the cube were visible at the edge of the adjacent sides.

After some tests I found out that the problem occurs only with active "EMU_GRID" and built the attached fix.

Enclosed is a picture showing the problem. And then another one I made after my change.

bug
fixed

Thanks for your work! :-)

@polyfloyd
Copy link
Owner

Hey Lars, thank you for taking the effort to fix this long standing bug :)

Unfortunately, this rounding is to ensure that a cell has a single color which is something that I do like to keep. This effect is especially visible when the grid size is lowered to e.g. 8. Could you reattempt your patch to keep this into account?

@LarsMichelsen
Copy link
Author

Changing EMU_GRID to 8 with the test shader I used before works as you can see in this screenshot.

shader1-patched

But that seems to be related to the fact that the sides simply use a single color.

When using another test shader I see some problems, but also the unpatched variant is not ideal. Have a look at these images. First the 64 grid:

shader-2-64

Then the 8 grid using my PR:

shader2-patched

Pro: Everything is positioned correctly
Con: The dots are truncated.

The 8 grid with original code:

shader2-original

Pro: The dots are not truncated.
Con: The not positioned correctly on the sides (e.g. orange circles are not centered)

10 grid using my PR:

shader2-10dot-patched

Pro: Everything is positioned correctly. The dots are not truncated.

10 grid using original code:

shader2-10dot

Pro: The dots are not truncated.
Con: The not positioned correctly on the sides (e.g. orange circles are not centered)

I have the feeling that I hadn't quite understood the problem yet.

I've thought about it a bit and at least came to the conclusion that the moment the shader pattern doesn't exactly match the grid of the LEDs you have to decide whether to display half dots (which is obviously a bad simulation), leave out the half dots or expand the area. Is that the intention at this point?

@polyfloyd
Copy link
Owner

Yes, when the cells are positioned correctly, there should be half dots on the edges of the cube. These half dots should be culled

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

Successfully merging this pull request may close these issues.

2 participants