-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Due to #6216, If ortho() is used without arguments, drawing may fail in some cases #6621
Comments
Hey, I would like to work on this issue. |
I think it will be easier for the reviewer to help if you can provide a concrete plan on how to fix it. |
@inaridarkfox4231 I will post it as soon as possible. |
OK. But I'm not a reviewer...sorry. |
I think I didn't explain it enough, so I'll add more. The cause is that the far value of ortho() depends on the canvas size. I think you should correct this part. Changing the default value of ortho() will affect unit tests. Or there are other solutions. Eliminate this unit test and clearly state in the reference, "Do not use ortho() without arguments." This will prevent users from using ortho() with no arguments, which will prevent the bug from occurring. It would also be a good idea to provide a friendly error. Of course, you need to clearly state in the reference that eyeZ is 800. Otherwise, the user will not be able to decide how to set far value. It is up to the contributor to decide how to resolve it. My work is just to present ideas. |
@inaridarkfox4231 I tried changing the default far value and increasing it by a factor of 2. And these are the results: After Do you think this could be a possible solution to keep using ortho without arguments? |
I think it's a good idea. I am not authorized to review. Please wait for a reviewer to find it. |
I think that method will probably fail when the canvas size is small (100x100, for example), so I think another method is better. |
Currently, the eyeZ value is fixed at 800 when no camera is specified. Therefore, you could consider specifying far value much larger than 800, such as 1600 or 8000. Of course, if we specify it with the camera function, we can just set the far value accordingly, so there is no problem. The problem here is what happens when we don't use it. In that case, eyeZ will be 800, and drawing may fail in some cases. The purpose is to avoid that. |
I tried adjusting for more values, and it turns out |
I will also look into changing the eyeZ value as suggested by @inaridarkfox4231. |
I think any value is fine. I'll leave the rest to the reviewer. |
The easiest solution I can think of is to add 800 to the current value. if (far === undefined)
far = Math.max(this._renderer.width, this._renderer.height) + 800; We have long been drawing sketches in situations where eyeZ depends on the canvas size. For 100x100, we may have been written as box(50), and for 1000x1000, box(500), and so on. Therefore, it is correct that it depends on the size, but currently eyeZ is fixed at 800. So, the simplest solution is to cancel that amount by adding it up. I think we can multiply it by 8 or 10, but if they want a large value, they should specify it specifically. That's the user's job. |
Changes Made: @davepagurek What do you think? |
I think shifting the far plane by 800 works, thanks for the suggestion @inaridarkfox4231 and for testing it out @diyaayay! |
Most appropriate sub-area of p5.js?
p5.js version
1.9.0
Web browser and version
Chrome
Operating System
Windows11
Steps to reproduce this
Steps:
Snippet:
1.8.0
1.9.0
The cause is that the default settings of the camera have been changed due to #6216.
The inconsistency occurs because the default settings for ortho() are still the same as before.
I would like to wait for the solution from someone who is interested.
The text was updated successfully, but these errors were encountered: