Sunday, 21 April 2013

3d: Render higher resolution images with "Render_autosave", using VRay or mental ray



The 3d image shown above was created while at GMJ. To see my entire 3d portfolio and the architectural rendering, simply click on the above image! 

Also, check my New Book: 3D Photorealistic Rendering: Interiors & Exteriors with V-Ray and 3ds Max


While today’s fast computers may ensure rendering crashes are less and less frequent, there are still instances when processing high resolution photorealistic renders will cause computers to freeze and ultimately crash!

I have certainly experienced in numerous occasions having renders freeze and crash when there were only few “render buckets” left to complete the entire image!

Such inconveniences may cause major setbacks with the final deadline and user’s workflow, especially when the renders are taking a considerable amount of time to process.

For example, the above panoramic image was rendered at 22.000 x 11.000 pixels,while at GMJ design ltd. As one can imagine, it was a huge challenge to create and render the above image due to its unusual output pixel size, and the manner in which it was captured (panoramic).

And yes, it crashed several times while the render was being processed!!
We had decided to render the space in a panoramic style to save the client time and money by NOT having to create and render countless camera angles to capture the entire proposed space.
The end product was a full panoramic image rasterized as a JPEG, which the client was then able to view and navigate through, by using a free software called “ iMove Viewer” .  

Very recently, a prolific script writer/ Senior Visualiser and Photographer called  David Venables has created an ingenious and simple script that allows users to set 3Ds max to automatically save the render periodically while still being processed in the frame buffer.

Users can also set the location and the frequency of the renders being saved.

Below is the simple script created by David Venables:


(

                Global AutosaveImg

               

                fn dntTick =

                (

                                Local Autosavedir = (getdir #autoback) + "\\" + "Rend_autosave.tif"

                                TIF.setType #color16

                                TIF.setAlpha #true

                                ::AutosaveImg = getLastRenderedImage copy:off

                                AutosaveImg.gamma = 2.2

                                AutosaveImg.filename = Autosavedir

                                Save AutosaveImg

                )


                Global dnetTimer = dotnetobject "system.timers.timer" (2*60*1000)

                dotnet.addEventHandler dnetTimer "Elapsed" dntTick


                callbacks.removeScripts id:#RenderAutoSave

                callbacks.addScript #preRender "dnetTimer.start()" id:#RenderAutoSave

                callbacks.addScript #postRender "dnetTimer.stop()" id:#RenderAutoSave

)





To save this script, simply open 3Ds Max, followed by clicking on the MAXScript button from the main toolbar, and choosing the MAXScript Editor option from the dropdown list.





Its dialog should open. Next, copy and paste the above mentioned script onto the dialog’s text field.   

By default, the script automatically finds the autosave path with the (getdir #autoback) string of code; and saves the file under the name of  "Rend_autosave.tif"  as a TIF file format.  




This can be changed manually. For instance, the default path could be saved in the following location: C:\Users\Public\Pictures

The relevant line of code would be replaced with the following: “Local Autosavedir = C:\\Users\\Public\\Pictures + "Rend_autosave.tif" .




In addition, the script automatically sets the saving frequency to every 2 minutes: (2*60*1000).




This default timer can also be changed by simply typing in a different number you may find more adequate (i.e. replace nr 2)!

Once satisfied with everything, simply save the script by pressing Ctrl+S.

The Save file dialog should appear. In order for this script to automatically start as a callback everytime 3Ds Max is lauched, it must be saved as an ms file in the following location:
C:\Program Files\Autodesk\3ds Max 2012\Scripts\Startup.   




Note: If using a different version of Max, simply save the script in the adequate 3ds Max folder (i.e. 3ds Max 2013; etc). 

Next, close and restart 3Ds Max. Render anything that would take longer than 2 minutes to test whether the script works or Not.

Finally, go to the designated folder/location to see the saved image/file; or simply type in the following in the bottom left part of 3ds Max: display (getLastRenderedImage()) ; followed by pressing Enter.
The OK text in blue should appear below, along with the last saved render in the frame buffer.  







The beauty of this script is that it will give the user the reassurance/peace of mind that when/if the render crashes it will be saved. This will also enable the user to continue from where the render was last saved; as opposed to starting from scratch again! 

Currently the script works mainly with the 3Ds Max frame buffer, regardless of the rendering engine being deployed.

The panoramic image below was rendered using the Render_autosave script!

If there are any specific features you would like to see implemented in this script, please contact David Venables through his LinkedIn page HERE or via email HERE.

I hope you have found this article useful!!


Ta

Wednesday, 10 April 2013

3d images: Correcting the Viewport colour display of imported AutoCAD drawings, when added into a Layer in 3Ds Max


Often, imported AutoCad drawings lose their original colour once added into a new layer (using “Manage Layers” toolbar) in 3Ds Max.  
This “glitch” usually frustrates numerous users for a number of reasons, as colour coded drawings help to quickly understand the design and to easily “select by colour” any given layer/s of the relevant drawing in the 3Ds Max scene.    


Also, check my New Book: 3D Photorealistic Rendering: Interiors & Exteriors with V-Ray and 3ds Max 

After countless requests to post an article/tutorial on how to correct this problem, I have finally managed to put something together with help of a prolific script writer/ senior Visualiser/Photographer called David Venables.

David created a simple script to override the above mentioned problem! 
I have had the pleasure to meet and continue to work with David while at AVR London.

David Venables can also be contacted via LinkedIn Here.

Without further ado let us start by importing an AutoCAD file format (i.e. DWG) into 3Ds Max. 








With the DWG file imported into Max, the next step is to quickly create a simple script and apply it.
A- Click on the “MaxScript” button from the main toolbar, and choose the “Maxscript Editor” from the dropdown list, to open its dialog box.
B-Copy and paste the following text/script created by David, into the text field of the “Maxscript Editor” dialog:

     Fn ColourFromLayer =
(
                Local SelectionArr = (selection as array)
                Local myarr = #()
                for i in SelectionArr do append myarr i.wirecolor
                for i = 1 to SelectionArr.count do
                (
                                SelectionArr[i].colorByLayer = false
                                SelectionArr[i].wirecolor = myarr[i]
                )
)









The next step is to “Evaluate” the script.
A- To do so, first open the “MaxScript Listener” dialog by pressing the “F11” key.

B-Next, select the “Maxscript Editor” dialog and press “Ctrl+E” to evaluate the script for any possible errors. Alternatively, simply go to “Tools” and choose the “Evaluate All” option from the dropdown list.
The “ColourFromLayer()” text should automatically appear in the text field of the “MaxScript Listener” dialog…without any red text errors.

Following that, select the entire imported drawing with the “Selection Region” tool.







To apply the script to the selected drawing, simply go to the text field of the “MaxScript Listener” dialog; ensure that a blinking vertical text bar is in front of the “ColourFromLayer()” text ,followed by pressing “Enter”.  
The “OK” text should appear, and the blinking vertical text bar should automatically jump below it…without any red text errors.

This is an indication that the script had been applied successfully.    





To test whether or not the script will serve its purpose once the drawing is added into a new layer, first open the “Manage Layers” dialog by clicking on its button on the main toolbar.
While the drawing is still selected, create a new layer by simply clicking on its button in the “Manage Layers…” dialog. Also, re-name the layer.  

The entire content of the drawing should now be part of the newly created Layer, with the drawing’s original colours intact.  Press "Ctrl+D" to unselect everything in the 3Ds Max Scene.  



If/when satisfied with the results, save the script by first selecting, right clicking and copying the “ColourFromLayer()OK” text from the “MaxScript Listener” dialog; followed by pasting it onto the “Maxscript Editor” dialog. Ensure the newly pasted text is below the existent ones.  




Next, press “Ctrl+S” to save it as a *.mcr.* file format in an accessible shared location.



To quickly be able to deploy this script in future occasions, users often run it off the Max quad menu or as a toolbar button.
Too add it as a toolbar button, simply click on “Customize” main toolbar and choose the “Customize User Interface” option from the dropdown list.   
Its dialog should open. Under the “Toolbars” tab, create a new toolbar, by clicking on the “New” button.

In the “New Toolbar” dialog, name it accordingly and “OK” to close the dialog. A new toolbar button should automatically appear.  





With the new toolbar button created, one can now close the “Customize User Interface” dialog.

Next, we are going to drag and drop the previously created script text in its entirety from the “Maxscript Editor” dialog into the newly created toolbar button.
An image button should automatically appear in the newly created toolbar.
To edit its appearance, simply right click on its image and choose to “Edit Button Appearance” from its pop up menu.




The “Edit Macro Button” dialog should open. By default it is set to “Image Button”.

One can change it to “Text Button” type and name the “Label”, as well as the “Tooltip”. This action will allow users to see the name of the script on the button, as opposed to the previous default “Image button”
Once satisfied, “OK” to close the dialog.


   


Place the newly created toolbar close to the others, by simply clicking and holding on the top edge of its button; followed by dragging /placing it adequately.  





Finally, close and restart 3Ds Max. The newly created toolbar button should now be visible/part of the main toolbar.    

To test whether the new toolbar is working or NOT, import a completely new drawing into 3Ds Max.





Select the entire drawing as previously done and apply the script by simply clicking on the “ColourFromLayer” toolbar button created earlier.





Next, reselect the entire drawing and add it to a completely new layer as previously done.
As one can see:The drawing's original colours remained intact when added into a new layer...which is a clear indication that the new toolbar button worked as expected!

Tip: Adding a “#” before the layer name will ensure the newly created layer always stays on top of the list.  

  I hope you have found this tutorial/article and the script useful!

.





Monday, 8 April 2013

3D Photorealistic Rendering: Interiors & Exteriors with V-Ray and 3ds Max




Hi Everyone,
Just a quick post to say "Hello", and to also announce the completion of my new book, for Taylor & Francis group.
It's entitled:  3D Photorealistic Rendering: Interiors & Exteriors with V-Ray and 3ds Max

The Book is available for Rent/View Online, or for Download on VitalSource.com 

In addition, the book can be found in Book Stores, or Amazon, in kindle and Paperback formats.

I would like to take this opportunity to personally thank Sean Connelly; for being kind enough to give me the amazing opportunity to be involved with his team @ Taylor & Francis. And for being ever so patient with me, throughout the entire process!  
Furthermore, I would like to thank everyone who contributed directly and/or indirectly, during the production, and completion of this book:
Graham Macfarlane; Elitsa Dimitrova; Marcin Piotrowski;  Nadeem Bhatti; Maher Zebian; George Podoski; Geoff Chilvers; Andrew Gibbon; Giacomo Arteconi; Henry Yu; Rita Gulyas; Olivier Ladeuix; Mark La Frenais; Simon Migaj; Mateusz Wawrzyniak; Mark French; Mark Simpkin; Simone Cabras; Jacob Adamiec; Rueben Derrick; Mark Hagen; Fannar Valur, Simon Keay and Dario De Paoli.
Finally, I would like to express my eternal gratitude for the continuous support from: Friends, Family, esteemed colleagues, my book readers, LinkedIn, my LinkedIn connections, Followers, and my blog viewers: YOU ROCK!!!  
The book consists of the following chapters:
VRay Overview
Chapter 1-Pre-production; Production & post production overview
Chapter 2-Creating materials/shaders in VRay
Chapter  3-Cameras and Lighting in Vray
Chapter  4-Rendering in Vray
Chapter  5-Tips and tricks
-Interior Daylight in VRay-
Chapter  6-Pre-Production
Chapter  7-Creating the materials
Chapter  8-Lighting & Rendering
Chapter  9-Post-Production 
-Interior Night time in VRay-
Chapter  10-Pre-Production  
Chapter  11-Lighting & Rendering
Chapter  12-Post-Production
 -Exterior Daylight in VRay-
Chapter  13-Pre-Production
Chapter  14-Creating the Materials
Chapter  15-Lighting & Rendering
Chapter  16-Post-Production
 -Exterior Night time in VRay-
Chapter  17-Pre-Production  
Chapter  18-Lighting & Rendering
Chapter  19-Post-Production
 Chapter  20-Conclusion
All production and post-production tutorials are accompanied with 3d project scenes and PSD files.  
In addition, some of the tips & tricks will come with useful 3ds max scripts. 
The book also includes tips about, pre-production, camera settings, verified views, Photomontages, material editors, shaders, 3ds max scripts, and much more!
If  time allows you to glance over this new book, I hope it turns out to be interesting. :0)
P.S: For those who couldn't acquire my previous title, please rest assured that, Taylor & Francis guarantees the delivery of all pre-orders (Paperback and Electronic formats)!   

Thank You