-
Notifications
You must be signed in to change notification settings - Fork 127
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
Implements vertex spacing (mesh density) #296
Conversation
If this doesn't scale the overall terrain size, then it means 1px != 1 vertex, and we're losing detail. If mesh resolution increases to 2, then a 1024px means 2048m. If this only changes the mesh but not the overall size then we're paying for 1024 memory, but only using 25% of it. 75% waste is not good. I think it should scale the mesh in the shader to match. Also I don't see it changing the collision shape at all. Turn on debug collision so you can see it. It needs to be pixel perfect. |
Where is the option at? i built it from source, with your branch and it doesn´t seem to appear neither in the mesh or the renderer section. |
Rendering and editor are now scaled. Navigation and collision todo. |
Navigation and collision should now work too. Let me know if anything is still missing. Note: for larger vertex spacing the user may need to increase NavMesh resource cell size. |
It's in the mesh section, under LOD and size. Make sure you replace the right files in your project and restart Godot. |
Tested ( now after finally being able to make it build after fail and error) and it works as expected, the terrain m scales by it double when changing from for instance, 1 to 2, even with multiple regions it seem´s to work well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this. I tested it and it works well with collision, navigation, and occlusion. Good job so far! This is a highly requested feature. Here are some issues I found.
-
The cursor decal disappears at some angles and heights, and the current tool doesn't work or is offset from the decal at different angles and locations. I tested and found these issues with both 0.5 and 2.0. Use the height brush on the demo and you'll see it disappear above a certain height. Rotate the camera around and add new regions to see it.
-
Please explain in detail the changes you made to the shader.
-
The normals are off. The first image here has a directional light facing directly down. Here the mesh has a scale of 1.
Here is a different section where the mesh is scaled at 10. I sculpted it to have a similar height and slope as the other. With the light straight down it should look like the above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issues should be fixed now. Please take a look.
@@ -61,9 +63,11 @@ struct Material { | |||
}; | |||
|
|||
varying vec3 v_vertex; // World coordinate vertex location | |||
varying vec3 v_camera_pos; | |||
varying flat vec3 v_camera_pos; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this flat?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it not? Does view space to world space transform matrix change per vertex?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't really familiar with it. I see it disables interpolation, not truncates to integer, which is what it sounds like. So why not also make v_vertex and v_vertex_dist flat also? All of the varyings we're using currently are there to provide fixed vertex data. I see no visual or performance difference when I try it, but it's good to be explicit.
Thanks for fixing the highlighted issues. Please address the individual inline notes I mentioned, as well the following and I'll merge it in:
|
Ok, found a few more errors.
paintbrush.gap.mp4
|
These don't seem introduced by this PR.
See the reproductions on These issues should be addressed elsewhere. A real issue though is the slope decals are at wrong locations. I fixed them. |
37ebfb7
to
a8d0ee4
Compare
The slope sculpting was still broken due to mouse_global_position.y also being scaled when it shouldn't have been. That's now fixed. I also made all of the varyings flat. The mouse cursor jump can be addressed in #121. This is ready to go. Great work. Thank you! |
Thanks! |
Admin edit:
Fixes #131
Fixes #137
Implements #131.
Opted for naming "vertex spacing" because it has the least ambiguity.