Flash 3d Viewer (using maxscript rendering)

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  04 April 2007
Flash 3d Viewer (using maxscript rendering)

Flash 3d Viewer 1.1
v1.11, updated at 28-04-2007
v1.2, updated at 31-05-2007, http://forums.cgsociety.org/showpos...58&postcount=93

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!

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

As this is actually my very first maxscript, I'd like to hear your thoughts on all this

This software has been released under the GPL license. Please read the license.txt file included in the source zip.

  • note that the .NET Framework is required to run the f3dv-compiler.
  • A quick installation guide can be found in this post.
  • For max8 users experiencing crashes, take a look at this post.

Now, a look at the UI:

Main Window

The viewport gives you a graphics representation of the camera rotations.

Rotation Settings - Horizontal
1. Active.
This checkbox enables or disables the horizontal rotation of the camera.
2. 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.
3. 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.
4. 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.

Rotation Settings - Vertical
This checkbox enables or disables the vertical rotation of the camera.
6. 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.
7. 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.
8. 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.

Rotation Settings - Statistics
9. 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).

Render Settings - 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.
11. 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.

Render Settings - Output Size
[10 - 10000] This is the output width of an individual frame. The default value is the width as set in the 3dsmax render dialog.
13. 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.
14. 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.

Render Settings - Process settings.
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.

Render Settings - Output Settings.
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"
17. Create HTML File.
This creates a HTML file that will display the viewer swf.

18. 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
19. Browse.
Pops up a 'select directory' dialog, to select the temporary frames directory.
20. Delete temporary frames when done.
Enabling this setting causes the script to remove the frames that were rendered after they have been compiled into the .f3dv

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.
22. 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.
23. 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.

The rendering window

Last Frame
This shows the last rendered frame.

Rendering Progress
Current Task.
Shows the current task being executed.
3. Progress bar.
Shows the progress of the whole progress.
4. Frame.
Shows which frame is currently being rendered and the total amount of frames.
5. Last Frame Time.
Shows the time it took to render the previous frame.
6. Elapsed Time.
Shows the total elapsed time.
7. Estimated Time Remaining.
Shows an estimate of the remaining time.

Horizontal Rotation.
This gives an overview of the horizontal rotation settings.
9. Vertical Rotation.
This gives an overview of the vertical rotation settings.
10. Render Settings.
This gives an overview of the render settings.
11. Frame Settings.
This gives an overview of the frame output settings.

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.

Last edited by Pjanssen : 05 May 2007 at 10:16 PM.
  04 April 2007
DUDE! I've been actionscripting this stuff manually. you are a god send.

This shit is awesome! man, speechless...

good work!
  04 April 2007
Good work!

Quote: 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?

Georg Duemlein
  04 April 2007
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.
  04 April 2007

Amazing work. This tool seems very powerful.
  04 April 2007
Quote: 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.

Georg Duemlein
  04 April 2007
Thumbs up

I have read through most of the logs, and my friend you are great. I can not wait to try this. And then not giving it to the community, like one person said earlier "there are allot of companies that would have paid you some good money for this". Like Christmas all over again, thank you so much.
  07 July 2007
Hi man,
its great plugin

But I got a ugly error when I wanted to use a manual compiler, and it is quite key for me, because I wanted to do a postproduction on the images and save it in bigger compression.

Here is the error

Hope that you will help. the images are named noramaly as default(ahoj1_1.jpg, ..). I tried to rename them to something simplier (ahoj01.jpg,..) but I wont worked at all....
  07 July 2007
Hey, sorry to hear you're having problems with the compiler.
I think that the problem is due to your filenamimg rather than an actual bug. The filenames should be as follows:
The plus sign should be in this. h, v and a should be numbers of the horizontal, vertical and animation frame. If you're not using some of them, just use a 1. So for example:

When selecting the source file in the compiler, just pick any of the frames. The compiler will split the filename at the + sign, and cycle through the h, v and a files.

I hope that this will help, good luck!

Last edited by Pjanssen : 07 July 2007 at 08:58 PM.
  07 July 2007
Hm that's an interesting error. Have you got that directory on your HD ?
I'm not exactly sure, but it looks terribly much like it's using my default images directory for some odd reason. This would be very strange, since it should pick the directory from a 3dsmax system global...

Last edited by Pjanssen : 07 July 2007 at 11:57 AM.
  07 July 2007
ok i fixed it. (dont know how though) but i did the 360 frame render thing and then it opened up the compilier and was doing it. but now where is my .swf file?
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 07:21 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.