-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add engine scale parameters to specify the scales of 3D units #1851
Comments
Somewhat related, some fields in the editor round input to 2 decimal places, which makes millimeter precision impossible at the currently assumed 1 unit = 1 meter scale. I also want to say that some settings cannot follow the first option you propose: if 1 unit = 1 meter, then default gravity is 9.8 m/s², which is fine; however with 1 unit = 1 centimeter, default gravity becomes 9.8 cm/s², or 0.098 m/s², which is definitely not good. I'm also curious about the effects of other settings such as damping, for instance. And a third point, rendering (I suppose this is covered by the z-limits and etc. you mention): there is the clipping planes issue, but lighting will also be affected (falloffs and probably some other rendering settings). |
@Cykyrios As of 3.2.3 we have a problem with large minimum units. The hints of Camera clipping and Shape3D used for CollisionShape were fixed in #43547 (this was to remove the differences with CSGShapes), but there may be other hints of parameter that need to be fixed. If you need fixing them, please list them. Regarding the scaling of units, I believe that the name "engine scale" assumes that not only the scale of the object, but also physical parameters such as gravity and other physics, as well as the parameters of the renderer are properly scaled. |
I am very against having different scale options in the engine, it would complicate the engine codebase and be a complete disaster for third party addons, while really just masking the actual physics problems with the engine that cause users to want a different scale. Issues with physics not working properly at different scales are due to bugs in the physics code. Physics problems should be solved in the physics code, not in the rest of the engine. Instead, we should:
|
I think you misunderstand what this proposal is about. This proposal is not about increasing the level of precision of the physics engine. This proposal is about adjusting the level of precision to the needs of the game. At large scales, precision should be reduced for better performance. At smaller scales precision needs to be increased. This not only applies to the physics engine, but to other components as well. The problem is that third party addons, like the Bullet physics engine, don't have this flexibility. Yes, this will increase the complexity of the engine, but that is the point of good code: hide the complexity from the user. It will make things easier for the users, who are desperately trying to get things to work, adjusting the few parameters that they're able to change, but failing and getting frustrated, as the links I provided in the OP show. |
The problem is that you're not actually changing the precision level. You're just scaling everything up or down. Your proposal states "All settings are scaled by this unit representation" and how the camera, editor view, meshes, z-limits, offsets, etc would need to be scaled in accordance with this setting.
With godotengine/godot#42769 (comment), your proposal doesn't actually solve any of the things in that comment.
Let's say that this user chooses 1 unit = 1 kilometer so that the 1E5 value fits within the artificial 1024 maximum. Then they later want to make orbits 100x bigger than that. Oops, they can't because they hit the limit again, I guess they need to scale their game down again? The proper solution here would be to allow setting values above 1024.
This isn't actually an issue for the exact same reason as godotengine/godot#43547 (comment). If you have numbers around a few million units, with 32-bit floats you can expect the margin of error to be around 1 unit. If you have numbers around a few thousand units, with 32-bit floats you can expect the margin of error to be around 0.001 units. In both cases the percentage of error is the same, so scaling everything does literally nothing. If you have incredibly large numbers, the error will be "large", but that would still be very small compared to the numbers you're using. So if you scale down everything by 1000x to have a "smaller error", that error is just the same percentage of a smaller number.
If the scale was millimeters, then 0.001 would be micrometers. Or... hear me out: we should just allow users to change this value to be smaller, so that you can set 0.000001 to mean micrometers.
If small margins on small objects don't work properly in Bullet, then that's a bug with Bullet and should be fixed in Bullet. |
While I agree with the statement, in practice Bullet has a lot of hardcoded thresholds that assume units to be within a certain range. So those "bugs" may be 1) hard to fix and 2) it might take time to merge those back upstream. |
@jdumas In the future, Bullet will no longer be included with the engine, but instead will be an official plugin as stated here. Moving forward the main focus will be on Godot Physics and not on Bullet. While an official plugin implies effort made by the dev team to fix issues, at some point it can't be expected that Godot fixes the bugs in Bullet when instead the Godot devs could work on Godot Physics. Also, Bullet isn't very well maintained. It's currently maintained by one guy from |
Completely agree with all that. Looking forward to Godot Physics, this looks neat! |
Describe the project you are working on:
Working with multiple projects at different scales. See discussions at #43547, #41140, #42769, #1617, and others.
Describe the problem or limitation you are having in your project:
The engine operates at a single scale which works well when working with objects that are sized around the unit scale (think metres). However, when working with, for example, VR, the objects are sized closer to the 1/100th of a unit (think centimetres). And, when working with, for example, a space simulation, the objects can be sized in the 1000s (think kilometres) or even more.
The main problem is the physics engine always works to the same level of precision. In 3D, for example, it has a default collision margin of 0.04 (think 4cm) and a minimum of 0.001 (think 1mm) and a maximum of 10 (think 10m). This scale is generally too big when working with VR and way to small when working with space simulations. A frequently touted suggestion is to change the scale of the assets, but this doesn't work (see discussion in #43547, for example) and is shifting a problem with the physics engine onto the asset designers, who should be creating assets at the "right" scale (Blender assumes one unit is 1m, but other tools make different assumptions).
Similarly, the camera always works to the same level of precision; CSG shapes work to the same level of precision, etc.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
Have an engine scale setting. This will enable different games to set the scale of the engine according to their needs.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
Two project settings to define the scale parameters would be required:
If this enhancement will not be used often, can it be worked around with a few lines of script?:
No.
Is there a reason why this should be core and not an add-on in the asset library?:
It's the inability to workaround this issue that is driving this proposal.
The text was updated successfully, but these errors were encountered: