Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Transitioning or blending two mesh extrusions
#1
Hey, I just recently got this asset and I am still learning my way around it. 

I have a cave generation system that infinitely generates paths that intersect. I am trying to create a mesh where each path is a different spline and the paths can branch off of each other and merge. I have been trying to figure out how to take two splines with mesh extrusions and combine them seamlessly when they meet into a single spline extrusion.

I have everything set up except transitioning the paths together. Could someone point me in the right direction?
Reply
#2
Hi

This answer will only address the geometry/mesh aspect of intersections. If you are asking also about how to move objects along intersections, please do clarify this to me.

Curvy Splines does not have a feature that merges multiple extrusions (roads,tunnels, etc) in a way that handles the intersections properly. Here are some ways to work around this:

  1. Implement a custom mesh merging logic: When the Curvy Generator finishes generating, it (and the relevant modules) triggers an OnRefresh event. You can listen to that event to merge the generated meshes properly.
    I believe the proper mesh merging logic might need to use Boolean Operations. This might be helpful:
    https://stackoverflow.com/questions/5622...h-in-unity
  2. If the possible intersections are limited (for example only 90 degrees intersections), you can prepare a mesh per possible intersection, and then place those meshes at the intersections:
    • When generating your tunnels, use the Range parameter in the Shape Extrusion so that the generated tunnel does not start at the intersection position, but a little further.
    • Place the right pre-made intersection mesh in the empty space. A simple, no code method is to use a spline controller. Another method, using the API, is to use CurvySpline.Interpolate method (and GetTangent method to help orienting the mesh).

Did this help?
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
(10-07-2023, 09:17 AM)_Aka_ Wrote: This answer will only address the geometry/mesh aspect of intersections. If you are asking also about how to move objects along intersections, please do clarify this to me.

Geometry is all I need for now. The controllers you have are very straight forward and easy to use.

(10-07-2023, 09:17 AM)_Aka_ Wrote:
  1. Implement a custom mesh merging logic: When the Curvy Generator finishes generating, it (and the relevant modules) triggers an OnRefresh event. You can listen to that event to merge the generated meshes properly.
    I believe the proper mesh merging logic might need to use Boolean Operations. This might be helpful:
    https://stackoverflow.com/questions/5622...h-in-unity

The boolean operation is likely the best option and what I will go with. I am just trying to smooth the transition between the meshes. The link you provided is very helpful.

(10-07-2023, 09:17 AM)_Aka_ Wrote: 2. If the possible intersections are limited (for example only 90 degrees intersections), you can prepare a mesh per possible intersection, and then place those meshes at the intersections:
  • When generating your tunnels, use the Range parameter in the Shape Extrusion so that the generated tunnel does not start at the intersection position, but a little further.
  • Place the right pre-made intersection mesh in the empty space. A simple, no code method is to use a spline controller. Another method, using the API, is to use CurvySpline.Interpolate method (and GetTangent method to help orienting the mesh).


I can definitely do this, but I am hoping to create more than 90 degree junctions, so procedurally doing the junctions/intersections will be best. The junctions into bigger spaces don't need to be perfect, because I will likely have prefab entrance meshes that will make the transitions look a little better, but I am trying to get the meshes to transition as smoothly as possible. 

I have attached a few screen shots of the generation at a few different stages of the process. I will link a video when I get it up on youtube of the current state. I have all the "vert" positions stored for each cell of a 16x16x16 grid chunk that infinitely generates. I already have the path splines generating, placing, & extruding properly. I will be using the same methods I have already to set the verts to create custom cross shapes for different cave paths and caverns. Once I figure out the best way to transition between the meshes, I can add all sorts of variations. 

I have a junction I can generate, I am just trying to figure out how to match the meshes without gaps. One of the images I have shows the issue I am having. I can fill in the top and bottom gap fine by filling the using the splines to fill the hole between and offset the mesh up and down to match, but when I transition two splines together and have a third spline continue the path I have gaps between the cross even though they are using the same shape. I think it has something to do with rasterization, but I am not sure.


Attached Files Thumbnail(s)
                       
Reply
#4
I believe I have a solution for my generation. I will generate the mesh with overlap and use a mesh combiner to combine the sections of mesh with overlap. To get smooth transitions, I am going to have transition objects that the splines can dive into. The objects will have "slots" for spline extrusions to target. Then the mesh combiner can trim out all the verts inside and make sure it is all connected. The UVs will be an issue at some point, but... that is a problem for future me Wink

I will share my progress as things develop! Is there a good place to share that stuff? 

Here is a link to the YouTube playlist with the early prototypes.

Early Cave Generation Prototype
Reply
#5
I never dived in this subject this deep, I am discovering with you uncharted territories. Please keep us updated with your progress. This forum thread seems to me to be a good place to share said progress.
Feel free to ask questions here if needed.
Wishing you all the best with your cave system.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#6
(10-09-2023, 09:51 AM)_Aka_ Wrote: I never dived in this subject this deep, I am discovering with you uncharted territories. Please keep us updated with your progress. This forum thread seems to me to be a good place to share said progress.
Feel free to ask questions here if needed.
Wishing you all the best with your cave system.

I will do that thank you! I have the splines connecting pretty well with the Bspline unclamped and 2nd degree. I just march one space down the connecting spline so they match each other. 

It is not always seamless, but the transitions will be easy to mask. 

I am still just prototyping, but I will likely use the mesh deform for some nicer geometry and textures later on.

I am working on the cavern spline portion next. The main issue I am having is setting up multiple cross shapes for a spline to transition through. I have to turn optimization off, but when I combine multiple variable shape modules, it is quite a bit of work to get them all plugged in. It ‘works’ currently, but I have to make multiple prefabs and restrict my cavern length in control points to the number I have in each prefab. Is there an easier way to get multiple cross shapes on a spline?

I attached two quick sketches. One shows the lateral view of the spline I can create. The second is how I have to set up the curves in the variable shape modules. I am nesting multiple variable shape modifiers together and shifting their weight out. When I nest them, the right shape comes through each time when it transitions. I need to manipulate the cross at each cp, because I have a randomly generated volume that builds the cross sections of the cavern. The volume has to match the surrounding generated caves.


Attached Files Thumbnail(s)
       
Reply
#7
Hi
Sorry for the delayed answer.

(10-10-2023, 07:34 PM)SomeGuyEight Wrote: I am working on the cavern spline portion next. The main issue I am having is setting up multiple cross shapes for a spline to transition through. I have to turn optimization off, but when I combine multiple variable shape modules, it is quite a bit of work to get them all plugged in. It ‘works’ currently, but I have to make multiple prefabs and restrict my cavern length in control points to the number I have in each prefab. Is there an easier way to get multiple cross shapes on a spline?


Without using the Variable Shapes module, what you can do is to use the same shape and then apply a variable scale (see the Scale tab of the Shape Extrusion module). But then, your tunnel will have the same shape all the time, which I guess is not what you want. In this case, you can maybe process the generated mesh afterwards, to add some noise to the tunnel's mesh to simulate a rugged/varying surface.

If you want to keep using the Variable Shapes module, then know that you can make a script that can take a list of shapes as an input, and then generate/modify a generator that has all the neededed modules created and connected. The infinite track example scene has a script that updates the generator at runtime, you can take inspiration from it.
Also, maybe the shapes can be generated by a script too, instead of making them yourself into prefabs?

(10-10-2023, 07:34 PM)SomeGuyEight Wrote: I attached two quick sketches. One shows the lateral view of the spline I can create. The second is how I have to set up the curves in the variable shape modules. I am nesting multiple variable shape modifiers together and shifting their weight out. When I nest them, the right shape comes through each time when it transitions. I need to manipulate the cross at each cp, because I have a randomly generated volume that builds the cross sections of the cavern. The volume has to match the surrounding generated caves.
Not sure to understand what issue you are describing here. Can you please explain to me what is the problem this paragraph describes?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#8
No apology needed Smile I actually just checked back for the first time, so it was perfect timing lol Wink

(10-12-2023, 08:48 PM)_Aka_ Wrote: Without using the Variable Shapes module, what you can do is to use the same shape and then apply a variable scale (see the Scale tab of the Shape Extrusion module). But then, your tunnel will have the same shape all the time, which I guess is not what you want. In this case, you can maybe process the generated mesh afterwards, to add some noise to the tunnel's mesh to simulate a rugged/varying surface.

I will be processing the mesh in the end and having the same shape won’t work for my case (at least my implementation of it). The scale is really useful though. I am using it for a few transitions etc. your documentation has been very helpful.

(10-12-2023, 08:48 PM)_Aka_ Wrote: If you want to keep using the Variable Shapes module, then know that you can make a script that can take a list of shapes as an input, and then generate/modify a generator that has all the neededed modules created and connected. The infinite track example scene has a script that updates the generator at runtime, you can take inspiration from it.

I will check out the example you mentioned. That sounds like it should work.

(10-12-2023, 08:48 PM)_Aka_ Wrote: Also, maybe the shapes can be generated by a script too, instead of making them yourself into prefabs?

The shapes are generated by my script already, so i can just build the list at runtime at the same time as my current iterations. This should work!

(10-12-2023, 08:48 PM)_Aka_ Wrote: Not sure to understand what issue you are describing here. Can you please explain to me what is the problem this paragraph describes?

it will be easier to show with screen shots and examples. I will get something posted up at some point. I think I have a good direction now. I will post up my progress! I have a git repo with my scripts, but it is not updated currently. I will upload what I do and share a link here if you want to check it out!
Reply
#9
(10-13-2023, 04:04 PM)SomeGuyEight Wrote: No apology needed Smile I actually just checked back for the first time, so it was perfect timing lol Wink
Big Grin

(10-13-2023, 04:04 PM)SomeGuyEight Wrote: it will be easier to show with screen shots and examples. I will get something posted up at some point. I think I have a good direction now. I will post up my progress! I have a git repo with my scripts, but it is not updated currently. I will upload what I do and share a link here if you want to check it out!
Yes, feel free to share the link with me, either here, or if your prefer privately via PM or email.

Have a nice weekend.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Incorrect mesh alignment after extrusion on curved path Thinkurvy 10 21 04-17-2024, 10:57 AM
Last Post: _Aka_
  Adjust radius of generated mesh via script? Shackman 1 4 03-26-2024, 01:12 PM
Last Post: _Aka_
  Not seeing mesh extended after following YT PaulM 1 3 02-02-2024, 12:01 PM
Last Post: _Aka_
  Trigger Zones along Spline Mesh dlees9191 1 5 01-05-2024, 10:18 AM
Last Post: _Aka_

Forum Jump: