Home 3D Art Showcase & Critiques

Flash 3D Model Viewer

polycounter lvl 18
Offline / Send Message
Richard Kain polycounter lvl 18
Update time. (again) Well, I kind of had to go back to basics on this one. The AS3 3D library I use got updated, and some of the new features were must-haves. So I had to go back and reprogram the viewer to take this into account. I made some other adjustments to increase flexibility. You can now specify the size of the rendering window, and you can adjust the origin of your 3D model without re-exporting your mesh. You can also load up 3DS, DAE (collada), and ASE files. Just specify where the 3D model is in the xml file, and the texture you want to use.

Click on the image below to see the player in action.

viewer_example.png

Click Here to Download the model viewer

Naturally, there is still much to be done. Multiple viewing modes are a must-have. (wireframe, cel-shading, and gourad should be possible in the near future) And I would like to throw in a few more rotation options. I was going to hold off on those until I had conjured up some arrow graphics for my button class. But the current version is fully functional and should be perfect for viewing low to mid-range poly models.

Replies

  • Cody
    Offline / Send Message
    Cody polycounter lvl 15
    Thats pretty cool man. I see some artifacts, but all in all not bad. Anyway for the user to rotate the model in flash? So if I use that plugin in Blender, I just paste that script in a flash file?
  • Richard Kain
    Offline / Send Message
    Richard Kain polycounter lvl 18
    You can't just past the .as file into a flash file. If you are using the Flash IDE (what most people normally think of as Flash) you would have to link to the .as source file for your model, and have your 3D library of choice ready in the same folder. For the user to rotate the model, you just need to provide the right interactive element, and program the controls to update the speed properly.

    Also, the artifacting on my model is actually caused by the way that I constructed the model. I have a lot of faces too close to each other, and the 3D engine is having trouble handling the z-testing for them. A less convoluted mesh wouldn't have any problems. I'm not used to such low-poly endeavors, my choice of subject was questionable, and I can't paint to save my life.
  • Sa74n
    Offline / Send Message
    Sa74n polycounter lvl 18
    pretty cool way to present your ds spec models in a portfolio. i also get some artifact popping but i bet it can be fixed somehow.

    looking forward to more progress on this smile.gif
  • Richard Kain
    Offline / Send Message
    Richard Kain polycounter lvl 18
    Yeah, I'll need to test this out with a better-designed model, just to insure that those popping issues aren't universal. Maybe I'll grab one of the SDK models that are always floating around Polycount. Those usually have great UV mapping and rock-solid mesh flow.

    One of the issues with this method is that it is compile-time. The model isn't being loaded into the flash player. It is compiled into the flash swf itself. As such, you can't really use this method to load any model you wanted. Each model would have to be compiled (or published, if you prefer) as its own swf file.

    Of course, once they are swf files, it is entirely possible to load those into another swf file that could serve as a "viewer" with standardized controls and options. That is definitely an option that I will want to explore.
  • hessi
    just reading the title and took a look into this since a group of students at my university was trying to implement a 3d cloth online shopping store in flash. there seem to exist flash 3d engines that load some special XML format containing vertex information. since the xml is loaded from a seperate file you wouldnt have to compile it over and over again. i dont know exactly about the texturing possibilities, but loading images in flash isnt a that big problem. so segmenting an image into polygons that get transformed should be possible though hardware demanding.
  • Richard Kain
    Offline / Send Message
    Richard Kain polycounter lvl 18
    Yes, what you say is true. The biggest limit to 3D in flash is the CPU processing. The flash player has no access to the GPU, so it relys entirely on the CPU for rendering. When you are doing all of the calculations necessary for complex 3D scenes, it wolfs up the CPU's processing power. Newer computers can handle it pretty well. But any CPU over three or four years old is going to chug a bit. And you're still always going to be limited without the use of the GPU.

    It's also true what you say about XML. Flash is actually quite adept at handling XML, and loading it at runtime. A 3D file stored as XML could be quite easily loaded into Flash at runtime. And textures are cake. Flash has built-in objects and functions for loading textures dynamically at run-time. It even has full support for PNG's and their transparency values, so alpha masking is no problem.

    The reason I'm sticking with this solution for the moment is becasue it makes it very easy to get models into Flash, and there is a slight performance advantage to having the model pre-defined in the 3D engine's native type. It's actually already possible to load external 3D files into the engine, this solution is just more convenient for a code-monkey like myself.
  • hessi
    i just got the name of the 3d flash engine the students used:
    http://www.papervision3d.org/

    it is an open source project and released under MIT license. so lots of artists might profit from it. i have no experience with it, but those who are interested might check out papervision3d.
  • Richard Kain
    Offline / Send Message
    Richard Kain polycounter lvl 18
    The Blender Plugin I linked to actually supports all of the major Flash 3D libraries, including Papervision. I would be very interested to see what kind of file formats that Papervision might be able to import. (as that would make it that much easier to implement a 3D viewer application) However, it seems that the link you provided just goes to a static flash site that doesn't have anything you can actually do. It just has a logo that appears in the middle.
  • Xaltar
    Offline / Send Message
    Xaltar polycounter lvl 17
    Looks promising. You could try my SDK if you like.
    http://boards.polycount.net/showflat.php?Cat=0&Number=264839&an=0&page=1#Post264839

    If not there are tons of others floating around here.
  • hessi
    oh.you got to wait until the flash player loaded all data. then you see some underwater demo and the logo moves to the upper left corner. click it so you get to a wiki, documentation examples etc.
    direct link:
    http://blog.papervision3d.org/

    it would be a nice project for some people to write a modelviewer in flash using paper vision so everybody could easily add 3d models on his/her website without having a background in flash or 3d in flash.
  • Richard Kain
    Offline / Send Message
    Richard Kain polycounter lvl 18
    Don't really need the content that was in this post. I'm placing all update changes up at the top of the thread.
  • SheriffNotic
    sweet implementation in flash, good job!
  • Noisybast
    Offline / Send Message
    Noisybast polycounter lvl 18
    Very impressive stuff!
  • airbrush
    Offline / Send Message
    airbrush polycounter lvl 13
    awesome way to present your portfolio, I imagine you're probably limited to really low poly stuff with small textures?
  • Richard Kain
    Offline / Send Message
    Richard Kain polycounter lvl 18
    In theory, I can use as large a model as I want, and as large a texture as I want. In practice, I have to keep both within acceptable limits or its going to chug something fierce. I'd imagine any sub-1000 poly model and 512 texture would be fine. You start trying to go into multiple thousands in polys or pixels and you're going to be pushing it. Flash's rendering power is constrained by your system's CPU.
  • hawken
    Offline / Send Message
    hawken polycounter lvl 19
    is this using the papervision libs?

    do you think it possible for a sub 2000 tris game?
  • Richard Kain
    Offline / Send Message
    Richard Kain polycounter lvl 18
    No, this is using the Sandy 3D libs. The buttons are my own custom creation, and it would probably be fairly easy to port this over to papervision. I'd just need to go over some of the papervision tutorials. I imagine most of the structural concepts are the same. If there is a performance advantage to using Papervision, I'd be quite interested in trying it out.

    As to a sub-2000 tris game, I suppose it would be possible. The example model I'm using (Bobo's Demon) is actually a 1024 triangle model, and it runs pretty smoothly at lower resolutions. I would not suggest attempting full-screen rendering with this, though. The larger you render it, the more it chugs. But a very simple sub-2000 tri game would probably be possible if you kept the rendering resolution down. (say between 320x240 and 640x480)
  • Needles
    Offline / Send Message
    Needles polycounter lvl 19
    Yahoo bandwidth error D:
  • Richard Kain
    Offline / Send Message
    Richard Kain polycounter lvl 18
    Ick, yeah, sorry about that. It's hosted on yahoo/geocities at the moment. I'm actually going to be nabbing my own domain + hosting soon, so I'll transfer it over there when I can. Geocities is good for some quickie previews, but their bandwidth limitations are rape-tastic.

    Speaking of which, I have to make a new on-line portfolio soon. I've already got a couple of pretty sweet ideas for it. But I would love to hear any suggestions.
  • The_Synj
    Offline / Send Message
    The_Synj polycounter lvl 18
    Great work, although others complain..i have yet to find any serious artifacts. Anyways, i was thinking that it would be cooler to rotate the model using your mouse...if at all possible. XD
  • Cody
    Offline / Send Message
    Cody polycounter lvl 15
    That is sweet.
  • rollin
    Offline / Send Message
    rollin polycounter
    this rocks!!, so would it be possible to load with the swf an model from somewhere else (differnetn url) with an an in-url-var like &loadmodel=http://ix.ux.com/mymodel.end ?
  • Michael Knubben
    That would be excellent, Rollin, great idea! Although we'd have to find a slightly better host than Geocities for it then, heh.
  • Sa74n
    Offline / Send Message
    Sa74n polycounter lvl 18
    hey richard. that looks excellent so far. i don't like the rotate buttons though. how about just grabbing the model and moving the mouse left/right to rotate it? that'd be a lot more comfortable. zoom buttons could be replaced by a magnifier icons with + / - on them (standard)

    are you gonna make this thing available for other people? that would be awesome
  • Keg
    Offline / Send Message
    Keg polycounter lvl 18
    looking good so far.

    Why not use google pages? free and I've had no issues with bandwidth
  • notman
    Offline / Send Message
    notman polycounter lvl 18
    This is a great tool. I was looking for something like this a long time ago. Any issues with anyone else using it? I wouldn't mind demo'ing some stuff with it. I actually wanted to look into doing this some day, but yours seems to be an easier fit wink.gif
    Oh, just in case you wanted to know, it works good in Linux too. Not that it shouldn't, since it's flash, but there weren't any anomolies using Ubuntu with Firefox.
  • Sa74n
    Offline / Send Message
    Sa74n polycounter lvl 18
    any news on this? smile.gif
  • Richard Kain
    Offline / Send Message
    Richard Kain polycounter lvl 18
    No, I lost my job a week or two ago. So I've been forced to delay development on this little tidbit. (working on getting my portfolio up, already a thread up here about it) I haven't given up on it entirely. I was actually planning on revisiting it shortly in order to make it one of my portfolio pieces. (a good example of a fully programmed flash-application)

    I actually spent an hour or so this morning working on a custom 3D model to use as the default model selection. Thanks for the testing, btw, notman. It's great to know that there aren't any cross-platform issues. That's always been one of the things I liked most about flash.
  • Richard Kain
    Offline / Send Message
    Richard Kain polycounter lvl 18
    Bump. The changes are up at the top.
Sign In or Register to comment.