Flash 3d Viewer (using maxscript rendering)


Flash 3d Viewer 1.1
[size=2]v1.11, updated at 28-04-2007
v1.2, updated at 31-05-2007, http://forums.cgsociety.org/showpost.php?p=4424358&postcount=93

[font=Verdana][size=2]This is a tool that I’ve created primarily for the oncoming new website of the Minas Tirith Project. But as it could suit many needs, I thought it would be nice to post it here.
The Flash 3d Viewer enables you to create a (prerendered) interactive 3d viewer of a 3d model. The rendering is done with a maxscript, the interactive viewer is made with Flash. The big advantage is that it will work on every pc with the flash plugin installed. No other obscure plugins are needed to see the 3d viewers.
The rendered data created by the maxscript is relatively compact, ranging from about 100kb to 5mb, as long as you use reasonable settings. This makes it suitable for online use. The data is compiled into a single .f3dv file, which can be loaded by the viewer .swf
To avoid any confusion or disappointments: the flash viewer does NOT display real 3d graphics, but (pre)rendered images!

                   [/size][/font]Two examples of 3d viewers, using different settings:
     The cart shows a 3d view where the camera rotates around the subject, rendered in high quality. The hall is using the 'look around' setting, where the camera is static, and the target rotates. This is 'rendered' using the preview mode, which is a fast, low-quality method of creating a 3d viewer.
     Both models are made for the [Minas Tirith Project](http://forums.cgsociety.org/showthread.php?f=73&t=153431&page=112&pp=20)
              [font=Verdana][size=2]As this is actually my very first maxscript, I'd like to hear your thoughts on all this :)[/size][/font]
        This software has been released under the GPL license. Please read the license.txt file included in the source zip.

[li][font=Verdana][size=2] note that the .NET Framework is required to run the f3dv-compiler.[/size][/font][/li][li]A quick installation guide can be found in this post.[/li][li][font=Verdana][size=2]For max8 users experiencing crashes, take a look at this[/size][/font][font=Verdana][size=2]post.[/size][/font][/li][/ul][font=Verdana][size=2]

           Now, a look at the UI:
                   [color=DarkOrange][b]Main Window
           The viewport gives you a graphics representation of the camera rotations.
                   [b]Rotation Settings - Horizontal[/b]
                   [b]1.[/b] Active.
                   This checkbox enables or disables the horizontal rotation of the camera.
                   [b]2. [/b]From Angle.
                 [0 - 359] This spinner controls the starting point of the horizontal camera rotation. Looking from the top, 0 degrees is at "12o'clock", 45 degrees is at "3o'clock" etc.
                   [b]3.[/b] To Angle.
                 [1 - 360] This spinner controls the end point of the horizontal camera rotation. Looking from the top, 0 degrees is at "12o'clock", 45 degrees is at "3o'clock" etc.
                   [b]4. [/b]Steps.
                   [4 - 360] This is the amount of steps the camera will make to achieve the full rotation. Note that 36 steps means 37 frames.
                   [b]Rotation Settings - Vertical[/b]
                   [b]5.[/b] Active.
                   This checkbox enables or disables the vertical rotation of the camera.
                   [b]6.[/b] From Angle.
                 [1 - 179] This spinner controls the starting point of the vertical camera rotation. 0 degrees is at the top, 180 degrees is at the bottom.
                   [b]7.[/b] To Angle.
                 [2 - 180] This spinner controls the end point of the vertical camera rotation. 0 degrees is at the top, 180 degrees is at the bottom.
                   [b]8.[/b] Steps.
                 [4 - 180] This is the amount of steps the camera will make to achieve the full rotation. Note that the amount of frames is always the amount of steps + 1.
                   [b]Rotation Settings - Statistics[/b]
                   [b]9. [/b]This shows the total number of frames that will be rendered. Note that with a full 360 degrees rotation, the last frame is left out, because it is similar to the first (0 degrees = 360 degrees).
                   [b]Render Settings - Camera
                   10.[/b] Camera.
                 This dropdownbox lets you pick the camera you want to render with. This can only be a target camera. If there's no camera in the scene, this field will show 'Create a target camera !' and you won't be able to start the render. The list will be updated when you add or remove a camera to/from the scene. Brazil target cameras are supported too.
                   [b]11.[/b] Rotate object.
                This sets whether the camera rotates around the target, or the target around the camera. The latter results in a sort of 'look-around' viewer, while the first lets you rotate around an object.
                   [b]Render Settings - Output Size
                   12. [/b]Width.
                 [10 - 10000] This is the output width of an individual frame. The default value is the width as set in the 3dsmax render dialog.
                   [b]13.[/b] Height.
                 [10 - 10000] This is the output height of an individual frame. The default value is the height as set in the 3dsmax render dialog.
                   [b]14.[/b] Lock aspect ratio.
                 This button locks or unlocks the aspect ratio. If enabled, the height or width spinner will automatically update when you change one.
                   [b]Render Settings - Process settings.
                   15. [/b]3dsmax Priority.
                 [low - Normal] This dropdownbox lets you set the 3dsmax process priority. Because a 'high' priority actually means 'highest', this can lead to unwanted hangups. Therefore, this option is left out.
                   [b]Render Settings - Output Settings.
                   16.[/b] Create Viewer.
                Enabling this settings causes the maxscript to create a .swf viewer file, next to the .f3dv file. This is required to view the f3dv file. I've added this option, because you might want to create just a .f3dv in case you're using an online system that has only one viewer swf.
          The file loaded by this viewer swf can be set by using the flashvars in html, or by using the code: src="f3dv.swf?file=thef3dvfile.f3dv"
                [b]17. [/b][color=#fffffe]Create HTML File.
                This creates a HTML file that will display the viewer swf.
                   [b]18.[/b] Temporary frames directory.
                This is the directory that the script will use to write the individual frames to before it's compiled into the .f3dv
                [/color][/size][/color][/font][font=Verdana][size=2][b][color=DarkOrange]19.[/b] Browse.
                Pops up a 'select directory' dialog, to select the temporary frames directory.
                [/size][/color][/font][font=Verdana][size=2][b][color=DarkOrange]20.[/b] Delete temporary frames when done.[/size][/color][/font]
                [font=Verdana][size=2][color=DarkOrange][color=white]Enabling this setting causes the script to remove the frames that were rendered after they have been compiled into the .f3dv[b]
                21.[/b] [/color][/size][/color][/font][font=Verdana][size=2]When this checkbox is enabled, the rendering will continue from the point where it was cut off in a previous render. When a render is started, a .INI file is created with the render settings and progress for that scene. If this file is found and if it shows that the rendering was not completed, this checkbox can be enabled. Otherwise it's disabled. The .INI file is automatically removed when rendering is completed.
                   [/size][/font][font=Verdana][size=2][color=DarkOrange][b]22. [/b]Preview.
                 This starts the 'rendering' process in a preview mode. This means that in stead of rendering each frame, a screenshot of the viewport is taken. This gives you a fast preview of the scene. Apart from this, the procedure is the same as the render process.
                   [b]23.[/b] Render.
                 This starts the rendering process. First, a 'save file' dialog will open, allowing you to set the directory and filename for the output.
                   Once the dialog has been closed the render window will open and rendering will begin.
                   [font=Verdana][size=2][b]The rendering window[/b]
                   [color=DarkOrange][b]Last Frame
                   1. [/b]This shows the last rendered frame.
                   [b]Rendering Progress
                   2.[/b] Current Task.
                   Shows the current task being executed.
                   [b]3.[/b] Progress bar.
                   Shows the progress of the whole progress.
                   [b]4. [/b]Frame.
                   Shows which frame is currently being rendered and the total amount of frames.
                   [b]5.[/b] Last Frame Time.
                   Shows the time it took to render the previous frame.
                   [b]6.[/b] Elapsed Time.
                   Shows the total elapsed time.
                   [b]7. [/b]Estimated Time Remaining.
                   Shows an estimate of the remaining time.
                   8. [/b]Horizontal Rotation.
                   This gives an overview of the horizontal rotation settings.
                   [b]9.[/b] Vertical Rotation.
                   This gives an overview of the vertical rotation settings.
                   [b]10.[/b] Render Settings.
                   This gives an overview of the render settings.
                   [b]11. [/b]Frame Settings.
                   This gives an overview of the frame output settings.
                   12. [/b]Stop.
                   To cancel the rendering process, press the ESC key on your keyboard. (This doesn't work in preview mode.)
                 When the rendering is cancelled, the button will change into an enabled 'continue' button. Clicking this continues the rendering process at the frame where it was stopped.
                   Rendering can also be resumed later, even after a reboot or crash.[/size][/color][/font]


DUDE! I’ve been actionscripting this stuff manually. you are a god send.

This shit is awesome! man, speechless…

good work!


Good work!

The maxscript and flash viewer and source code may be adjusted or used for personal projects, not for commercial use.

What are the licences for usage?
Can it be used unmodified for commercial usage. ie showing stuff on a homepage?



Thanks guys.

Just something I was wondering about, I’ve got this little macroscript to allow you to create a menu item or something in max, that will just start the script. But is this actually the right way to do that ?

MacroScript f3dVExporter category:"f3dVExporter" (
  	on execute do (
  		fileIn ((getDir #scripts) + "\\f3dVExporter\\f3dVExporter.ms")

@rdg: I’ve been thinking and reading a bit about software licensing, and I think that the GPL is a very nice thing. So I’ve hereby, I’ve placed this software under GPL (updated the files and opening post). If you have already downloaded the source, please do so again and read the included license.txt, thank you. :slight_smile:



Amazing work. This tool seems very powerful.


But is this actually the right way to do that ?

Why not? It is ok. That way you can use encrypted ms files in macroscripts if you want this.
And you can store the scripts in other directories than ui/macroscripts.

about this GPL stuff:
What does it really mean: I can adjust the player to my needs and as long as I credit you and provide a link to the modified source I can use it for anything I like?

** Maybe we could compile a thread that explains different licensing models or links to them.



Ok that’s nice to know. I was just wondering if it would be the right way to run a script with a macroscript, as I couldn’t really find a command to do this (other than including the code itself with fileIn() or include())

about this GPL stuff:
What does it really mean: I can adjust the player to my needs and as long as I credit you and provide a link to the modified source I can use it for anything I like?

It basically means that you are free to use and modify the sourcecode as you like. And you are free to distribute your modified code or the original source code. You are also free to use it commercially, provided that you also distribute the source code of at least the included part.
For more information:



Interesting work !

you might find this scene / player interesting… ( may load slow)



Thanks mate :slight_smile:

That link you gave is looking pretty interesting indeed, thanks.


Oooh!! This looks great. Thanks.

This will be really useful for portfolios and such.






For the next version, it’d be great if we could add specific objects to the scene, objects that wouldn’t render, but would somehow be a tag for interface items through flash…

For example, we could add an object called, “menu_1” and each frame would be tagged with the location of “menu_1” and the SWF flash file would contain the actual menu buttons and animations, etc., but they would be dynamically placed atop the rendered footage…

So we can easily make websites with 3D interfaces.


Wow, this really is great. Something like this could’ve been sold to a company eager to polish it up and resell it, but you’ve chosen to release it to the community. So thanks for that :thumbsup:


I forgot to ask: Does this work with Max 8? The reason I ask is that I keep getting crashes and errors whe using it.



Just what I was thinking

wow this is a sexy. Thank you very much Pjanssen


I’m getting the same with with Max 9… am I doing something wrong or something?


Really nice :), i always wanted to find this kind of script :slight_smile:

GPL licence allow us to use for portfolio ?



Thanks for your comments everyone!

That certainly is an interesting thought. It is quite a change to the way the whole thing would work though. One of the ‘problems’ here is that compiling actionscript tags to an swf (which I’m doing here) is not very easy, not very flexible and takes a lot of time. As an example, defining a simple variable is done like this in C#:

ArrayList actions = new ArrayList();
actions.Add(new ActionPush(0, "aVariable"));
actions.Add(new ActionPush(1, "theValue"));
actions.Add(new ActionDefineLocal());

Compiler comp = new Compiler();
Byte[] compActions = comp.Compile(actions);
DoActionTag newBaseTag = new DoActionTag(compActions);

So as you see, it’s quite tedious to add actionscript. It’s not impossible though, and I’ll think about your suggestion.

Oh that’s no good! It should work with max 8. I have only tested it on 7 and 9 I must admit, but from that I concluded that it should work on max8 as well…
Could you please post the error that you’re getting and where/when? (open the maxscript listener before running it (F11) to see the full error report)

Thanks! Yes you can use it for your portfolio if you want. GPL basically means that you can use the ‘product’ of the script in any kind of project (commercial or non-commercial) for free. If you want to use the sourcecode in your projects (again commercial or non-commercial) that’s ok too, as long as you publish the sourcecode with the release of the product in which it’s used.


i have just made my first movie with it, and i must admit is a great tool :slight_smile:

just a suggestion,if you could make another format or just use the .swf, without the .f3vd, it will be better for me ^^

but great :slight_smile:


Thanks :slight_smile:
I could make an option for the file extension. It’s really no more than just a swf with the f3dv file extension, so you can change it to .swf if you want. I made it into .f3dv to make it easier to detect for a CMS. For the MT website for example, we’re going to have a component that will handle all 3d viewer files. And the uploading of a f3dv file will be just as easy as any other file, the type detection will go automatically due to the extension.