|
Yann, Newbie
Posted: 27 June 2015 04:46 PM Total Posts: 16
Hello!
First i’m sorry for my english and my poor skills in computer programming. I try to learn these both things during my free time
I need your help on an issue I’m working on for a long time:
I’m trying to generate some sections of tubes. I found the very complicated class (at least for me) “path extrude” and I managed implement some slight modifications to get the good rendering : A “step” for each change of scale ( see the attached picture).
As I want to change dynamically the texture (almost at each frame) I understood that it would be better to minimise the size and the amount of materials/textures. So I selected the option “cover all” and a bitmap 2 x 2048 is generated based on the distance between each point on the path.
It works fine without any change in the scale, but as soon as I set up a serie of scales along the path, one section seems to be stretched ( the red one). Why? Why only this one?
let me know if you need any additional data to give me an advice.
|
Fabrice Closier, Administrator
Posted: 27 June 2015 05:31 PM Total Posts: 1265
[ # 1 ]
yes a complicated class it is. At the time I wrote it, I’ve added probably too many options and the years after changes were done to ensure it runned with the current engine. However once you master it, it’s a powerful class.
I would need the code to see the way you define the extrusion/scales.
So I could reproduce…
If you need to update the texture per frame, and if its something that is ment to be or could be an animation, you should look a the spriteSheet animator class (there is a tutorial in the tutorials section on this website) or UVanimator could also be another option. All depends what you’re after…
|
Yann, Newbie
Posted: 27 June 2015 06:09 PM Total Posts: 16
[ # 2 ]
Thank you for your answer.
I will take a look to the spriteSheet animator class
I didn’t put the code because I’m a bit shy: As I said, I know almost nothing about the programmation and I just try to catch a part of the logical of all the classes. Finaly, everything I do is very messy. Please be indulgent
I attached the classes I use:
the “LineicPath” : Which is just the standard path class without any control node
and the “riserExtrude”: I deleted some of the options of your BIG pathExtrude class and added 2 little things :
-> In the “generate” function line 433 :the faces of the “steps” are not generated (weird code , sorry)
-> In the builExtrude function line 1077 : I duplicated the code which generate the vertex (in case of scale)
Edit: what I can’t understand is that only the red section seems stretched… feel free to ask for additional classes, I can send you everything if needed.
File Attachments
tube.zip (File Size: 9KB - Downloads: 265)
|
Yann, Newbie
Posted: 29 June 2015 01:22 PM Total Posts: 16
[ # 3 ]
Ok, I got some news,
I used a class called “WireframeMapGenerator” to see by myself how is the UVmap ( see attached “Wireframe Tube”) . It seems ok, which means that the issue comes from the additional vertex generated by the “steps” ( I don’t know if I’m clear)
I have encoded the wireframe texture to see whats going on ( you can find attached “WireframeTexture.bmp”) and we can clearly see the black spaces between each sections of pipe.
For information I have attached the colored texture I want to apply on my tube.
So finaly, I would need to generate the “steps” without any impact on the UV map… Any magic Idea?
File Attachments
|
Yann, Newbie
Posted: 29 June 2015 08:51 PM Total Posts: 16
[ # 4 ]
I DID IT!
I’m going to explain what I did if someone has the same issue ( I don’t think so, but…)
So I found out that the tube is extruded using squares ( built with 2 faces). The position of the uv along the length depends on 2 variables : v1 (starting point) and v2 (end).
These two variables depend on “vscale” which is calculated based on the TOTAL number of points : That was my issue.
I corrected the number of points to be considered and everything works fine.
It’s been a long time I’m just trying to understand this class, I finally understand it when I ask for help^^
Sorry about this bunch of useless messages.
|
Fabrice Closier, Administrator
Posted: 29 June 2015 09:27 PM Total Posts: 1265
[ # 5 ]
when you say you corrected the number of points, you mean you have changed the input or modified the class?
Glad you’ve nailed it. This class is for real men, so chapeau!
I finally understand it when I ask for help^^. aka “rubberducking”. Google it
|
Yann, Newbie
Posted: 29 June 2015 09:43 PM Total Posts: 16
[ # 6 ]
That’s it! You were my duck
I modified the class:
var uvlength:int = (points.length - 1 - nbOfStep) + offsetV;
I simply added the “-nbOfStep” which is incremented each time there is a change in the scale. That’s all… A big headache for that. I want to cry…
|
Fabrice Closier, Administrator
Posted: 29 June 2015 09:53 PM Total Posts: 1265
[ # 7 ]
Once you’re done crying, send a pict of the result!
|
Yann, Newbie
Posted: 29 June 2015 10:10 PM Total Posts: 16
[ # 8 ]
haha, here is the wonderful and colored piece of pipe.
The final aim is to render an animated pipe with dynamic gradient texture to show where is the curvature or to display other data (in live). I’m going step by step. You gave me a useful class for the texture animation, but I think animating the pipe will be tricky as well.
but that’s another story…
|
Fabrice Closier, Administrator
Posted: 30 June 2015 09:43 AM Total Posts: 1265
[ # 9 ]
if you need to animate the mesh geometry, you could try Prefab, there is a vertex animator, that allows you to generate vertex data that gets interpolated by the gpu, which is more efficient than rebuilding constantly. Within prefab, you will not be able to reproduce the shape that you need, however, once you have an animation, lets say of 3 frames, export as as3, and take a look at the way its builded for reference. You could then, in your project generate the pipe “keyframes” as you do now, and let the engine fill the gaps for the animation.
If I look at this pipe, since you want to animate it, you could also let it be a path extrude of the curve (the red part) and one cylinder geometry that you set along the path using the pathAnimator class. Using shared geometry and a simple array to generate multiple “time”, you could then animate runtime at low cost along the curve.
|