Wednesday, August 21, 2013

DiffuseHitCache

DiffuseHitCache is a PRMan attribute that have the renderman to do a lookup to a pointcloud or brickmap file for the indirect illumination at the ray hit point. In normal scenario, if you have a blue floor and a grey ball sitting on it, you should see the blue color bleeding onto the base of the sphere. The result I am hoping to achieve is have blue floor reflect other colors than blue.




















If you wanna to have the floor to bounce off yellow color regardless of what the floor color is, you will first need to have the floor with yellow color. Next, create a RMSGIPtcLight and set the Bake Type to Create RenderRadiosity. This will generate a PointCloud file with Cs channel representing the color of the scene objects.

Point Cloud file of the scene
























We will be uisng this pointcloud file for the renderman to lookup to during the indirect illumination pass. You could run a brickmake command to convert pointcloud file to brickmap which does the same thing except for speed difference. For a simple scene like this, using a brickmap will not speed up a lot anyway.

For this to work, the pointbase way of achieving indirect illumination will not work. We will need to switch over to using Raytracing. Delete the RMSGIPtcLight node and any Render Radiosity pass. Create a RMSGILight node, then we need to add a few PRMan attributes to the floor object.

Diffuse Ray Shading - set this to Cache so that at the time of indirect illumination, you can tell renderman to look up for a point cloud or brick map file.

Diffuse Hit Cache - this is where you specify the path to the pointcloud or brickmap file. Beware that you will have to write it in this format:
file: D:\myFile.ptc

Pre Shape MEL - the final step is to add this attribute with the following command:
RiAttribute "shade" "string diffusehitcolorchannel" "Cs";
this will instruct renderman to lookup to the Cs channel in the pointcloud file.

Now, the floor can be any color but the color that get bounces off from the floor will be yellow.


Wednesday, August 7, 2013

Point Base and Brickmaps in RMSGIPtcLight




















In the Renderman Studio there is an option to cache GI into Point Clouds or Brickmaps, using RMSGIPtcLight node.

There are three options for Bake Type.

Information about the Point Clouds and Brickmaps usage are the best of my knowledge at the moment.

1)  rmanRenderRadiosityPass
- this first method will simply generate a point cloud file (rmanRenderRadiosityPass.0001.ptc). This point cloud will store the direct illumination data and the actual indirect calculation(The last bounce) will still need to be calculated during the beauty render. Having a point cloud file allows Renderman to load the point cloud scene into memory and use it for indirect illumination calculation.

2) rmanPartialFilterApproxGlobalDiffusePass
- this second method will first output a rmanRenderRadiosityPass.ptc point cloud file, the same as the first method, then run a PTFilter command on this point cloud to generate the next point cloud, rmanPartialFilterApproxGlobalDiffusePass.ptc which store indirect illumination data in it. The name Partial might suggest that the last ray bounce will still need to be calculated at beauty rendering time. The benefit of this second rmanPartialFilterApproxGlobalDiffusePass is that it enable more than one bounce to be performed.

3) rmanMakeFilterApproxGlobalDiffusePass
- the third method will generate two point cloud files and a brick map file. As usual rmanRenderRadiosityPass.0001.ptc will be first generated. PTFilter command will run and process this point cloud file to generate the second point cloud file rmanFilterApproxGlobalDiffusePass.0001.ptc. This second point cloud file has more data, includes indirect diffuse, occlusion. Later, the next command brickmake will be run on the second point cloud file to generate a brickmap file.

So the question will be which method will be the best option for certain scenario. In a very early conclusion, brickmap method seems to be the best as it is more memory efficient as brickmap data has multi resolution level which can be loaded accordingly. For example the buildings far away in the background will use the first level, the most "light" version. However, there will be pre point cloud pass needed for brickmap generations. 

Point cloud file on the other hand is an unorganized data. A more efficient way to create Point Cloud file will be the use of Organize Point Cloud format, which storing its data in Octree. But then again, a pre pass point cloud file will be needed.

Full ray trace will be the more elegant solution then :)

Friday, August 2, 2013

Silver Skull Raytrace Renders

Have been doing some test Raytrace render using Renderman Studio. Practice works:

Sunday, July 28, 2013

Multi Displacement Setup in Slim

Well, not exactly multi cos I have not done any setup for more than two displacement maps. Usually two displacement maps are enough for me, for now.

The setup is simply by adding map1 to map2 and reduce the final value by 0.5 again. Here's the image best explain what I did.


Linearizing your textures

Since we will be using linear workflow, we need to make sure the textures we used be linearized as well. To do this under TextureAtlas node, or any Image Map nodes inside Slim, simply make sure Linearize check box is set to ON. You can find this check box under Color Balance.

Without Linearize ON, the textures simply look wash out. If you are using Mari to create the textures you could add an adjustment layer sRGB2Linear to pre-linearize  the textures. That way you wouldn't have to worry about linearizing the textures inside Slim.


Saturday, July 27, 2013

sRGB to Linear sRGB

If you compare the renders between Maya Render View and IT, you will see that Maya Render View has a darker output and that is because Maya Render View is using sRGB as default Image Color Profile. IT is using Linear as the default output.

To make Maya Render View to match the look of IT, you will need to change its color profile to using Linear sRGB.

Run the following MEL script to set the Color Profile to Linear sRGB:

setAttr "defaultViewColorManager.imageColorProfile" 2;

Run the following MEL script to set the Color Profile back to sRGB:

setAttr "defaultViewColorManager.imageColorProfile" 3;

Maya Render View

Displacement and Trace Bias settings

Getting the displacement to show up correctly using GPSurface with Slim network, you will need to set trace displacement to ON. However, this is not done via adding Renderman Attributes to the shape nodes. Instead, it is set via the Material Ensemble node in Slim. Under Attributes -> Ray Tracing, set Trace Displacements to ON.

One other thing to note here is the Trace Bias (Just under Trace Displacements). It is set at 0.0000 by default, meaning it will use the global value (default at 0.001) found under Render Settings -> Features -> Ray Tracing -> Trace Bias: 0.001. This value may not be what you want as you can see from the renders below. There are few ways you can change the value. The simplest way is to set the global value but this will cause all the geometry to use the same value. I prefer to set it via the Material Ensemble node, so it only applies to any geometry under attached to this material.

Another way is to simply add "Trace Bias" Renderman attributes directly to the geometry shape node. You could also make changes to the Shadow Bias attribute under the Light node but that would be like changing the global Trace Bias value which I am not too sure if that is a good idea.

8 bit to 16 bit Render buffer

Rendering with IT with turn out to be very grainy. IT output images in linear. Maya render view default is sRGB. Thus the Maya Render View will look darker with the same render and that might help hiding the grains. I have not fully tested it in Maya render view but I am guessing the grains are still there if you gamma up the render image.



To solve the problem you will need to change the render output from 8bit to 16bit or even higher 32bit. I find it 16bit is good enough. You might have to restart Maya for this settings to take effects.




Current Frame Render Option

PRMan Notes

Have been playing with Renderman for quite some time both at works and personal projects. Just wanna to start blogging down all the findings cos I am getting a little forgetful with the solutions I found....

So here we go