|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.
Now, a look at the UI:
The viewport gives you a graphics representation of the camera rotations.
Rotation Settings - Horizontal
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 - 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.
[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.
[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.
15. 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.
16. 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
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
21. 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.
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.
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
1. This shows the last rendered frame.
2. Current Task.
Shows the current task being executed.
3. Progress bar.
Shows the progress of the whole progress.
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.
8. 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.