Quantcast
Channel: ArnoldRenderer – Arnold Support Corner
Viewing all 140 articles
Browse latest View live

Exporting ASS files from Softimage with xsibatch

$
0
0

You cannot use xsibatch -export to export ASS files (because of the way sitoa implements ASS exporting). But it’s not too hard to do the same thing with SITOA_ExportScene and xsibatch -script.

This is what the xsibatch command line would look like (on Windows). For readability, I used the EXPORT_SCRIPT and SCENE variables to reduce the length of the xsibatch command line.

set EXPORT_SCRIPT = batch_export_scene.pys
set SCENE = \\server\project\scenes\elephant_herd.scn
xsibatch -processing -script %EXPORT_SCRIPT% -args -start 5 -end 20 -step 1 -scene %SCENE%

And here’s the batch export script.

I expose the basic parameters only, and I use the ASS Archive output path from the Arnold Render options, the scene name, and the [Frame] token to compose the output file name.

def main( start, end, step, scene ):
	Application.OpenScene(scene, "", "")
	x = Application.Dictionary.GetObject( "Passes.Arnold_Render_Options" )
	dir = XSIUtils.ResolveTokenString( x.output_file_tagdir_ass.Value, 0, False, None, None )

	scn = Application.ActiveProject.ActiveScene.Parameters("Name").Value	
	output = XSIUtils.BuildPath( dir, '%s.[Frame].ass' % scn )

	Application.SITOA_ExportScene( start, end, step, False, False, output )


Changing ASS files with the Arnold Python API

$
0
0

If you want to change something in existing ASS files, don’t write an ad-hoc script or your own parser for the ASS file. Use the Arnold API. The Arnold API includes a set of Python bindings, so you can fairly quickly whip up a script to do whatever it is you need to do :)

For example, we recently discovered (and fixed) an issue where exported ASS files were missing procedural nodes. SItoA exports hair data in chunks (one chunk for every 200K hairs), but the exported ASS had just one procedural for the first chunk (chunk 0), but there should be one procedural for each chunk.

Here’s what the procedural for chunk 0 on frame 5 looks like. The missing procedurals would be for bin files like Hair.chunk.1.5.bin, Hair.chunk.2.5.bin, and so on.

procedural
{
 name Hair.SItoA.5000
 dso "sitoa_curves_proc.dll"
 data "//Projects/Support/Arnold_Scenes/Hair.chunk.0.5.bin"
 load_at_init on
}

So, for my first dive into the Arnold API, I put together a basic little script to add the missing procedurals. To do this, I had to learn how to:

  • Read and write ASS files
  • Iterate over nodes and find a specific type of node
  • Get parameter values from a node
  • Create new nodes
from arnold import *
import glob


ass_file = "Hair_Archive.ass"

AiBegin()
AiMsgSetConsoleFlags(AI_LOG_ALL)
AiASSLoad(ass_file, AI_NODE_ALL)

# Iterate over all shape nodes, which includes procedural nodes
iter = AiUniverseGetNodeIterator(AI_NODE_SHAPE);
while not AiNodeIteratorFinished(iter):
	node = AiNodeIteratorGetNext(iter)
	#print AiNodeGetName( node )

	# Is the node a procedural?	
	if AiNodeIs( node, "procedural" ):
	
		data = AiNodeGetStr( node, "data" )
		name = AiNodeGetStr( node, "name" )
	
		# Find all other chunk.<chunk-number>.<frame>.bin files
		chunks = glob.glob( data.replace( 'chunk.0', 'chunk.*' ) )

		# Add procedural nodes for chunks 1,2,3...
		for i in range(1,len(chunks)):
			n = AiNode("procedural");
			AiNodeSetStr(n, "name", "%s.%s" % (name, i) )
			AiNodeSetStr(n, "dso", "sitoa_curves_proc.dll")
			AiNodeSetStr(n, "data", data.replace( 'chunk.0', 'chunk.%s' % i ) )
			AiNodeSetBool(n, "load_at_init", True)

AiNodeIteratorDestroy(iter)


AiASSWrite(ass_file, AI_NODE_ALL, False)
AiEnd()

[SItoA] Adjusting camera exposure

$
0
0

Arnold added support for per-camera exposure awhile ago:

Camera exposure control: All cameras, even custom cameras, have an exposure parameter that scales the pixel samples by 2 ** exposure . Increasing the exposure by 1.0, or one stop, produces an image twice as bright, while reducing the exposure by one stop produces an image half as bright. The default value is 0 for backwards compatibility. You can also control this in in kick with the new -e option.

In Softimage, you can access the exposure parameter though the User Options.

user-options-camera-exposure


[SItoA] Normal maps

[arnold] Getting RLM diagnostics from Arnold

$
0
0

If you want to double-check what license servers Arnold is trying to connect with, set the log verbosity level to the maximum, and you’ll get something like this:

' INFO : [arnold] 00:00:00  438mb   [rlm] checking connection to license servers ...
' INFO : [arnold] 00:00:05  438mb   [rlm]  5053@STEPHEN-PC ... DOWN
' INFO : [arnold] 00:00:05  438mb   [rlm]  5053@SOLIDANGLE-PC ... UP
' INFO : [arnold] 00:00:05  438mb   [rlm] found 1 license servers
' INFO : [arnold] 00:00:15  438mb   [rlm] checkout of arnold (version 400) from SOLIDANGLE-PC OK
' INFO : [arnold] 00:00:15  438mb   [rlm] expiration date: 31-dec-2013 (190 days left)
  • In Softimage, set the Verbosity to Debug.
  • In Maya, set the Verbosity Level to 6.
  • On the kick command line, specify -v 6.

[MacOSX] Setting solidangle_LICENSE

$
0
0

There are several ways you can do it.

  • You can use Maya.env to set the solidangle_LICENSE environment variable.

    In your Maya.env file, add this line:

    solidangle_LICENSE=XXXX@SERVER
    

    where XXXX is the port number, and SERVER is the name or IP address of the computer.

    Maya.env is located in your user Library. For example: /Users/steve/Library/Preferences/Autodesk/maya/2014.

    By default, the Library folder is a hidden folder, so you may need to un-hide the Library folder.

  • You can set solidangle_LICENSE as a system environment variable.
    1. Log in with an Administrator account and run this command to open a text editor.
      sudo nano /etc/launchd.conf
      
    2. Add this line to /etc/launchd.conf:
      setenv solidangle_LICENSE XXXX@SERVER
      
    3. Save the file and exit.
    4. Restart the Mac.

If you don’t want to restart your Mac just yet, you can try setting the environment variable like this (it will last until you restart your machine):

launchctl setenv solidangle_LICENSE XXXX@SERVER

[SItoA] Disabling camera motion blur

$
0
0

Starting with version 2.8, SItoA no longer supports the Softimage motion blur property. Instead, you use the Arnold Parameters property to control transformation and deformation motion blur.
arnold_parameters_motion_blur

However, you cannot add an Arnold Parameters property to a camera (at least not using the SItoA custom menus, which will tell you that a camera is “is not a valid Object to add Arnold Parameters to”). Here’s a couple of ways to work around that:

  • Create an Arnold Parameters property on a polygon mesh, and then in the Explorer, drag that property to your Camera.
  • Select your camera and run this Python snippet:
    cam = Application.Selection(0)
    cam.AddCustomProperty( "Arnold_Parameters" )
    

[SItoA] Troubleshooting plugin loading problems

$
0
0

Some basic tips for troubleshooting when SItoA won’t load.



[MtoA] Installing MtoA on Mac OS X

Arnold basics: camera, shadow, and diffuse rays

$
0
0

A quick, basic overview of camera, shadow, and diffuse rays.

* diffuse rays aka GI bounces.


Setting up an ambient occlusion AOV with bump mapping

More about diffuse rays

$
0
0

Another look at diffuse rays, this time focusing on ray depth and samples.

Keywords: diffuse rays, GI bounces, ray depth, samples, shadow rays, indirect illumination


Convert texture maps to .tx

$
0
0

When you’re rendering with Arnold, convert your texture maps to .tx files with maketx. Always :)

.tx textures are better because they are:

  • Tiled (usually the tiles are 64×64 pixels).

    Arnold loads one tile at a time, as needed, rather than loading the entire texture map in memory. So textures are loaded faster, because Arnold loads only what it needs to render the image.

    Arnold uses a texture cache system to efficiently manage texture memory usage: only the most recently used tiles are kept in memory. You can have hundreds, or even thousands, of 4k and 8k images, and Arnold will never use more runtime memory than the user-specified max cache size.

  • Mip-mapped.

    Mip-mapped textures are anti-aliased, even at low AA sample settings.

If you don’t convert your texture maps with maketx, the default Arnold behavior is to auto-tile and auto-map your textures for you, but this is very inefficient because it is done once for every rendered frame, rather than one-time-only with maketx.


Soccer balls and Arnold procedurals

$
0
0

I’m partial, but I like the Softimage soccer ball better than the Maya soccer ball.
soccerballs

The Softimage soccer ball is the one on the left. I took the ASS file for the soccer ball, did a few search and replace ops, and compiled my first procedural node. It’s pretty trivial, but it illustrates the basic framework. numNodes() returns the number of nodes you’re going to create; Arnold calls getNode() once for each node you create. I’m just creating one node, so I do it in getNode(), but you could also do it in init().

If you’re interested in learning more about the Arnold SDK and procedurals, you can download the SDK (docs included) at solidangle.com.

#include <ai.h>
#include <string.h>

static int init(AtNode *mynode, void **user_ptr )
{
  AiMsgInfo( "[soccer] -- greetings!" );
  return 1;
}

static int cleanup( void *d )
{
  return 1;
}

static int numNodes( void *d )
{
  return 1;
}

static AtNode *getNode( void *d, int index )
{

	AtByte nsides[540] = {
		4, 4, 4, 4, 4,
		// ...
		4, 4, 4, 4, 4};
  
	unsigned int vidxs[2160] = {
		292, 301, 12, 293, 302, 303, 304, 305, 302, 305, 306,
		//...
		169, 538, 537, 116, 168, 540, 539, 79, 151, 25, 541};

	unsigned int nidxs[2160] = {
		0, 1, 2, 3, 4, 5, 6, 7, 4, 7, 8, 9, 4, 9, 10, 11, 4, 
		// ...
		1211, 1216, 1215, 1230, 1229, 311, 322, 1231, 312};

	float vlist[1626] = {
		2.33102179f, 4.68985701f, -7.74118519f, -4.0108633f, -2.08138514f, 8.18039227f,
		//...
		1.70574367f, 2.03463793f, 9.00535202f, 2.94963598f, 0.0429565944f, 8.85224628f};

	float nlist[3696] = {
		-0.00219265698f, -0.443717808f, -0.896163881f, -0.112498537f, -0.405027777f, -0.907356858f, 
		//...
		-0.316353977f, -0.846433043f, 0.428335458f, 0.514008343f, -0.00765316607f, 0.857751012f};

	AtMatrix m;
	AiM4Identity( m );
	
	AtNode *n = AiNode( "polymesh" );
	AiNodeSetByte(n, "visibility", 255);
	AiNodeSetArray(n, "vlist",  AiArrayConvert(1626,  1, AI_TYPE_FLOAT, vlist));
	AiNodeSetArray(n, "nsides", AiArrayConvert(540,  1, AI_TYPE_BYTE,  nsides));
	AiNodeSetArray(n, "vidxs",  AiArrayConvert(2160,  1, AI_TYPE_UINT,  vidxs));
	AiNodeSetArray(n, "nlist",  AiArrayConvert(3696,  1, AI_TYPE_FLOAT, nlist));
	AiNodeSetArray(n, "nidxs",  AiArrayConvert(2160,  1, AI_TYPE_UINT,  vidxs));
//	AiNodeSetArray(n, "uvidxs", AiArrayConvert(384,  1, AI_TYPE_UINT,  uvidxs));
//	AiNodeSetArray(n, "uvlist", AiArrayConvert(270,  1, AI_TYPE_FLOAT, uvlist));

	AiNodeSetMatrix(n, "matrix", m );

	AiNodeSetStr(n, "name", "SISoccerBall");
	return n;
};



// --------------------------------------------------------------------------------
// dso hook.
// --------------------------------------------------------------------------------
proc_loader
{
  vtable->Init     = init;
  vtable->Cleanup  = cleanup;
  vtable->NumNodes = numNodes;
  vtable->GetNode  = getNode;
  strcpy_s(vtable->version, AI_VERSION);
  return 1;
}

Object color mode

$
0
0

The Arnold Utility shader has an Object color mode, which assigns colors based on shape names. When we say “shapes”, we don’t mean Maya shape nodes; we mean the Arnold shapes.

C:\solidangle\mtoadeploy\2014\bin>kick -nodes | find "shape"
 box                              shape
 cone                             shape
 curves                           shape
 cylinder                         shape
 disk                             shape
 ginstance                        shape
 implicit                         shape
 nurbs                            shape
 plane                            shape
 points                           shape
 polymesh                         shape
 procedural                       shape
 sphere                           shape

All these nodes have a name parameter (for example, polymesh.name) that is a unique string identifier in the Arnold universe. So when you use the Object color mode, you get a unique color for each node.

If you’re using Softimage, note that SItoA puts the frame number into polymesh.name, so you’ll get a different color on each frame if you use the Object color mode. For example, on frame 5 a polymesh might be named “Dog_Mesh.SItoA.5000″, and on frame 6, “Dog_Mesh.SItoA.6000″.

In this render region comparison, you have frame 5 on the left, and frame 6 on the right:
dog_color_mode

In a case like this, you would use the Object ID color mode instead. SItoA automatically assigns unique IDs to the shape nodes (MtoA doesn’t).


[Arnold] [MtoA] Disabling Skip License Check

$
0
0

watermark
If you render a scene that has Skip License Check enabled, you’ll get the Arnold watermark. One way to make sure this doesn’t happen is to turn off Skip License Check from the command line:

render -r arnold -ai:slc off some_scene.mb
kick -set options.skip_license_check off -dp -dw some.ass

You might also want to enable Abort on License Fail (-ai:alf for render, -set options.abort_on_license_fail for kick).

[Tip] Searching the docs

$
0
0

Here’s a few tips for searching the docs at support.solidangle.com

If you don’t see any useful suggestions when you type in a search, click the “Search for” link. That will take you to the Search page.
search-tips-1

On the Search page, you can narrow down your search to a specific “space”, such as the Maya User Guide or the Softimage Tutorials.

search-tip-1a

If you don’t see the space you want, just start typing “Softimage” or “Maya” or “Arnold” in the search box, and then you’ll see those spaces and you can search just that one specific space.

search-tip-1b
You can also search for specific types of content, such as Pages or Blog Posts. I often click Pages to get rid of all the images (attachments) that show up in the search results.

[Linux] Missing .sog files?

$
0
0

Sometimes on Linux you may get “unable to load dynamic library” errors for .sog files. Like this:

00:00:00     0MB WARNING |  unable to load dynamic library: /home/stephen/solidangle/mtoa/2014/xgen_procedural.sog: cannot open shared object file: No such file or directory 

or this:

00:00:00     0MB WARNING |  unable to load dynamic library: /usr/apps/houdini/houdini-13.0.343/htoa/arnold_plugins/driver_houdini.sog: cannot open shared object file: No such file or directory 

Don’t worry about the “.sog” part. In most cases, Arnold isn’t actually looking for a .sog file. Arnold is trying to load a .so file, and either the .so itself or a dependency is missing. The “.sog” is printed by mistake in the log message (and this is fixed in the next Arnold version).

So (heh) focus your investigation on why Arnold couldn’t load the .so file (try running ldd on it).

In the two examples above:

  • xgen_procedural.so couldn’t be loaded because LD_LIBRARY_PATH didn’t include the Maya lib folder, so all the tbb-related libraries were missing.
  • driver_houdini.so was missing some Houdini dependencies, but in this case it was being loaded into MtoA, so driver_houdini wasn’t needed and the warning could be safely ignored.

What’s a .sog?
If a plugin has a .sog extension, AiLoadPlugins() will load the plugin with RTLD_GLOBAL, which means the symbols from the plugin will be globally exposed and available to other plugins.

.sog is a Maya naming convention for an .so to be dlopen’ed with RLD_GLOBAL

[Arnold] Standins and the ASS file cache

$
0
0

Did you ever notice the ASS file cache stats in the Arnold log? It’s a breakdown of how many unique ASS files were loaded, and how many were reused:

03:11:33 8868MB | -----------------------------------------------------------------------------------------
03:11:33 8868MB | .ass file cache:
03:11:33 8868MB | unique (loaded from disk)     10 ( 1.00%)
03:11:33 8868MB | reused (found in cache)      990 ( 99.00%)
03:11:33 8868MB | total referenced .ass files 1000 (100.00%)
03:11:33 8868MB | -----------------------------------------------------------------------------------------

Roughly speaking, this caching of standins means that if you have 100 standins that all load the same ASS file, you’ll get one set of geometry and 99 instances of that geometry. That saves memory and I/O time and is just more efficient.

More here…

[Arnold] For licensing, the release date is the version

$
0
0

license_version

The latest Arnold version number is 4.2.0.5, but that’s not the version number we use for licensing. Arnold licensing uses the Arnold release date (yyyymmdd) as the version number. For example, if you have a license for version 20140512, you can any version of Arnold released before 12 May 2014.

More here…

Viewing all 140 articles
Browse latest View live