PDA

View Full Version : Wrapping around a cylindrical surface.



Memoid
07-22-2008, 09:03 PM
Hi all, I'm writing an app which has a very wide aspect ratio of 8:1 (3840x480). This will be projected onto the outside of a large (6m diameter) cylindrical projection surface (viewers will view from outside the cylinder).

My scene is 3D with a fixed camera (pointing along Z as default). I have objects (very long snakelike physical objects made up of lots of springs) moving around in 3D. And I would like to give the illusion that the cylindrical projection surface is a real cylinder, with things moving inside it.

My main problem is that of perspective. I think I need a vanishing point for every x position, i.e. a vanishing line (which runs horizontally down the middle of my viewport). Is this even possible to do? And if so how would I do it? I'm guessing its with glFrustum (usually I just use gluPerspective), but I'm not sure how to set it up!

My second problem is that of wrapping the objects around when they cross the left or the right edge. I'm hoping that once the first problem is solved, this should just be a simple 2D check of object.x against my viewport boundaries and moving the object by screenWidth in 3D space. One other concern I have is how to deal with situations when half the object is on one side, and the other half on the other side - so I was thinking I could render the object twice if its near the edge (once normally, and once offset by screenWidth). Is there a better way to deal with this?

T101
07-23-2008, 04:12 AM
I don't think you'll need to use glFrustum, but you will need multiple viewports.

You either have some sort of cylindrical LCD screen or you have projectors that beam their images onto a cylinder.

In case of projectors, those are basically 2D (the light passes through a tiny 2D display).
An observer at an angle close to that of the projector would pretty much see the same as someone watching using a normal display screen.
If you can prevent multiple projectors from projecting visible images for people too far away from their own angle to the screen, there won't be much distortion, but more projectors is always better.
I don't think you can really compensate for stretching on acute angles by changing the '2D' source image, but if you keep the projectors' FOV narrow there won't be much stretching going on.
Since the projectors would need separate images to display, that's a simple multiple monitor solution, one viewpoint each.
You might be able to use a single GPU with multiple viewports, but you'd have to accurately mask off and aim those projectors.

If you're not using projectors but some sort of actual cylindrical display device, I think you're in for a world of trouble, since the display can show only a single view for all the observers, which means the image will be warped for some.

I don't understand your second issue. You have 3D objects moving in 3D space. OpenGL does the projection for you. There is no 2D "left" or "right" edge to worry about. Perhaps your "snakes" eventually move out of the virtual cylinder and you want to undertake action when that happens, but that seems like a simple distance check.
You'll have a problem trying to let snakes swim out of the cylinder and back in on the opposite side, since you have an infinite number of sides. You can use user clipping planes, but the number of clipping planes is limited.
Perhaps you can render the snakes with a fragment shader to KIL any fragment that falls outside the virtual cylinder.

I would put the center of the virtual cylinder at 0,0,0 and place the projectors (whether real projectors or cameras for the individual viewports) in a circle around it. That will keep your movement math simple.

Relic
07-23-2008, 04:25 AM
"If you're not using projectors but some sort of actual cylindrical display device, I think you're in for a world of trouble, since the display can show only a single view for all the observers, which means the image will be warped for some."

You can render with as many different viewports and projections on that single display as you want.

Anyway, with multiple observers (two on opposite sides of the cylinder would still work, but >2 never) it's impossible to achieve your goal to let the display look as if there are objects moving *inside* the cylinder's 3D space for everyone.

To give that impression you would need to project the image *corrected to the viewing frustum of the individual outside observer*, this is not possible with only a single surface for multiple observers and overlapping viewing frustums.

Still the display itself sounds like a lot of fun. Would be totally cool to sit inside and have a 360 degree sourround rendering. ;)

ZbuffeR
07-23-2008, 05:27 AM
A cylindrical projection is non-linear, so impossible to do with the classic projection matrices.

I think a good way to handle this is to render 4 classic views, each to a separate texture (ideally a cubemap, but not sure it is supported). One view for each direction : north, south, east, west.
Then draw a fullscreen quad (3840x480) with a special shader that sample the data from one of the 4 textures, depending the X screen position, and with proper "cylindrisation" of the coordinates.

Just stumble upon this, it may help : in your case, only the x coordintates have to be tweaked.
http://idea.hosting.lv/a/gfx/

T101
07-23-2008, 06:51 AM
To give that impression you would need to project the image *corrected to the viewing frustum of the individual outside observer*, this is not possible with only a single surface for multiple observers and overlapping viewing frustums.

I suppose that's a bit clearer than the way I stated it.



Still the display itself sounds like a lot of fun. Would be totally cool to sit inside and have a 360 degree sourround rendering. ;)
The way I read it, people will not be inside the cylinder but outside it.
Sounds more like a large sort of cylindrical aquarium that people presumably can walk around.
Would IMO be even cooler, but logistically difficult - you don't want people to obscure the beams in case of projectors, and you won't get that freedom of movement with a single cylindrical display device.
I guess there would be a ring of projectors on the floor or on the ceiling, and people would stay outside that ring.

Which actually made me think of something. I guess by layering transparent OLED displays with rasters sandwiched in between, you could get more than one display located at the same point of the cylinder with only one visible from any viewpoint.
You'd have to draw it to work out the necessary spacing, but it might work. Obviously not cheap to do though, for a 6m wide cylinder.
I seem to remember reading about a company that used something like that to give you 3D display on an otherwise 2D screen. It used an LCD with twice the horizontal resolution and a raster in front of the screen to mask off the odd/even pixels for the left/right eye.

Relic
07-25-2008, 08:21 AM
The way I read it, people will not be inside the cylinder but outside it.
Yes, I know or I had answered differently. Just imagine how it looks from the inside. Uhm, full of electronic equipment (see below). ;)
[quote] I guess there would be a ring of projectors on the floor or on the ceiling, and people would stay outside that ring./quote]
I'd imagined that with back projection screens, putting the projectors inside the 6m diameter cylinder. There should be plenty of space.