x


Creating a mesh out of a linerenderer - how do you convert revolved vertices set to triangles and uv's

Suppose you draw a line using linerenderer (and also have an array of points) - how do you turn that into a mesh?

To elaborate on my question... As I understand, you will need triangles and uv's - not just vertices...

So, suppose you rotate about a circle each of the points on the 1-d line along its local y (or z axis), the one perpendicular to the plane of the line. How do you convert these to triangles and uv's?

The pictorial equivalent is a lathe - which starts out as a 1-d line in a plane, which you simply rotate about a circle in the perpendicular direction:

lathe

So, in sum:

  • I know how to generate the vertices.
  • I am not sure how to generate the triangles - are they simply, count the vertices from 0?
  • I am not sure how to generate the UV's - conformal mapping of the 3d mesh to a plane?--
more ▼

asked Jan 01 '11 at 03:23 AM

ina gravatar image

ina
3.4k 500 554 616

What is it that you need to do, which cannot be done with a Line Renderer, but is similar enough that you referenced it? You can certainly recreate what the Line Renderer does, but that would be pointless, unless it is limiting you somehow.

I don't understand your last paragraph; a diagram would probably help.

Jan 01 '11 at 08:18 AM Jessy

updated w pic and summary

Jan 02 '11 at 03:45 AM ina

Why are you using the terms "1D line"? That's a segmented curve, not a line, and it is clearly exists in two dimensions. I understand that you want to revolve a curve, not a shape that exists in a plane, but calling it 1D is poor wording. Additionally, you are never extruding vertices perpendicular to the plane that anything is in; that's the definition of a circle/lathe.

Jan 02 '11 at 05:20 AM Jessy

sorry, it's a 1d curve from math (parametrically, at least - an object moving on the line only has one degree of freedom), but it might be called something else in other parlance

Jan 02 '11 at 05:23 AM ina

no extrusion.. never mentioned extrusion... the rotation is along an axis perpendicular to the plane of the line

Jan 02 '11 at 05:29 AM ina
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You cannot read data from a Line Renderer, so a direct conversion is impossible, without copying and pasting in the Editor.

Edit: Now that you've altered your question, check here. Using "LineRenderer" in the title is misleading; this has nothing to do with Line Renderers. A "lathe" is indeed what you should be asking about.

As for UVs, who knows what you want to do with that. Trying to texture something like this, in a non-abstract way, without actually using a modeling program, will be ridiculous.

more ▼

answered Jan 01 '11 at 08:16 AM

Jessy gravatar image

Jessy
15.7k 72 95 198

Well you would also have an array of points (convertible to vertices) - the line renderer simply renders the array of points.

Jan 02 '11 at 03:26 AM ina

Who says? There's no requirement to keep the array around. If you were to just populate it in the Editor, you'd have no way of accessing that data, again, other than copy and paste for every Vector component. I don't understand the logic of exposing that array in the Editor, when you can't alter it programmatically, but that's how it is for the time being?

Jan 02 '11 at 05:01 AM Jessy

Well, you don't have to expose that points array - it could be a private global var.. Anyway your S/O link is totally useless... As mentioned in the bullet points, I know how to generate the vertices (which are just points rotated in a circle), I'm just not sure how to turn a bunch of vertex points into a mesh.

Jan 02 '11 at 05:31 AM ina

If you have all the vertices you need, then just connect them: http://unity3d.com/support/documentation/ScriptReference/Mesh-triangles.html

Jan 02 '11 at 06:19 AM Jessy
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1403
x307
x141
x124
x110

asked: Jan 01 '11 at 03:23 AM

Seen: 2011 times

Last Updated: Jan 02 '11 at 03:45 AM