|
Choons, Sr. Member
Posted: 27 July 2011 07:05 PM Total Posts: 281
Hi guys,
I’ve been tasked with trying to use a vector texture on a material in 3.6. The client says he thinks MovieMaterial can load a vector graphic. If so, does it remain a scalable vector graphic or is it converted to a bitmap?
I have to be able to load the vector graphic into Flash dynamically using actionscript so I am looking at using this library to load in an SVG
http://code.google.com/p/as3svgrendererlib/
am I on the right path here? Is it possible to get a vector graphic on material in 3.6? thanks for any help/advice on this
|
|
Choons, Sr. Member
Posted: 27 July 2011 08:16 PM Total Posts: 281
[ # 2 ]
righteous. Thanks so much, Darcey. Haven’t seen you post about any new demos on AFTC lately. Miss those exceptional demos ; )
|
Darcey, Moderator
Posted: 27 July 2011 08:23 PM Total Posts: 209
[ # 3 ]
Ye, I’m kind of missing my article writing… My work load for the past few months and the next few months is insane.
I can’t wait to get writing for Away 3D 4 and FP11
|
Choons, Sr. Member
Posted: 27 July 2011 08:31 PM Total Posts: 281
[ # 4 ]
good problem to have, but yeah my just having fun with Away3D has turned into tight deadlines and lots of coffee. Side note - I have LLoyd’s in my family tree. Maybe we’re distant cousins
|
Darcey, Moderator
Posted: 27 July 2011 08:36 PM Total Posts: 209
[ # 5 ]
Away3D bring us all together :p lol
|
Choons, Sr. Member
Posted: 27 July 2011 08:56 PM Total Posts: 281
[ # 6 ]
looking at Li’s example. Can that vector graphic be applied on a material? Looks like he just adds the graphic to the scene.
|
Darcey, Moderator
Posted: 27 July 2011 09:01 PM Total Posts: 209
[ # 7 ]
Ah, not gone done the route of using the vector as a texture for a primitive or model but I would expect that it can be done via:
1. Grab vector asset via wu media and attach it to a movieclip or sprite and apply it to one of the Away3D materials. Add to MovieMaterial or one of the Sprites.
|
Choons, Sr. Member
Posted: 27 July 2011 09:07 PM Total Posts: 281
[ # 8 ]
ah yeah. I see MovieMaterial’s type is Sprite. I’ll give that shot and report back if it works. thanks again
|
Choons, Sr. Member
Posted: 28 July 2011 08:23 AM Total Posts: 281
[ # 9 ]
well I did manage to get wumedia’s VectorShapes to parse in a swf that contains vector graphics and draw them into a Sprite. That worked great but it appears that putting the sprite with vector graphics into MovieMaterial converts the vector graphics to bitmaps. So I just went a loooonnng way around to get the same results as using a simple BitmapMaterial apparently. I suppose I can uderstand that as calculating all the curves would be an astronomical computing task.
If anyone knows a way to get true vector graphics into an Away3D material, I’d love to know.
|
Darcey, Moderator
Posted: 28 July 2011 09:41 AM Total Posts: 209
[ # 10 ]
I don’t think there is any way to actually wrap vector shapes around a mesh and keep aspect ratio, no distortion of the vector etc.
If Swf.as brings in a vector and converts it to vertices / vectors in Away3D, then it would be about the wrapping of 1 set of vertices around another set of vertices… To do this with aspect ratio, no distortion of the vector etc, kind of like a cloth (plane) being placed over a cube, I’ve no idea bar plugging it into a physics engine.
|
Choons, Sr. Member
Posted: 28 July 2011 10:02 AM Total Posts: 281
[ # 11 ]
yeah when I really thought about it, i realized why that is so. Let me bounce this idea off you. The whole reason they want the vector graphics is to be able to cam zoom in very close without pixelation of the texture. Since I’m stuck with a bitmap either way, I’m thinking of taking “snapshots” of the scaled sprite by using bitmapData draw on a set rectangular area of the sprite. The sprite would get scaled larger and smaller in the background in accord with the cam zoom level. At reasonable zoom points I switch out the material’s bitmapdata (now a simple BitmapMaterial). I could be pre-render a few on either side of the zoom level for performance. The only question I have is accessing that set rectangle size snapshot area on a constantly changing sprite.
|
Darcey, Moderator
Posted: 28 July 2011 10:10 AM Total Posts: 209
[ # 12 ]
Need more info on the constantly changing sprite bit. But the changing of the texture on the fly is nice and easy, you just have to ensure your changing the correct face.material or cube.cubematerial etc. When rotating items and having to work out if they are in view and facing the camera, that would bring me back to searching the google group, googling and then probably posting here and in the group for help again. The only way I can think of to check if a face is in view is to either hit test it grab it with mouseclick or to loop through every face performing some set of if statments at a guess.
Just watchout if your trying to apply a filters and use various different materials on the same object (it’s what I’m fighting with at the moment). And multiple interactive materials on a single object seem to be activating others even though clearly defined unique IDs for activation are in place lol..
|
Choons, Sr. Member
Posted: 28 July 2011 10:31 AM Total Posts: 281
[ # 13 ]
sounds like we are working on the exact same thing! Yeah to be a bit more clear- say I have a bitmapData object a set size of 256 X 256. Initially the sprite containing the vector graphics is scaled to 1 at the same size. By the way, the sprite is no longer being used directly for the material, but instead its image has been drawn into the bitmapData object which is then used for the material. User begins zooming in the cam, and in the background the app is scaling up the sprite. At a set zoom level, another 256 X 256 bitmapData “snapshot” is taken of the now larger sprite. Instead of putting the whole image of the sprite in the bitmapData object, only a portion of the enlarged sprite is sampled. Since the graphics in the sprite are vector-based they never get pixelated and (so my theory goes) every 256 X 256 bitmap snapshot of it stay clean as well. The only thing I don’t have a handle on yet is how to sample that small square portion of a sprite that is become huge. I’ve done it with matrix ops on other bitmaps, just don’t know if that translates to sprites.
|
Darcey, Moderator
Posted: 28 July 2011 10:41 AM Total Posts: 209
[ # 14 ]
lol does sound very similar. You can grab me on google talk if you have it installed just add .(JavaScript must be enabled to view this email address)
You probably want to go down the bitmapdata path, I’m trying to modify the bitmapdata of a bitmapmaterial on the fly while updating the bitmapmaterial.
You may want to try:
1. Add the vector image to the stage (so you can see where it is and what you are going to be capturing for the zoom) via sprite (standard flash)
2. Take a bitmapdata.draw of that sprite and update the bitmapmaterial
3. On zoom - scaleX & Y of the sprite and do another bitmapdata.draw of it and update the bitmapmaterial again
and so on.
|
|