Tuesday, 25 November 2014

Animation - Upgrading Shopping Centre HEUVEL Eindhoven

Below is a video produced by Jeroen Tapper from Tapperworks, and was done using the OctaneRender for ArchiCAD plugin.  The original duration of the video is 7:21 minutes and is reduced by 'fast forwarding' the main part and deleting a few scenes at the end.  The goal is not a photorealistic impression, but to give insight of the building upgrade sequence in an artistic way.



More of Jeroen's video's are available at https://www.youtube.com/user/Tapperworks/videos

Tuesday, 18 November 2014

Accessing Octane plugin data from python in Poser

The OctaneRender for Poser plugin is largely implemented in python. You can write your own python code to tweak Octane settings using the following approach.  Use the following information at your own risk!  Remember to make a backup of your Poser scene prior to running python code which directly interacts with the plugin.

Loading the plugin in a PythonShell

Load the plugin via the following python code:
octanePlugin = __import__("OctaneRender for Poser")
Octane Data

The Octane scene data is stored in:
octanePlugin.Globals.m_SavedTreeInfo

Do not modify the above variable if the plugin Setup window is open.  If the above variable is {}, then the plugin has not yet been run for the current scene. After running the plugin, querying octanePlugin.Globals.m_SavedTreeInfo will return a large python dictionary.

To access a rendertarget setting (for example the Maxsamples settings in the kernel), use the following python code:
octanePlugin.Globals.m_SavedTreeInfo['rendertarget']['kernel']['maxsamples']['value']

You can change the Maxsamples with:
octanePlugin.Globals.m_SavedTreeInfo['rendertarget']['kernel']['maxsamples']['value'] = 100
Remember, only modify values if the setup window is closed.

OctaneCommands

Close the Viewport
octanePlugin.UiManager.GetViewportForm().CloseWindow()
Close the Setup Window
octanePlugin.UiManager.GetSetupForm().CloseWindow()

Changing the Octane background image each frame in Modo

The OctaneRender for Modo plugin does not support animated backgrounds (since the background is not saved by Octane in the png when the Viewport is saved).  However there may be situations where you still want to see the background image change when you change frames on the Modo timeline.  The following LUA script will do this.

1) Copy and paste the following code into AnimateBackground.lua (save it somewhere on your filesystem)

 -- lua  
 fps = lxeval( "time.fpsCustom ?" )  
 frametime = lxeval( "select.time ?" )  
 ok = lx( "octane.selectKernel" )  
 local str = string.format("c:\\MyDocuments\\MyBackgroundImage_%04i.jpg", frametime[1] * fps[1]);  
 ok = lx( "item.channel oc_backgroundImageFilename {".. str .."}" )  

2) Each time you move the Modo frame slider, run the above script (via Modo -> System -> Run Script -> AnimateBackground.lua).  For frame 0 it will load MyBackgroundImage_0000.jpg.  For frame 1, MyBackgroundImage_0001.jpg, etc.  You may need to adjust the code to select the correct file.

You can also run the script from the Modo command panel via the following command:
@{c:\PathToTheLuaScript\AnimateBackground.lua}
You could also use python code instead of LUA to achieve the same result.

Monday, 17 November 2014

Randomizing Family Instances in Revit

The OctaneRender for Revit plugin will apply all instances of a Family Instance with the currently select proxy.  However if you want to randomize the rotation of the Instances, how can this be done?  One method is to use a small python script.  This is done as follows:

1) Download and install Python (for your Revit version) and Vasari from https://code.google.com/p/revitpythonshell/

2) Start Revit, load the scene with the Family Instances you want to randomize

3) Select an instance of the Family Instance you want to randomize 

3) In the AddIn tab, click the new Interactive Python Shell button


4) Copy and paste the following code into the lower window

 import clr  
 import System  
   
 clr.AddReference('RevitAPI')  
 clr.AddReference('RevitAPIUI')  
 from Autodesk.Revit.DB import *  
   
 app = __revit__.Application  
 doc = __revit__.ActiveUIDocument.Document  
   
 transaction = Transaction(doc, 'Randomize family instance rotation')  
 transaction.Start()  
   
 seed = 215  
 rand = System.Random(seed)  
   
 # Get the current selection  
 selection = __revit__.ActiveUIDocument.Selection.Elements  
 if selection.Size != 1:  
   print "A single family instance must be selected"  
 else:  
   for item in selection:  
     currentElement = item   
   print "Current Selection = " + currentElement.Name  
    
   collector = FilteredElementCollector(doc)   
   collector.OfClass(FamilyInstance)  
   
   famtypeitr = collector.GetElementIdIterator()  
   famtypeitr.Reset()  
     
   count = 0  
       
   for item in famtypeitr:  
     famtypeID = item  
     faminst = doc.GetElement(famtypeID)  
     if faminst.Name == currentElement.Name:  
       # Setup the rotation axis  
       p1 = faminst.Location.Point;  
       p2 = XYZ(p1.X, p1.Y, p1.Z + 10);  
       rotationAxis = app.Create.NewLine(p1, p2, True)  
        
       # Apply a random rotation  
       faminst.Location.Rotate(rotationAxis, rand.Next(0, 360) * 180 / 3.14159);  
       count += 1  
        
   print "Randomised " + str(count) + " family instances of " + currentElement.Name  
    
 transaction.Commit()  


5) Click the Run button in the lower window toolbar


All the instances should now be randomly rotated between 0 and 360 degrees.  You can modify the above code to limit the random rotate, etc.


Friday, 14 November 2014

Octane Notes

Following is general info on Octane for my Octane plugins and Octane Standalone, which may not be provided in the Octane manuals, but which will hopefully help people with the more common issues encountered.  If you have an questions - pls post of the Otoy Forums (http://render.otoy.com/forum).

Pls see http://poserphysics.blogspot.com.au/2016/03/installing-nvidia-drivers-on-linux.html for installing Nvidia drivers in Linux.

Octane will not run, or you are getting cuda errors: 
1) Reboot and try again
2) Check the Octane Log (in the plugin or Octane Standalone)
3) If a 3d app Octane plugin will not run, check to make sure Octane Standalone renders.  If it DOES, it may be another plugin which is interferring with Octane.  In this case, disable all plugins other than the Octane plugin and see if it works.
4) Cuda error 999's are generally a driver or hardware problem.  Under-clocking your card may resolve this issue if it is a hardware fault.
5) If getting cuda errors part way through a render or animation, your card may be overheating.  Use GPU-Z to check.

6) If the Viewport is black,  check to ensure at less one Cuda device is selected in the Cuda Devices panel of the plugin/Standalone.
7) You will get a cuda error if you have exceeded the triangle limit of Octane.  The current triangle limit is 19.6 million (if you have no motion blur, hair strand data or displacement).  If your scene has quads, each quad will result in 2 Octane triangles.  Octane 3 will remove the triangle limit.

Noise-Free Renders
1) Reduce Imager->Hot Pixel (to remove fireflys)
2) Increase Kernel->Caustic Blur (to smooth out Specular and Glossy material highlight noise)
3) Use the Emitters tips below
4) Reduce Kernel->GI Clamp (Try 1.  Otoy recommend a GI Clamp of ~10-100x the inverse of the exposure)
5) If you have noise in dark areas this may be due to paths being terminated early, so reduce Kernel->Path Termination Power (thank Marcus for this one)
5) If the light illuminating the scene has come through a specular (glass) material, using “pmc” rather than “pathtracing”.  In this situation you can also reduce “kernel”->”direct_light_importance” to give the light that has passed through the glass more priority.  Also, you can let more direct light through the glass by reducing the glass material’s opacity (from 1 to say 0.2).

Emitters
1) Use low-polygon emitters if possible (a single polygon plane is best)
2) For IES emitters, load the IES file into a Greyscale Image node connected to the Distribution pin of the Emission node.
3) If using an IES distribution with a Spherical projection in Normal coordinate space, you will get light emitting from each polygon in the mesh in the direction of the normals
4) If geometry is connected to an Octane Placement or Scatter node, the emission power will be adjusted by the Placement/Scatter scale.

Auto-focus
1) When Auto-focus is enabled, thefocus distance is determined from the camera to the geometry at the very middle of the render.  If there is no geometry in the middle of the render, the focus distance may be invalid, and the render will be out of focus.

Displacement Mapping
1) If using a Displacement map, remove any Bump or Normal maps.
2) If you use a Displacement "Amount" of 0, the object will not render
3) Octane assumes black pixels in the displacement map have 0 displacement.  If using a displacement map where 0 is a negative displacement (for example, a map generated from ZBrush), put a "Shift" of negative half the "Amount" (ie. if the Amount is 0.01, the Shift will be -0.005)
4) Large polygons with displacement will render artifacts if the displacement Amount is small.
5) Displacement mapping requires UV Projection surfaces.  It requires a displacement texturemap, and procedural textures and Octane nodes which modify the displacement texturemap will be ignored.  Similarly, the Displacement Texture Greyscale Image "Power", "Gamma" and "Invert" pins are ignored
6) Very large displacement "Amount" values may position vertices in an invalid position which may crash Octane.  So start with small (0.001) Amount values and increase from there.
7) Displacement will only work on surfaces which have been UV mapped (and have UV coordinates)
8) The Power, Gamma, Invert and Border Mode of the Image node used as the Displacement Texture will be ignored when determining the displaced surface

Round Edges
1) Round Edges require that the edge between the two surfaces has shared vertices.  
2) Round edges should only be used for very small amounts of rounding.  For large round edges, use geometry.

Wednesday, 5 November 2014

Octane Render Passes

The following images show the render passes available from Octane 2.10.  These were rendering in the Modo plugin, but are available from all the plugins, and Octane Standalone.

Beauty Passes (rendered in parallel to the normal beauty render)

Info Passes (rendered before, during or after the beauty pass - user controlled)