Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shape extrusion scaling
#1
First question:
I would like to vary the width of an simple shape extrusion based upon metadate data in the Spline Path Input's CP. Like a road that changes width based upon data at CPs.

I thought I could read the spline cp and get their meta data in a before render event, then generate the curve that the Shape Extrusion Scale X Multiplier uses.

Or I could do a similar thing using the curve for the Variable Mixed Shapes curve like you do in the demo video for that Module via E27_MixingAnimator. I would not need real-time changes so could also create the curve in the Start method instead. I could have a min and max width shapes and let the curve choose the width. This would be more precise than Scale Multiplier I think.

I tried to test this second case by manually creating the curve in the graph. But it doesn't produce the results expected. It generates only one change from beginning to end of the following path. Maxing the resolution on the Path tab didn't to change it. See attached screen shot. Not sure what I'm doing wrong?
I've also attached a the scene file.
If I change the shapes from circles to rectangles with different widths (my end goal), the results make no sense to me. The extrusion doesn't wrap around the volume or show on all four sides. The sides are not parallel as if they are trying to match different order points on the rectangle. See the second screen shot.

I'd like to understand what is going on in my failed scene example even if it is not the best way to achieve my results.

What is the best way to do this? There doesn't seem to be any modules that use Metadata from Spline Path Input to control things? Or am I missing it?
To go out-of-band from the graph data flow and pass the input spline path to a Variable Mixed Shape node via a reference like you did in the E27_MixingAnimator is one possiblity. Another is to use the OnBeforeRefresh event to setup the curve. This event could be sent to a method added to the CurvySpline reference in the Spline Path Input. Are their merits to one way over the other?

Since going out-of-band from the graph's data flow seemed a bit wrong, I looked at making my own Module but got lost trying to understanding the only Metadata example you have in the CGUtilities:GetControlPointWithOptions. 
How I'd use that with a Path Input on my own Custom Module, I don't know! The Path Input doesn't seem to have the Metadata access.

Getting at the CurvySpline and using the API to access the Metadata in either of the processes I described above seems simpler. I know how to get the Metadata from the spline with the API.

Second question:
I would like to use CP metadata in the Spline Path Input to control many things (change material used, etc...) but I'm not sure how?
Do I need to have many different Spline Path Input, each with their one start and end CP range to render sub-lengths of the same reference spline path? Is this very efficient?


Attached Files Thumbnail(s)
       

.unity   ShapeExtrudeTest.unity (Size: 76.38 KB / Downloads: 2)
Reply
#2
Hi
I will take the time to read and answer you on Monday.
Until then, 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
(06-04-2022, 04:11 AM)tairoark Wrote: I thought I could read the spline cp and get their meta data in a before render event, then generate the curve that the Shape Extrusion Scale X Multiplier uses.




Or I could do a similar thing using the curve for the Variable Mixed Shapes curve like you do in the demo video for that Module via E27_MixingAnimator. I would not need real-time changes so could also create the curve in the Start method instead. I could have a min and max width shapes and let the curve choose the width. This would be more precise than Scale Multiplier I think.




Both methods are viable




(06-04-2022, 04:11 AM)tairoark Wrote: I tried to test this second case by manually creating the curve in the graph. But it doesn't produce the results expected. It generates only one change from beginning to end of the following path. Maxing the resolution on the Path tab didn't to change it. See attached screen shot. Not sure what I'm doing wrong?




It's because of the Optimize option in the shape extrusion module. Set it to off and things should work.




(06-04-2022, 04:11 AM)tairoark Wrote: If I change the shapes from circles to rectangles with different widths (my end goal), the results make no sense to me. The extrusion doesn't wrap around the volume or show on all four sides. The sides are not parallel as if they are trying to match different order points on the rectangle. See the second screen shot.




It's because the first CP of both shapes are not on the same side. Please use this to change the first CP.

PS: you can also simply rotate the spline so that the first CPs (meaning CP0000) of both splines are aligned




(06-04-2022, 04:11 AM)tairoark Wrote: I'd like to understand what is going on in my failed scene example even if it is not the best way to achieve my results.


I updated your scene with all the steps I explained above



(06-04-2022, 04:11 AM)tairoark Wrote: There doesn't seem to be any modules that use Metadata from Spline Path Input to control things? Or am I missing it?



The Input Spline Shape module for uses the Meta CG Options component to compute the U coordinate of the shape's points



(06-04-2022, 04:11 AM)tairoark Wrote: Another is to use the OnBeforeRefresh event to setup the curve. This event could be sent to a method added to the CurvySpline reference in the Spline Path Input. Are their merits to one way over the other?



This method suffers from the issue discussed here:

https://forum.curvyeditor.com/thread-1436.html




(06-04-2022, 04:11 AM)tairoark Wrote: Since going out-of-band from the graph's data flow seemed a bit wrong, I looked at making my own Module but got lost trying to understanding the only Metadata example you have in the CGUtilities:GetControlPointWithOptions. 

Yeah, that one is complicated to understand Sad




(06-04-2022, 04:11 AM)tairoark Wrote: How I'd use that with a Path Input on my own Custom Module, I don't know! The Path Input doesn't seem to have the Metadata access.


The Path Input module outputs a path, which is not a spline, but a path (a set of points that approximate the spline). This set of points is also referred to as rasterized spline. The rasterized spline has no meta data. So if you need a module that has access to meta data, you need that module to have access to the spline directly.



(06-04-2022, 04:11 AM)tairoark Wrote: Getting at the CurvySpline and using the API to access the Metadata in either of the processes I described above seems simpler. I know how to get the Metadata from the spline with the API.



That's what I would recommend.




My answer to the second question in the next post.


Attached Files
.unity   ShapeExtrudeTest.unity (Size: 64.65 KB / Downloads: 1)
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#4
(06-04-2022, 04:11 AM)tairoark Wrote: Second question:
I would like to use CP metadata in the Spline Path Input to control many things (change material used, etc...) but I'm not sure how?
Do I need to have many different Spline Path Input, each with their one start and end CP range to render sub-lengths of the same reference spline path? Is this very efficient?

There are two solutions I see:

The heavy one, which I do not recommend, which is having an input path module that reads the meta data, and stores the relevant data in the path data (class name: CGPath) that is transmitted to the next module, and then having a custom shape extrusion module that will read that data and creates different volumes with different materials accordingly.

The light one, that I do recommend, which is to have a script that reads the meta data of the spline, and setup for each let's call it material section, to setup a shape extrusion graph, as you said using the start/end CP, or the Range parameter in the Shape Extrusion module, to make a separate shape extrusion for each material

I hope this helped
Please let me know if you need further explanation.
If and when you feel like it, please leave a review for the asset, that helps a lot.
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
#5
(06-06-2022, 06:06 AM)_Aka_ Wrote:
(06-04-2022, 04:11 AM)tairoark Wrote: Second question:
I would like to use CP metadata in the Spline Path Input to control many things (change material used, etc...) but I'm not sure how?
Do I need to have many different Spline Path Input, each with their one start and end CP range to render sub-lengths of the same reference spline path? Is this very efficient?

There are two solutions I see:

The heavy one, which I do not recommend, which is having an input path module that reads the meta data, and stores the relevant data in the path data (class name: CGPath) that is transmitted to the next module, and then having a custom shape extrusion module that will read that data and creates different volumes with different materials accordingly.

The light one, that I do recommend, which is to have a script that reads the meta data of the spline, and setup for each let's call it material section, to setup a shape extrusion graph, as you said using the start/end CP, or the Range parameter in the Shape Extrusion module, to make a separate shape extrusion for each material

I hope this helped
Please let me know if you need further explanation.
If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day

OK. I will only consider the "Light" solution.

But I am not sure exactly the approach you are suggesting?
Are you suggesting:
A) I make separate CG for each range of the spline that has different attributes, or
B) Make one CG but have non-connected graphs within this CG that generate unique extrusions per range?

It seems like A) would be easier as I wouldn't have to construct the graph on the fly and the Input are explicit to set the Shape on.
Can "Templates" be used for this? (I haven't looked into them yet)

B) Might have to all be done with programmatic creation of the whole sub-graph in code like you do in the InfiniteTrack example? Or can Template also be use to load each sub-graph for processing a range with unique attributes?

So for efficiency sake, which is better: A) many CG's or B) many sub-graphs within one CG?




 
To clarify further, I'm trying to do two different things which may confuse my explanation:
1) Change 'shapes' at CPs
2) Change 'materials' at CPs

These may require different techniques to be done efficiently?

From our discussions on the other thread, changing 'shapes' can be done in a single CG by programing the Curve of the Variable Mixed Shapes (as long as Optimize of Shape Extrusion is off AND the first CP of all the shapes are aligned (thank you for this fix)). This is straight forward for me to do I think. No separate CG or sub-graphs with different ranges needed.

It would be nice to do the same with materials. In your reply on the other thread you also said, "The Input Spline Shape module for uses the Meta CG Options component to compute the U coordinate of the shape's points"  The Input Spline Shape can change the materials along its spline (the railroad track example) with Meta CG Options.  Can an Input Spline Path be made to do the same? This is solution that would be simple without having to resort to multiple CG's or sub-graphs.


Thanks for your quick relies and help in this matter so we can finalize the architecture using Curvy.

Any idea what technique the Audi Quattro Coaster used?
Reply
#6
Hi

(06-06-2022, 07:10 PM)tairoark Wrote: OK. I will only consider the "Light" solution.


But I am not sure exactly the approach you are suggesting?

Are you suggesting:

A) I make separate CG for each range of the spline that has different attributes, or

B) Make one CG but have non-connected graphs within this CG that generate unique extrusions per range?



It seems like A) would be easier as I wouldn't have to construct the graph on the fly and the Input are explicit to set the Shape on.

Can "Templates" be used for this? (I haven't looked into them yet)



B) Might have to all be done with programmatic creation of the whole sub-graph in code like you do in the InfiniteTrack example? Or can Template also be use to load each sub-graph for processing a range with unique attributes?



So for efficiency sake, which is better: A) many CG's or B) many sub-graphs within one CG?




Solution A is the simpler to set up, whether you use tempaltes or not. Their is no real performance difference between both solutions. You can use CGEditorUtility.LoadTemplate to load tempaltes via the API, but this is an editor only method.

 
(06-06-2022, 07:10 PM)tairoark Wrote: To clarify further, I'm trying to do two different things which may confuse my explanation:

1) Change 'shapes' at CPs

2) Change 'materials' at CPs



These may require different techniques to be done efficiently?



From our discussions on the other thread, changing 'shapes' can be done in a single CG by programing the Curve of the Variable Mixed Shapes (as long as Optimize of Shape Extrusion is off AND the first CP of all the shapes are aligned (thank you for this fix)). This is straight forward for me to do I think. No separate CG or sub-graphs with different ranges needed.



It would be nice to do the same with materials. In your reply on the other thread you also said, "The Input Spline Shape module for uses the Meta CG Options component to compute the U coordinate of the shape's points"  The Input Spline Shape can change the materials along its spline (the railroad track example) with Meta CG Options.  Can an Input Spline Path be made to do the same? This is solution that would be simple without having to resort to multiple CG's or sub-graphs.




Thanks for your quick relies and help in this matter so we can finalize the architecture using Curvy.

Change of materials/UV coordinates are implemented only for extrusion shapes. There is no equivalent for extrusions paths, thus the need to have a separate extrusion for each variation in materials along the extrusion path.
Making an equivalent feature for extrusion paths is already listed as a wanted feature, but no short term plans have been made to implement them yet.

(06-06-2022, 07:10 PM)tairoark Wrote: Any idea what technique the Audi Quattro Coaster used?


No, sorry.

Let me know if I missed some of your questions.
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


Possibly Related Threads…
Thread Author Replies Views Last Post
Bug Extrusion and scale curve issues Sacryn 3 7 04-08-2022, 12:30 PM
Last Post: _Aka_
Bug Shape Extrusion does not align with Input Spline Shape bit9labs 1 3 04-08-2022, 12:27 PM
Last Post: _Aka_
  Mesh Deformation vs Mesh extrusion Mambosa 6 20 03-04-2022, 04:43 PM
Last Post: Mambosa
  Problem with combining shape extrusion and DistanceToTF kazlik 3 3 01-08-2022, 11:53 AM
Last Post: _Aka_

Forum Jump: