Skip to main content

cylinders from planes

Submitted by TyKeiL on
Forum

i had an idea, not sure if its been implemented yet but it goes much the same way as using a sprite to represend a sphere,,

using a rectangular plane that always faces the camera with a normal map to represent its roundness and a scrolling texture if needed.

you could represent all sorts of cylinders with this kind of technique,, ie hundreds of lamp poles in cities, tree's, etc, anything cylindrical..

if this has already been done then im behind the times,, has anyone the knowledge as to whether this is more or less ecenomical?

Submitted by redwyre on Thu, 15/07/04 - 10:15 PM Permalink

That's a pretty good idea, I haven't heard of it being used like that before, but someone else has probably thought of it :)

I'm not sure if it would be worth it though... you only need ~6 triangles to make a thin cylinder, vs the extra overhead of normal mapping and processing to work out the 4 points based off the 2 end points (which would probably need special casing, adding bloat to the pipeline).

Submitted by Daemin on Thu, 15/07/04 - 10:37 PM Permalink

It would probably be easier just to create the lamp post using ~50 polygons with a texture or two rather than making a sprite (which it is). That is on current/newish PC technology, however on the consoles this still might be a good idea, however I don't know how expensive normal/bump/displacement mapping is on them. I would imagine quite expensive on the PS2.

Submitted by TyKeiL on Fri, 16/07/04 - 9:01 AM Permalink

i would love to be goon enough to make a simple test to benchmark this,.

i guess the construction of the plane per frame would be a bit much. esp for multiple adjoining segments. even so !! i love the thought.

even if its not good computational wise i would still like to see if it has any benefits over regular cylinders, beauty wise.

Submitted by arcane on Fri, 16/07/04 - 10:37 AM Permalink

Just throwing thoughts around, but you could probably make it so you didn't have to do any re-calc per frame. Instead, you'd write a tool to pre-calc it all before hand, and store it in you map file (etc). Anyhow, if you were to create the normal and displacement maps so that the one image contained the pixel information for the full 360 degrees, you could apply it to the plane in an environment-mapping sort of way (heh, real bad explanation there).

Basically what I'm getting at, is that only a portion of the entire texture would be mapped onto the plane at one time, and this portion would differ, dependent upon the direction of the vector from the camera to the plane. That way there'd be no major per-frame calculations, and the effect could be pulled off quite effectively (I think).

Submitted by Daemin on Fri, 16/07/04 - 10:51 PM Permalink

This would only work for objects that are uniform around one or more axes, but then it would break down if we were looking at it from above or below...

Also I don't know how well it would blend from polygonal geometry to this sprite based one...

Although using a displacement mapping technique like this could be applied to make voxel type landscapes in games now I reckon. I think the game Perimiter does something like this...

Submitted by TyKeiL on Sat, 17/07/04 - 11:05 PM Permalink

you couldnt use a sprite for this as looking at it from above or below hanges the shape of the object

it would be a polygon rectangle that rotates around 1 axis so that it is always perpendicular to the viewer

there would also be the overhead of making the algorithm connect the edge vertices of a multiple segmented cylinder ie something that isnt straight like a lightpole or a torus

Submitted by WiffleCube on Mon, 13/09/04 - 8:00 AM Permalink

This is kind of similar to what Phong shading does. The reason Phong shading isn't widely
used for real-time graphics is because it's computationally expensive to recompute so many
normals; one of the reasons polygonal/boundary representations (B-Rep) are used is because
it is relatively cheap to fling them onto the screen.

Theoretically you could make a set of stairs out of a single rectangle using bump-mapping,
but it would be a lot neater and computationally cheaper to use a bunch of different sized
boxes welded together instead.

The two main things (apart from hubris and opportunities for laziness)to be at the front
of the mind of a programmer when designing algorithms are 'How much does it cost in terms
of time/storage compared to another method?'. Most algorithms courses will leave you with
these notions firmly burnt into your mind!

Posted by TyKeiL on
Forum

i had an idea, not sure if its been implemented yet but it goes much the same way as using a sprite to represend a sphere,,

using a rectangular plane that always faces the camera with a normal map to represent its roundness and a scrolling texture if needed.

you could represent all sorts of cylinders with this kind of technique,, ie hundreds of lamp poles in cities, tree's, etc, anything cylindrical..

if this has already been done then im behind the times,, has anyone the knowledge as to whether this is more or less ecenomical?


Submitted by redwyre on Thu, 15/07/04 - 10:15 PM Permalink

That's a pretty good idea, I haven't heard of it being used like that before, but someone else has probably thought of it :)

I'm not sure if it would be worth it though... you only need ~6 triangles to make a thin cylinder, vs the extra overhead of normal mapping and processing to work out the 4 points based off the 2 end points (which would probably need special casing, adding bloat to the pipeline).

Submitted by Daemin on Thu, 15/07/04 - 10:37 PM Permalink

It would probably be easier just to create the lamp post using ~50 polygons with a texture or two rather than making a sprite (which it is). That is on current/newish PC technology, however on the consoles this still might be a good idea, however I don't know how expensive normal/bump/displacement mapping is on them. I would imagine quite expensive on the PS2.

Submitted by TyKeiL on Fri, 16/07/04 - 9:01 AM Permalink

i would love to be goon enough to make a simple test to benchmark this,.

i guess the construction of the plane per frame would be a bit much. esp for multiple adjoining segments. even so !! i love the thought.

even if its not good computational wise i would still like to see if it has any benefits over regular cylinders, beauty wise.

Submitted by arcane on Fri, 16/07/04 - 10:37 AM Permalink

Just throwing thoughts around, but you could probably make it so you didn't have to do any re-calc per frame. Instead, you'd write a tool to pre-calc it all before hand, and store it in you map file (etc). Anyhow, if you were to create the normal and displacement maps so that the one image contained the pixel information for the full 360 degrees, you could apply it to the plane in an environment-mapping sort of way (heh, real bad explanation there).

Basically what I'm getting at, is that only a portion of the entire texture would be mapped onto the plane at one time, and this portion would differ, dependent upon the direction of the vector from the camera to the plane. That way there'd be no major per-frame calculations, and the effect could be pulled off quite effectively (I think).

Submitted by Daemin on Fri, 16/07/04 - 10:51 PM Permalink

This would only work for objects that are uniform around one or more axes, but then it would break down if we were looking at it from above or below...

Also I don't know how well it would blend from polygonal geometry to this sprite based one...

Although using a displacement mapping technique like this could be applied to make voxel type landscapes in games now I reckon. I think the game Perimiter does something like this...

Submitted by TyKeiL on Sat, 17/07/04 - 11:05 PM Permalink

you couldnt use a sprite for this as looking at it from above or below hanges the shape of the object

it would be a polygon rectangle that rotates around 1 axis so that it is always perpendicular to the viewer

there would also be the overhead of making the algorithm connect the edge vertices of a multiple segmented cylinder ie something that isnt straight like a lightpole or a torus

Submitted by WiffleCube on Mon, 13/09/04 - 8:00 AM Permalink

This is kind of similar to what Phong shading does. The reason Phong shading isn't widely
used for real-time graphics is because it's computationally expensive to recompute so many
normals; one of the reasons polygonal/boundary representations (B-Rep) are used is because
it is relatively cheap to fling them onto the screen.

Theoretically you could make a set of stairs out of a single rectangle using bump-mapping,
but it would be a lot neater and computationally cheaper to use a bunch of different sized
boxes welded together instead.

The two main things (apart from hubris and opportunities for laziness)to be at the front
of the mind of a programmer when designing algorithms are 'How much does it cost in terms
of time/storage compared to another method?'. Most algorithms courses will leave you with
these notions firmly burnt into your mind!