-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
New CSG Polygon bugs introduced by "Fix multiple issues with CSGPolygon #49314" #52179
Comments
cc @madmiraal |
As mentioned in #49314, there are some compatibility breaking changes that need to be mentioned in the release notes. The changes are by design and were explained and discussed in the original
Maybe I'm missing something, but this wasn't changed. It does and always did use fixed steps along the length of the curve using
In To prevent the UV mapping from simply repeating on each end and each extrusion (#23257), the UV mapping for the entire
A minimum of 0.1 and a step size of 0.05 seemed reasonable for making adjustments in the editor, while keeping the number of polygons at a reasonable number. Since path_interval simply sub-divides each extrusion without adding fidelity, if a user wants to increase the number of extrusions, I expected the preferred approach to be to increase the number of points on the curve and leave path_interval at 1. That been said, this is just a limitation in the editor. The user can always set the path interval to any value between (0:1] in code using |
Old behavior: New behavior: The problem with this behavior is that, if I want to have a consistent spacing (ex: every .3m) of my geometry, I have to do a bunch of calculations instead of just setting the interval once. Also, any time I tweak the curve, I have to update these calculations, and even when calculated, it won't be exact,
Yeah, that's what I figured. It's probably a good change. The only down side is that you can end up with a seam since the texture won't tile in the middle. Also, could waste texture memory if you don't have the caps visible (ex: pipes). Might be worth adding an option for.
Since it's based on a subdivision of the curve, it's difficult to say what a good value is. If I have a 100m curve, I might need 0.001, but that would be really small for shorter curves. I now understand why you have the interval set up the way you do (since some people probably want a 1:1 polygon with the number of points added). Perhaps the solution here is to have an interval type: distance vs subdivisions, that way those of us who need to do distance-based things like cables with UVs that repeat at a certain length can use the distance-based one, and people using CSG for other stuff can use that. Also, I'm using this all in-editor for environment work, so setting those values via code doesn't work well. |
I need to change the interval to minimum of 0.01 and a step of 0.01 for my new pull request of that: In this small video, I show the difference between minimum of 0.1 and a step size of 0.05 VS minimum of 0.01 and a step of 0.01 Interpolation-Path_intervale_Demo.05.vs.01_5fps_video.mp4Without my new feature, I prefer give us more option with the Editor. 0.1 as minimum is not appropriate when you want modify the angle in the path. 2.3.4-2021-08-31_20.08.38.mp4 |
Yes, the calculation for the number of extrusions required was changed to depend on the number of points on the curve and not the length of the curve, which didn't make sense. The number of polygons shouldn't be dependent on the distance. It should be dependent on the number of points on the curve. Increasing the number of polygons without increasing the fidelity of the shape creates unnecessary polygons and vice versa. I notice, however, that the formula is undercounting by 1, so that needs to be fixed. Ideally, the size of each of the polygons should be dependent on the distance between the curve's points (and The challenge you're facing is wanting the UV mapping to repeat by distance, which is a different issue. I don't even know how you would do this in Blender. It would, as you suggest, require calculating the repeating interval based on the length of the curve.
and
In games you want low polys to reduce the rendering time. Instead smooth shading is used to hide the corners. Note: a setting or 0.01 would create 100 x 2 x |
I'm working on a change to address several of the issues I have as well as adding some more flexibility:
I'm trying to keep the changes minimal, but the PoolVector is problematic, because the Write needs to go out of scope before the array can be resized (needs to be resized to reduce the poly count), but that would mean putting a large scope around everything... I don't suppose there's any other way? I know 4.x is going away from the PoolVector. Should we even be using a PoolVector here? |
@jitspoe Spoke too soon, helps if I start the correct version of Godot... to be continued... :) |
What's your UV distance set to? I thought that defaulted to 1, which should have the same behavior as the old CSG (tiles at 1m). (Note: Will most likely be changing this to path_u_distance instead of uv_distance). |
@jitspoe testing now with the proper build, path interval is working beautifully with interval type set to distance. UV distance is working but it is now working for both U and V, and that is a problem in my use case because it's nearly impossibly to get the road texture to line up properly with the road. We almost need separate options for U and V. Love the angle simplify btw, I think I applied a similar approach in my procmesh library, which I'm really starting to feel I should revive. |
Separate options for U and V should be a thing either way - I bet there's a ton of use cases that need them. |
The thing is, you're only extruding along one, so it might just lead to overkill to have too many choices. I think the current state with the changes Jitspoe added will cover the needs of most if not all. I would be against making further changes until someone comes up with a valid use case. |
That's strange. It should only apply along the length of the curve (U). I renamed it to path_u_distance in master since it only applies to the U. |
Yup, I drew the wrong conclusion, what you said I think in your reaction on your PR was spot on. I've got 4 sections in my polygon and it's using half of the texture width to make room for the end caps, so each section is 0.125 in length. * 8 makes the V go from 0 to 1.0, it's unaffected by the |
Godot version
3.4 beta 4
System information
Windows 10, GLES3
Issue description
Regarding #49314 I have run into a few issues.
Interval is now a fraction of the entire length of the curve (???)* rather than a distance, meaning long curves behave different from short curves with the same settings as far as polygon density goes. This worked better as a distance in meters and was consistent with the curve bake interval. *Not sure if it's actually a fraction, because .1 seems like it would be broken into 10ths, but there are more than 10 segments, and sometimes a value of 1 has more than 1 segment.
Can't get the UV's to behave the same as before. The UV behavior is probably better... mostly, but still has oddities.
Before:
After:
On the plus side, it tries to wrap the texture around. On the minus side, it seems to only use 1/2 of the texture:
I would expect this to wrap around entirely so I could have a tiled pipe texture or something. Maybe it's because the other half of the texture is reserved for the caps? Wonder if that should be an option.
Also, the texture coverage doesn't take the size of the polygon into account, so a really small face uses the same amount of texture as a really large one:
Also, it looks like the UV's reset to 0 for each segment, which works OK for static textures, but not for custom shaders (ex: a pulse that flows across a cable). And, since the segment length is a fraction of the total curve, the overall texture coverage, and thus timing of pulses and other shader effects, don't cover a set distance using the UV's like it used to.
Limit of .1 for the interval is insufficient for long curves.
Pretty self-explanatory. I need more detail for my long cables! I actually had an engine modification to simplify based on the curve angle which I need to make a pull request for (after I update it to match the new code).
Steps to reproduce
Make a really long path and try to make the CSG geometry follow it and look good. :)
Minimal reproduction project
test_csg_path_3.4b4.zip
test_csg_path_3.3.3.zip
The text was updated successfully, but these errors were encountered: