Jump to content
Hash, Inc. Forums

Recommended Posts

I've decided to learn Actionscript over Christmas break this year, so I thought it would be fun to try some 3D stuff.

 

This is what I have so far:

- System to render out nodes, edges, and polygons

- Basic control system (rotate, zoom, and move camera)

- Java "converter" which takes a .mdl file and converts it to a custom formatted text file

- Actionscript importer which imports the data from the text file and constructs a model from it

 

I attached a picture of the model in AM, here's the same model in flash:

https://mywebspace.wisc.edu/vandeweghe/web/engine.htm

 

Current issues:

- It runs pretty slowly. There are a few things I'm aware of that will speed it up a bit, but I'm guessing it's also the limits of what flash can handle

- I currently have all splines fully connected (first node connects to the last node). This is sometimes correct, but at other times it's not what I want

 

[EDIT]If you're interested, here are 2 more tests I did a bit earlier (that eventually led to this project):

https://mywebspace.wisc.edu/vandeweghe/web/stars.htm

https://mywebspace.wisc.edu/vandewe...b/particles.htm

post-728-1167679069_thumb.jpg

Link to comment
Share on other sites

  • Admin

That is really cool.

Color me impressed.

 

I've been working with some flash type menus of late but they certainly don't have any A:M interactivity. I'd like to target A:M v14's SWF export for some experimentation but... never enough time.

 

Love your examples.

Your third link was truncated. Lets see if this one will work:

 

https://mywebspace.wisc.edu/vandeweghe/web/particles.htm

 

Edit: Yup. Looks like it does.

Link to comment
Share on other sites

UPDATE: I updated the link. Now it has a new model (also exported from animation master). I also modified the code to speed up performance (it now only has to do about half the calculations it was doing before)

 

Thanks for the replies guys...it helps keep the motivation up

Link to comment
Share on other sites

What other languages to you know, or is this your first?

 

I'm majoring in computer science, so I've learned Java through that. I've also dabbled in C and assembly language, but I really don't remember much. Knowing java has really helped in actionscript though, and I wrote most of the model format converter in java.

 

To everyone, thanks for the kind words.

Link to comment
Share on other sites

  • Hash Fellow

I'm surprised it works as fast as it does.

 

When I zoom the guitar sample i noticed the "wires" dont' scale like the CPs.

 

I wrote most of the model format converter in java.
Hey, since you're writing model converters, how about a V13 to V11 converter? :)
Link to comment
Share on other sites

And I'm finally back with an update, sorry it took so long...

 

Here's my newest progress:

https://mywebspace.wisc.edu/vandeweghe/web/polygons.htm

 

At this point, I have polygons, edges, and nodes correctly implemented. The details:

- polygons sorted using (a slightly modified) painter's algorithm

- backface culling to eliminate rendering of hidden faces

- basic lighting/falloff based on angle of polygon to the camera

Link to comment
Share on other sites

- Java "converter" which takes a .mdl file and converts it to a custom formatted text file

- Actionscript importer which imports the data from the text file and constructs a model from it

 

 

 

Wow.

 

This could be the start of something BIG! That seems to work a LOT better than the V14 Hash2Swf exporter...any way to run a rigged animation thru the mill?

Quite impressive!

 

MC

Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...

Returning once again with an update (I somehow keep coming back to this project):

 

- Re-wrote much of the code to use a new, much more efficient data structure

- The new data structure makes importing files much easier (to be implemented later)

- Completely re-wrote the rendering code. It now uses per-pixel rendering, which allows for smooth shading (as seen in demo), texture mapping, normal mapping, etc.

- Frame rate is far lower that I'd like it to be, but not too bad considering the model is around 1500 polys

 

http://www.markvandeweghe.com/flash/engine1.html

 

I'm considering putting together an on-line modeling/texturing app. Does anyone have any ideas/suggestions for what would be helpful or useful to have online?

Link to comment
Share on other sites

  • Admin

Thats quite a hobby you have.

No suggestions here but I think your investigations are impressive.

 

Edit: As an online application perhaps an interface/application that allowed for viewing and downloading the model file from one location? Both the viewer and download button would point to the same model file. It would perhaps be a new way of sharing models on the internet.

Link to comment
Share on other sites

Dude, wow. If you make an on-line modeling/texturing app, it would be almost criminal not to make it compatible with WebHAMR. Make it so the user can save the model in a format the WebHAMR can open (a basic AM mdl plain text file). That would be a very good marriage of technologies.

Link to comment
Share on other sites

that's impressive code, but by rendering at the pixel level, you're using none of flash's strengths.

 

do you have any plans to render models using vector-based shapes for near-color areas?

 

that would kick serious booty.

 

-jon

 

my glass is half full... of donkey drool.

Link to comment
Share on other sites

do you have any plans to render models using vector-based shapes for near-color areas?

 

My previous renderer used Flash's vector API to draw each polygon as a triangle.

 

My current goal is/was to create a renderer that allowed smooth shading (vertex normals instead of polygon normals) and texture mapping. I couldn't figure out any good way to draw a triangle with a 3-color gradient between each vertex with any built-in functions. And even if I could do that, texture mapping would still be impossible to do.

 

I settled on doing a per-pixel renderer that goes through most of the same steps that graphics hardware does. Although it's not very efficient (there's a reason we try to use hardware to do these things), it's a step closer to my goal and something I enjoy working on.

Link to comment
Share on other sites

what about a simple two-point gradient, assuming the surface defined had a single hue?

 

as a toon lover, this would be a huge improvement, since i don't care about textures.

 

as i said, it is an impressive achievement, and since this is a personal project, you don't have to please anyone other than yourself. ' ' )

 

-jon

Link to comment
Share on other sites

what about a simple two-point gradient, assuming the surface defined had a single hue?

 

I guess I'm confused what you're getting at with this. I'm definitely interested in hearing your ideas, but I'm not sure how this would work. A (simple) triangle generally has 3 colors, one at each vertex. By assigning colors to each vertex, we can make it look like all of the triangles blend together. If there's just a linear 2-point gradient, I'm not sure how that would map onto a triangle?

 

In other news, environment mapping:

http://www.markvandeweghe.com/flash/engine2.html

 

It's not 100% accurate yet, this is more of a proof of concept that it's possible to implement.

 

 

I also did some reading up last night, and I think I'm going to divide this project into 2 parts: a (relatively) fast gouraud shading renderer for real-time manipulation of the models, and a phong shaded renderer for final output when time in as high of demand.

Link to comment
Share on other sites

Here are the results from a fair amount of optimization and code re-working:

http://www.markvandeweghe.com/flash/engine3.html

 

There are a few issues with culling at this point, those will be fixed soon. My main goal with this is to get it fast enough to be practical for real-time applications.

 

If you guys are bored, I'd be interested in hearing what sorts of frame rates you're getting for this example as well as the basic specs of the computer you're running it from.

 

Also...sorry that this thread has been constantly straying further and further from AM-related material. I promise it will loop back soon.

Link to comment
Share on other sites

Wow! :o

This is incredible. Could the engine be used as a hash to flash convertor or is it too difficult for a non technical person to implement? It seemed like the animated files(like the bug) load quickly and efficiently, do you use interpolated motion between keyframes or is every frame a keyframe?

Frame rate on my centrinoM 1.8 was between 10 and 15 for the last gorilla file.

I'm really interested to see where this goes.

Link to comment
Share on other sites

Could the engine be used as a hash to flash convertor or is it too difficult for a non technical person to implement? It seemed like the animated files(like the bug) load quickly and efficiently, do you use interpolated motion between keyframes or is every frame a keyframe?

 

My goal at some point is to make model importers for this. Once that is done, the basic code required to load and display a model would be:

- Create "3d Engine" object

- Create model object and call LoadFromFile() function to import geometry

- Load the model into the engine object

And then at each frame, you can just call the DrawAll() function of the engine. Before the rendering step, you can make any adjustments (translation/rotation/animation/etc.) to the model that you want.

 

More simply put: yes, this will eventually be able to be used as a hash->flash workflow with very few steps.

 

As far as animation: the older examples that I posted used bones and keyframes exactly like AM does, you can set a bone's rotation for a given frame, and it will automatically interpolate for all frames in-between. Depending on how much time I want to spend working on these features, it's entirely possible to have a system where users can import model AND animation files from AM and display them.

 

How do I tell FPS... may I ask...how big (k-mb) is that animation?

FPS is the number in the top left corner.

 

The file is 117kb right now, but much of that size is due to the 66kb texture that I have embedded in the project but not in use right now. I'm guessing most of the rest of the file size is because I'm storing 1500 polygons and vertices directly in the code. Once I write a file importer and use a texture loader, file size will be (IMO) insignificant for most web use.

Link to comment
Share on other sites

Oh- I thought that was a frame counter...it goes so fast...around 25-30fps I guess...standard PC...Sony Vaio P4 2.8ghz, 512 mbRam.

 

So this thing is rendering right within the swf, huh? Pretty Darned Cool... I could think of some uses! So long as people don't have to download a utility to play it back... heck Flash is a hell of a game engine, the only thing missing was this sort of imagery...

Link to comment
Share on other sites

Updated a few things...mainly added specular reflections:

http://www.markvandeweghe.com/flash/engine6.html

 

Also, I'd like to gauge interest...if I were to develop AM-specific model and animation importers for use with this, how many of you would actually use it?

 

It would take me a fair amount of work to add the file importers, but I'd definitely consider working on it if enough people wanted me to.

Link to comment
Share on other sites

  • Admin
Also, I'd like to gauge interest...if I were to develop AM-specific model and animation importers for use with this, how many of you would actually use it?

 

I fear answering 'yes' here may not be wise as I don't want to put you to work on something that ends up not being used enough to justify the effort in your estimation. You are certain to find many requests for 'new features' too.

 

I -want- to say 'yes' as I am very interested in using A:M models online and what we've seen thus far is impressive.

 

HAMR is something I simply must get my brain wrapped around. Importantly, your application doesn't duplicate anything available there so I think it would find a welcome niche. A means to convert A:M models to Flash content for viewing online (I confess I've never had much success with AM2SWF)... I can definitely use.

 

So... please count me as a 'Yes'. :)

Link to comment
Share on other sites

(I confess I've never had much success with AM2SWF)

 

AM2SWF...me neither, bless 'zpiders' heart tho- We sure got excited about IT back in the day...

 

You could count me in as an 'enthusiast'...I am still unsure of what it even IS that I am looking at... a swf file that is 'rendering' A:M content on the fly, huh? Would bone-driven animation work in this thing? There would need to be some sort of way to use the resulting files in a Flash authoring environment, no? OR are you just imagineering a quick A:M file-veiwer...?

 

Curious!

Link to comment
Share on other sites

Hi,

 

Its looking great. I'm averaging about 40fps (40-50 before you added the specs)

 

Have you looked into using Papervision 3d? It could give you the ability to do more texture related stuff and might be comparable in speed.

 

Its what we used to do 3d conversions for a project for coke that will launch soon.

 

Its looking awesome. As far as 3d exporters, not sure how much interest or use you'll get. I'd query about the usage of Webhammer, to get a better idea of how much such a tool will get used.

 

C

Link to comment
Share on other sites

Have you looked into using Papervision 3d?

 

I actually didn't learn about Papervision until I was pretty far into this project. I haven't looked at it as much as I probably should, but it seems to me that my project will end up very similar to it.

 

I think me using Papervision would basically 'void' this project, as I see the two being very similar. (Please correct me if I'm wrong here) I have a long list of features I'm planning to implement, I actually already have texture mapping working, I just haven't optimized the code enough to post an example online.

 

So I guess the main point I'm getting at (in a very roundabout fashion), is that there is no advantage (yet) of using this over Papervision, it's really just a fun learning experience and portfolio piece for me.

Link to comment
Share on other sites

31 - 34 fps.

You keep outdoing yourself.

My browser appears to have the same old Flash plugin it has always had, so nothing exotic is going on there, yet, your swf file is less than 200KB.

I do not see how you can pack that geometry and rendering engine into a standard swf file and play it on my standard Flash browser plugin while keeping the swf file under 200kb.

Are you sure you aren't pulling our legs?

Link to comment
Share on other sites

So I did a few tests on the files and I can see that you are using the bitmap class to display the render (similar to what we do when we do paintable textures for the coke project. How much does the frame rate suffer when you draw a bigger bitmap? say twice the size of the one you are drawing? and how many polygons is that Gorilla?

 

I really like the extra shader functionality though.. thats a big plus! Keep it up and you'll have a strong competitor to papervision :)

 

 

C

Link to comment
Share on other sites

I would definitely use this if it was integrated into the am workflow. I've had problems playing many papervision files while your's play perfectly. Having said this I have only a moderate knowledge of actionscript so it would need to be fairly easy to implement.

Link to comment
Share on other sites

  • 4 months later...

Bringing this thread from the dead once again. I've made it my goal to work on this project for a few hours every night after work, so progress is being made.

 

I apologize again that this project isn't specifically AM related, but I'm planning on integration in the future :)

 

Some new things you haven't seen yet:

Texture mapping

3ds Importer

EDIT: Demo of all functionality

 

I've also been working on cleaning up the code for an alpha release to the public, hopefully in a week or sooner. It's not feature-complete yet, but most basic functionality is working. Feel free to look at the Google code page for this project, which has a few (WIP) pages of information about using the code. My main goal was to make it easy for anyone to implement, which I'm hopefully getting closer to. The standard 'spinning model' project can be done with only 10 lines of code :)

 

So there's still no direct .mdl file support, but I've gotten pretty good results exporting models from AM to a 3ds and loading them into this.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...