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

Poor precision of Z-buffer #535

Open
prototype99 opened this issue Dec 22, 2019 · 9 comments
Open

Poor precision of Z-buffer #535

prototype99 opened this issue Dec 22, 2019 · 9 comments

Comments

@prototype99
Copy link

System information

SolveSpace version: 3.0~dcdfdec5

Operating system: Gentoo 17.0

Expected behaviour

I can zoom into fine details in my model

Actual behaviour

In this case, I am trying to insert the Huawei plug into the left plug socket. I very quickly find that zooming in far enough causes artefacts to start appearing, and the 'compass' disappears.

issue

I assume this could be due to the wall being in the way however there seems to be no true way to hide a group, so unless I can find a hidden gem in terms of patches I may need to break up the model more than I really need to just to avoid the camera bug. this problem was also present in 2.3, hence I tried building a later version to see if the issue was fixed in the upcoming release.

Additional information

room-plan.zip

@whitequark
Copy link
Contributor

I assume this could be due to the wall being in the way however there seems to be no true way to hide a group

"Suppress this group's solid model" ?

@whitequark
Copy link
Contributor

More generally, the issue you're hitting is poor Z-buffer resolution, and I don't know of any good way to solve it.

@ghost
Copy link

ghost commented Dec 23, 2019

is poor Z-buffer resolution, and I don't know of any good way to solve it.

As I know, in Blender if projection set to "Orthographic" you will never got such issue.

@prototype99
Copy link
Author

I assume this could be due to the wall being in the way however there seems to be no true way to hide a group

"Suppress this group's solid model" ?

ah admittedly I didn't see that

More generally, the issue you're hitting is poor Z-buffer resolution, and I don't know of any good way to solve it.

I did wonder if going through the effort of expanding every measurement to millimetres (I've been doing it in centimetres because I'm using a tape measure) would help, but then the same issue doesn't manifest on the individual models prior to assembling.

@ghost
Copy link

ghost commented Dec 23, 2019

I did wonder if going through the effort of expanding every measurement to millimetres (I've been doing it in centimetres because I'm using a tape measure) would help,

SolveSpace has no "centimeters" dimensions units; only "milimeters", "meters" or "inches".

but then the same issue doesn't manifest on the individual models prior to assembling.

You could import parts in assembly scaled (so no need remodel each part from mm to m manually)

@whitequark
Copy link
Contributor

More generally, the issue you're hitting is poor Z-buffer resolution, and I don't know of any good way to solve it.

That has nothing to do with the units or dimensions in your design--it's purely a rendering artifact that depends on the relative sizes and distances with regards to the viewport.

@prototype99
Copy link
Author

SolveSpace has no "centimeters" dimensions units; only "milimeters", "meters" or "inches".

this is true, so dimensions are technically entered at 1/10th scale

That has nothing to do with the units or dimensions in your design--it's purely a rendering artifact that depends on the relative sizes and distances with regards to the viewport.

I think I understand what you're saying. so basically the renderer internally uses relative measurements based on the largest measurement, thus it treats the zoom level as such a small fraction that errors are more likely to happen?

@whitequark whitequark changed the title camera doesn't work as expected / no option to actually hide groups Poor precision of Z-buffer May 10, 2020
@whitequark
Copy link
Contributor

so basically the renderer internally uses relative measurements based on the largest measurement, thus it treats the zoom level as such a small fraction that errors are more likely to happen?

More or less, yes. See this page, and in particular this answer.

I would classify this as a bug in SolveSpace, but not a high priority one, or one with a straightforward fix. There are a few relatively easy solutions one could try, like floating point Z-buffer (easy to add, poor hardware support, unexpectedly low payoff because of precision issues elsewhere in the rendering pipeline) and logarithmic Z-buffer (a bit more complex to add since it requires changes to shaders). Any enthusiastic graphics programmer who would like to help is welcome to look into this.

@Evil-Spirit
Copy link
Collaborator

Also, this can be projection / modelview matrix issue. not correct Znear / Zfar or loosing precision during computation.

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

No branches or pull requests

3 participants