hi, I purchased the asset 2.5D Terrain you developed.
There are amazing ideas for 2d and 2.5d game scenarios, and I’m having some trouble. Since I’m using a vertex-shaded shader, I want the model to generate a higher number of uniform meshes. This way I was able to do vertex painting.
Whether in the new development plan, it is possible to adjust the parameters of the number of generated model meshes in the three axes of xyz.
Figure 2 below is the effect diagram of the expected grid generated by me.
Hi,
thank you for using the terrain tool. I see so you want to have a mesh with uniformly distributed vertices to get some higher “resolution” for vertex painting. It’s an interesting idea yet at the moment it’s not easy to do as the tool right now does try to do quite the opposite (reduce vertices as best it can). Also you would run into trouble quickly with areas of high curvature. No quick feature I am afraid. I am currently busy with other stuff but I’ll put it on my “things to think about” list, no promises though.
However, it should be possible to do even with the current tool. From the top of my head here is how I would approach a quick solution: The asset already has the ability to add custom vertices (it’s described in the manual). You could absue this and just add a ton of them via code to increase resolution. So the steps would be:
Generate the mesh as you are doing now.
Generate a 3D mesh collider from the mesh.
Do some raycasts in a regular grid from every side and record the hit positions.
Add each recorded position as a custom vertex.
Generate again.
I think that should work, though I am not sure how performant that will be.
thanks geo
Yes, the vertex shader needs more points of “resolution”.
I will try the method you said, but my code level is very low. It can be very expensive to add points one by one.
However, I think that if you can increase the grid distribution, it is also a way to expand the various requirements of the generative model. It would be really great to have these parameters. More meshes means that you can do a lot of terrain height changes and adjustments, which is a very efficient way to build levels.
I think adding the points won’t be the main problem (it’s just a list) but am just not sure how the clipper and tesselation libs will handle this many internal points (not something I have testes). I also noticed the points method will only work for the sides. The middle part is not effected by that but it can be changed via code too.
Look into MeshMiddleSegment.cs. There you will find 4 points (p0 to p3). In between those 4 points two triangles (tri1 and tri2) are made. There you can add as many tris betwen those 4 points as you want. This would be an easy way to increase the middle resolution. The sides may be tricky though (there you would need the points I mentioned).
Here is a quick sketch showing what I mean (you could increase the subdivision of these middle patches in MeshMiddleSegment.cs). The middle is just an endless loop of these p0-p3 quads.
sorry i’m here again
Yes, I would like to increase the amount in the middle of the mesh, so that I can freely make various changes to the ground vertices.
I’ve tried to understand this part of the generative and cyclic process, and I admit I’ve failed, not knowing enough about this part.
Modified the number of segments, etc., resulting in an array error, etc.
Hi,
I have been able to take a quick look. Here is a version which at least allows you to increase the middle resolution on the z-axis. There is no UI so you will have to just change it in code, like this:
Thank you very much for the help of geo. This terrain plug-in is the best one for 2.5D in my opinion. I will study and add an adjustable parameter of zDivisions to the interface. Go and understand your improved code writing.
Now the resolution can basically be adjusted to a suitable distribution. ^-^
geo_ Hello, forgive me for asking again. The zDivisions parameter can increase the free editing of the vertex resolution requirements. Can the zDivisions parameter be added to the Terrain25D interface and become an adjustable parameter?
Hi,
I have just submitted a new version which includes this feature. I will be available withing the next couple days depending on how quick the Unity reviewers are
I have also found a small bug in the script I posted previously. It’s now updated.
When I was using ordinary uv, I found that the sampling distance of the latter segment was stretched, maybe it was my operation problem? Can geo_ verify it?
From what I see the part that is streched is not the middle segment but a front or back segment. Those always have their UVs projected along the z-axis. That’s why it looks streched.
While making the tool I had to decide whether to strech the UVs to keep them seamless or to implement a (surely flawed) alogrithm to assign UVs even to curved curfaces (that’s called unwrapping). I decided to prefer seamlessness over streching (so they are seamless but they do strech). This usually works fine if the bevels are sufficiently tilted. In your case they are very flat and thus the streching is very visible.
I know that does not help you much and I am sorry. My recommendation would be to reduce the “bevel widths” and instead increase the middle width. That way the effect if much less visible.
Maybe I can improve that in future versions but I am not sure when or if I will get to that.
As you can see this will fix it if viewed from the top but messes up the sides. If you are only interested in the top view then it may be a usable fix.
Well, I understand.
But let me show you the parameters. I am currently using the middle section to increase the width, and the front and rear sections are closed. But 1 grid behind the middle section, this grid will have uv stretching. Do you see any problem with this?
UPDATE: Okay there indeed was an error in the code. I had to fix a little more than expected.
Here is how the fixed version looks like. Notice that the tiling starts at the front and ends at the back for irregular middle widths. In previous versions the behaviour was undefined so it may have looked differently.
hi geo_, nice weekend
Looking great so far! The irregular middle width doesn’t seem to be a problem, I will try to test to see if there are other problems.
Since we need a 3D mesh BEFORE we can create a 3D Mesh collider we have to wait for the
MeshGenerator to generate one for us. That’s why the 3D collider options are part of the Mesh
Generator, not the Collider Generator.
If you enable the „Add 3D Collider “ option on the Mesh Generator (scroll way down) then you
will get a 3D collider based on the 3D mesh.
Hi geo_. Long time no see, old friend
I think I have some new ideas, because for our 2D terrain, it is likely that we need some occlusion effects such as rocks, mountains, and plants on the edge of the terrain to form a better visual depth of field experience.
Is it possible to randomly generate various elements on both sides of the middle curve, similar to these plug-ins, which can randomly generate various elements, such as rocks, mountains, and trees, at the edges of the terrain. In this way, the curved terrain can be quickly derived, and at the same time, it can also modify the rocks on the edge of the terrain, or other random elements, enriching the visual effect and natural feeling.
This is a small suggestion from me. I wonder if you are interested or might try this random element generation function?
I want to buy your 2.5D bike racing & character template with ragdoll physics and prepare to try some other physics tests
geo_ Great!
I will update the version of unity, wait a moment to test it, and try to see the parameters.
I think this way, when making some horizontal platform games, it is easy to generate various effects of depth of field vision and occlusion functions, because our terrain system is mainly developed for 2D and 2.5 users.