-
Lifetime Friend of Site Staff
cylinder mapping
I'm wondering if anyone can point me at some resources for doing cylinder mapping in AS2? I need something that can put a cylindrical pano on the inside of a cube (or cylinder) and allow it to be viewed as if in 3D. Ideally I'd like to find a product that can do this, but if it's part of some 3D engine or framework I can work with that too. Must be AS2 though, that's the only constraint. I know it's a biggie but it has to integrate with an existing codebase. Thanks for any tips/pointers!
When your swf2exe tool just HAS to work
there's only one choice... SWF Studio
-
Senior Member
Does it need to be in 3d? I don't get why you just can't pan the image left and right and then duplicate it at the seem. If the image is too big you can cut it into vertical slits.
Mapping a rectangle around a cylinder and then standing in the middle of it is no different than just panning the image.
-
Lifetime Friend of Site Staff
Mapping a rectangle around a cylinder and then standing in the middle of it is no different than just panning the image.
Agreed. That's why I asked about mapping a cylindrical pano image onto a cylinder in 3D. The difference is perspective. With a flat image you don't have any. If you try and display the "warped" image without adjusting for the perspective then it just looks like crap.
When your swf2exe tool just HAS to work
there's only one choice... SWF Studio
-
Pumpkin Carving 2008
It sounds like you need some application of a DisplacementMapFilter. Wasn't something I could really grasp the concept of when I asked it (searching the forums would have got you this small bit of help). Best of luck. If you get something working, let me know. I've always wanted to get my hands on cylindrical DMF.
The 'Boose':
ASUS Sabertooth P67 TUF
Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
8GB G.Skill Ripjaws 1600 DDR3
ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
New addition: OCZ Vertex 240GB SATA III SSD
WEI Score: 7.6
-
Senior Member
A cylindrical filter should just be a mirrored sin gradient, like:
Actionscript Code:
stop(); import flash.display.BitmapData; cylinderFilter = function(r:Number, h:Number){ //r is the cylinder radius, half the width of the final bitmap var filterBMD:BitmapData = new BitmapData(2*r, h, false, 0x000000); for(var x = -r; x <= r; x++){ var angRad:Number = Math.asin(x/r); var disp:Number = (1 - Math.cos(angRad)); var colordelta:Number = 128 * disp; var red:Number = 0; var green:Number = 0; var blue:Number = 0; if (x > 0) {colordelta = -colordelta;} blue = 128 + colordelta; for(var y = 0; y <= h; y++){ filterBMD.setPixel(x + r, y, (red << 16 | green << 8 | blue)); } } return filterBMD; }
var cylmc:MovieClip = _root.createEmptyMovieClip("cylmc", _root.getNextHighestDepth()); cylmc.attachBitmap(cylinderFilter(50, 200),10);
The second part of mapping to a cylinder is getting the displacement amount right when you apply the filter.
The map above goes from 0 to 255 blue value, but you only want your pixels to shift a max of 1/4 circumference - radius, or arclength - projected length.
For northcode, this displacement map will be too much pinching on the edges I think. You want to view a portion of the cylinder I think, so basically make your filter a little wider than your screen and give it a try.
In AS2, full screen displacement map filters are somewhat of a processor hog, not sure if AS3 improves this much. I would hope so, since bitmap manipulations was one of the big improvements in as3.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|