Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
issues with face over lapping and generator ranges
#1
Hello

Thanks allot for Curvy, its super amazing and robust tool it literally saved my project that i was struggling with building my own silly splines.
I have two questions that i would be very grateful if you helped me with please.

1- I'm extruding shape along spline that represent a road with two materials one for the surface and one for the side. I noticed some issues with face overlapping on some parts that contains hard hill or high mountain top . is there  a way to make the bottom vertices bellow at the same position or there is better way to solve this problem on hard corners.
I am using Bezier curve and i draw the path manually or using 1D Perlin Noise to generate it but with very sharp tops and bottoms between control points the overlapping occur. images are attached

2- I want to generate side mesh and spot game objects along the spline, the generator will use the full spline range to do so. But i needed areas not to add or spot object in them, so I added list of ignore zone ranges (min and max ranges) that I used when I add a new generator from editor script, for ex.

I have range from 0.2 to 0.5 . and i want to extrude a side mesh along the spline from 0 to 1. so here I will make two Generators with ranges. the first one is from 0.0 to 0.2 , and another one from 0.5 to 1.0. 
Any of these generator is used either for extruding a side rail, a fence, etc...  . or used to spot game objects along the range.

the issue that i am stuck at ,I am building a gizmos to visualize the ranges in scene view. I tried to Interpolate range (0.2 and 0.5f), but the positions that it show to me is some how different from when i rasterize the path and connect the rasterized path(the range is same 0.2 to 0.5) with a debug node to show the range of it.
the extrusion is shown and the rasterized path debug is exactly the same but not like Interpolation position in scene view.

I tried to make rasterized path from Code and get the data so i can take the points data and store them in a list and used gizmos to show them. but I didn't mange to do so.
is there a way to take a Curvyspline, rasterize it  and give it range and then get the data to take the positions and used it to visualize the range in scene view.

very thankful for your patience


Attached Files Thumbnail(s)
       
Reply
#2
Hi
Thanks a lot for the kind words.

2- Interpolate uses TF. Shape extrusion's range uses normalized distance, which is the distance of a point from the start of the path, divided by the path's total length. To understand more those concepts, take a look at this: https://curvyeditor.com/documentation/splines/start#units
So, use for a value x in the range paramter, you should use spline.InterpolateByDistance(x * spline.Lenght)

1- Unfortunately, all the solutions I see imply either coding from your side, or modifying your track:
  1. Avoid sharp corners. You can do that by reducing the maximal value of your noise
  2. Make the rocks layer thinner
  3. Generate only the top face (the road) of the mesh using Curvy Generator, and then generate the side face (rocks) using another method, such as the Spline To Mesh tool: https://curvyeditor.com/documentation/toolbar#tools
  4. Add a post mesh generation step, where you weld all the vertices that are in too tight corners. You can detect them by calling spline.GetNearestPointTf on their positions. All non problematic sets of vertices should have the same TF of their nearest point on a spline. Here is a drawing to better explain:
    Black line: a splineYellow lines: an extruded meshGreen and red dots: the extruded mesh's vertices, alternating colors for visibilityBlue line: line from each vertex to its nearest point on the spline    
    So in the case above, moving the two problematic vertices in the tight corner to the same position would solve the issue
I added this problem to the backlog, so I can implement a solution to it sometime in the future
Let me know what solution you think you will apply, and let me know if my explanation is not clear
Have a nice day
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#3
Man that was super helpful, thanks allot for that.

the first point is solved its now showing the correct position for ranges along the spline.

for the second point that is about overlapping, your deep explanation is fantastic you are the best. I think I will go with the third solution to generate the road as separate project and the rocks on another way. I will try spline to mesh tool. I also thinking of making custom mesh that I will build from each vertix on road edges to bottom down so i can avoid overlapping that occur with extrusion.

One last question, is there a way to iterate on the extruded mesh vertices on road edge so I can get their position, then i can use the position to generate my own custom mesh.
Reply
#4
(12-11-2020, 04:48 PM)Mos Def Wrote: you are the best.
Thank you Smile

(12-11-2020, 04:48 PM)Mos Def Wrote: One last question, is there a way to iterate on the extruded mesh vertices on road edge so I can get their position, then i can use the position to generate my own custom mesh.

The extruded mesh is made of successive shapes linked between them. All the shapes have the same number of vertices. So if your shape is rasterized into 10 vertices, then iterate on yourMesh.vertices by jumping 10 vertices at each iteration to get the same vertex on each shape
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#5
Boom this plugin still proving that no need to make any rocket science tools to do any stuff.
Spline to Mesh tool is just magic , it solved the overlapping issue.
But I was wondering can i make same thing Spline to Mesh at runtime from code.
Reply
#6
(12-12-2020, 06:53 PM)Mos Def Wrote: But I was wondering can i make same thing Spline to Mesh at runtime from code.

Yes you can. here is the code for it. I will include this code in an upcoming update:
Code:
public static Mesh SplineToMesh(CurvySpline spline)
    {
        Mesh result;

        Spline2Mesh splineToMesh = new Spline2Mesh();
        splineToMesh.Lines.Add(new SplinePolyLine(spline));
        splineToMesh.Winding = WindingRule.EvenOdd;
        splineToMesh.Apply(out result);

        if (String.IsNullOrEmpty(splineToMesh.Error) == false)
            Debug.Log(splineToMesh.Error);

        return result;
    }
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#7
Your support is outstanding , thanks a million  Big Grin
Reply
#8
You are welcome. If and when you feel like it, please leave a review for the asset, that helps a lot.
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is it possible to make the face at the end of mesh? Chanon 3 6 11-14-2024, 04:38 PM
Last Post: _Aka_
  I have to refresh generator manualy :( GameDeveloperek4123 4 13 10-07-2024, 05:36 PM
Last Post: _Aka_
  Bug: Save Generator Outputs still saves outputs if object is disabled curvymesher 1 3 08-30-2024, 09:19 AM
Last Post: _Aka_
  How can I set the generator to stop updating? emerrryjones 1 10 07-26-2024, 10:07 AM
Last Post: _Aka_

Forum Jump: