VolumePreview
MaxScript 0.4.0 for 3ds max 5 and higher (2013/06/27)
Copyright © 2003-2004 by Borislav Petrov
 
WHAT DOES IT DO?
VolumePreview generates a preview of environment effects in the viewport including volumetrics, lens effects and shadows.
It requires a camera view to generate a preview.
After generating the preview data, the viewport displays the volumetric effects, shadows and lens flares in realtime.
CAN I SEE AN EXAMPLE?
The following video shows the FIRST EVER experiment with the script. The animation was generated using the Animation>Make Preview function after using VolumePreview to generate the volumetic display in the viewports:
Demo Cinepak 1.5 MB
Left: RGB Opacity mode (old mode). Right: Alpha Mode - new default option.
Volume light looks the same, fire effect is closer to the final rendering in the new mode.
 
FEATURES
  • The preview can be generated in any user-defined resolution. You can enter a percentage of the current viewport size, or press one of the preset buttons to quickly set the value. The resulting size will be displayed by the window to the left of the value.
  • When the "Show VFB" checkbox is enabled, the sample rendering will be displayed. It is off by default. The progress will be displayed by the progress bar at the bottom of the dialog. Red progress bar shows the update of environemnt effects, blue bar shows the update of lens effects.
  • The preview requires a camera in the active viewport. If the active viewport is not a camera viewport, you will be prompted.
  • You can create a single frame preview (for example when the camera is static) by pressing the "UPDATE CURRENT FRAME" button. You can repeat this for any frame you want - for example, if you move the time slider and press the button again, the current frame will be rerendered without affecting any existing frames.
  • The last known image will be used on any consecutive frames without a preview frame. For example, if you update only frame 0, it will be shown on all following frames until the end of the animation. If you move the time slider to frame 10 and update the frame, you will see frame 0 from 0 to 9 and 10 from 10 to the end of the animation segment.
  • There are two preview layers - one for shadows and environment effects and one for lens effects. Both layers can be updated independently at different resolutions and toggled on and off separately. Use the checkbuttons to specify which layer(s) you want to update. Note that "Update Volumetrics" must be checked for "Update Shadows" to have an effect.
  • If you want to render a range of frames, you can use the "UPDATE ANIMATION RANGE" button. It will use the values specified by the "S" and "E" values ("Start" and "End") which default to the current animation segment.
  • The "N" value ("Nth") lets you render every n-th frame. 
  • You can update only a sub-range of the current segment, or a range larget than the current segment.
  • You can generate previews in different resolutions - for example, render a preview of the whole animation at a very low resolution, then update single frames individually to check detail.
  • The time used to generate the preview will be printed to the MAXScript Listener and will be shown in the prompt line of the status panel at the bottom of the 3ds max UI.
  • You can save the scene without disabling the preview - next time you open the scene, the preview should be active again.
  • There can be any number of previews stored on the hard disk. The scene name will be used as part of the files written to disk, so renaming the scene or saving incrementally will leave a set of preview files behind and create a new set next time you use the UPDATE buttons.
  • You can hide either of the preview layers by unchecking the "Environment" and "Lens Flares" buttons.
  • The "RGB Opacity" and "Alpha" options let you switch between using the alpha channel and RGB mode for Environment effects. The state of the radio buttons is sticky between sessions. When in RGB mode, shadows will not be displayed and volumetric effects will be more transparent. Note that the Lens Flares layer will always use the RGB mode.
  • You can remove all traces of the script by pressing the "Remove Preview" button. All VolumePreview files in the \Previews\VolumePreview directory, the screen overlay planes and materials will be removed.
  • You can enable "Anti-Aliasing" for finer results, but rendering time will be longer. (AntiAliasing was always on in 0.2.4). When off, quality will be slightly worse, but update times can be up to twice as short!
 
A surprising side-effect of the technique used - any shadows (including ray-traced, shadow maps, and area shadows as shown in the screenshot above) will also be displayed in the viewport while in Alpha opacity mode!
 
Shag:Hair preview in the viewport shows correct shading since version 0.3.2.
Image courtesy Yi-Piao Yeoh.
 
VERSION HISTORY
v0.3.4:
  • Fixed a stupid hard-coded Camera name bug!
v0.3.3:
  • Changed the behavior of the "Update Shadows" checkbutton - when only "Update Shadows" is checked, the volumetric overplay plane will preview only shadows. When only "Update Volumetrics" is checked, only environment effects will be shown. When both are checked, both effects and shadows will be displayed. (In the past, the Shadows were dependent on the state of the Volumetrics button)
v0.3.2:
  • Fixed Shag:Hair rendering (which respected only Alpha so far). Now it renders correctly in full color! 
    Special thanks to Yi-Piao Yeoh for the support and testing of this feature!
v0.3.1:
  • Fixed a typo which prevented Alpha mode from working on machines where 32 bit TGA was not set by default.
  • Changed the drop-down list to checkbuttons which are much easier to select.
  • Added a new "Update Shadows" checkbutton to enable shadow preview when "Update Volumetrics" is checked.
v0.3.0:
  • Finally, Lens Flares will respect geometry occlusion.
  • Implemented two separate layers - first layer for environment effects (volumetrics) and shadows, second layer for lens effects only.
  • You can toggle both layers separately, showing only environments + shadows, only lens flares, or both (using "Environment" and "Lens Flares" buttons). State of both buttons stored in the INI file.
  • Both layers can be updates separately or together and can have different resolutions. Added a drop-down list to select the Update Mode.
  • Scene-specific file names. The name of the scene will be used when storing data. Saving a scene to a new file name will invalidate the Preview next time you update a frame and start a clean Preview for the new scene. When loaded, scenes will access their original preview files so you can have ANY number of separate previews on the same machine. Note that all "Untitled" scenes will save to the same set of files, so save to a file first before updating a Preview!
  • New VolumePreview sub-directory of \Preview directory. You can delete it manually to remove any trails of VolumePreview. This also means that scenes created using v0.2.4 cannot be cleared using "Remove Preview" in v.0.3.0 as it will search the wrong path for files.
  • Up to twice as fast as 0.2.4 thanks to anti-aliasing disabling. Check the "AntiAliasing" button to get smoother results but longer render times. State stored in INI.
v0.2.4:
  • Added Nth frame rendering.
  • Changed the way missing frames are processed -  the last known frame (if any) will stay in effect until a new frame appears.
  • Added a switch to enable rendering of the overlay - this lets you see the overlay in the ActiveShade and even in production rendering (disable Atmosphere checkbox in renderer to render only the overlay).
  • Added position memory to the INI file.
v0.2.3:
  • Fixed a startup bug introduced with the new INI code. Sorry for the trouble.
v0.2.2:
  • Fixed opacity mode, added option for RGB and Alpha opacity. (0.2.1 and older used RGB instead of Alpha);
  • Added "Preview" checkbutton to show/hide the preview;
  • Added a "Remove Preview" button to delete all files and the preview from the scene;
  • Opacity and Size settings intersession-sticky using INI file.
v0.2.1:
  • The overlay plane will be frozen to avoid picking in the viewport.
v0.2.0
  • First public version. Added "UPDATE CURRENT FRAME" button and typical % buttons.
  • v0.1.0: First internal version, proof of concept.
HOW DO I INSTALL IT?
  • Download the ZIP file, save under \Scripts
  • Unzip to \Scripts
  • Start 3ds max 5 or 6, go to MAXScript>Run Script... and select the file
  • Go to Customize>Customize User Interface>Toolbars, locate "VolumePreview" under "Bobo_s Tools" category and drag to a Toolbar.
  • Select a camera view and press the new button.
TESTED EFFECTS
  • Fire Effect
  • Volume Light
  • Lens Effects
  • AfterBurn
  • Shag:Hair
  • Shadow Maps
  • Raytraced Shadows
  • Adv.Raytraced Shadows
  • Area Shadows
KNOWN LIMITATIONS
  • Camera FOV animation not supported yet.
  • Lens Effects are not additive (viewport transparency mode limitation)
PUBLIC BETA DOWNLOAD
Download VolumePreview  v.0.4.0 (new W.I.P. version)

DISCLAIMER: 
This is Beta software. 
It might not do what you expect it to.