SourceForge.net Logo

CGRU

CGTALK.RU Logo

Rendering Passes with p_MegaTK shader




What we need?

p_MegaTK - surface shader should be assigned to all objects you want render with passes or without it. If you don't need multipass rendering you may still use p_MegaTK as common surface shader.

p_PointTK, p_DirectTK and p_SpotTK - light shaders should be assigned to all lights in scene if you want get correct passes.

p_MegaTK_pass - geometry shader should be assigned to dummy object (for example to poly Cube) to Geometry Shader slot on transform node if you have no mental ray stand alone and my m2mr script for it and want render passes.

1. Create new scene. Create objects and lights like this:


scene01

2. Create p_MegaTK shader. And assign it to all objects.

3. Create two p_SpotTK light shaders. And assign it to spot lights.

4. Tune up your shader:
for example...
enable "Use Occlusion" option for p_MegaTK shader.
enable "Ambient".
enable "Reflection" and set "Fresnel" to 0.5.
adjust light intensity in p_SpotTK light shader.
adjust any parameter you want.
Render...


scene02

5. Scene ready for rendering. Now we need enable passes. Create any dummy object, for example poly cube.

6. Create p_MegaTK_pass geometry shader and assign it to transform node of dummy object(cube).
If you are using 3dsmax, you should attach geometry shader to special object 'mr Shader', it will be available after installing mrGeomShaderObject.dlo plugin. You may find it in 3dsmax SDK (source code only) or download compiled version from http://www.maxplugins.de (direct link for 3dsmax 9 - http://www.maxplugins.de/r9_files/pavel/mrGeomShaderObject_max9.zip)
If you couldn't find 'mr Shader' in creation menu after installing plugin, please try to set 3dsmax GUI preset to 'mental ray'.

scene02

7. Open p_MegaTK_pass properties. Set name for file, for example "test_name". Set path for rendering, for example "c:/render_test" for windows or "/home/current_user/render_test" for linux (you should create this dir before render). Enable passes you want render.


AE_screen

8. Just render your scene and you'll get these files:

test_name.amb_occlus.0001.tif
test_name.ambient.0001.tif
test_name.color.0001.tif
test_name.diff_occl.0001.tif
test_name.diffuse.0001.tif
test_name.reflect.0001.tif
test_name.shading.0001.tif
test_name.shadow.0001.tif
test_name.spec_shd.0001.tif
test_name.specular.0001.tif


scene02

It's 3x32bit images. You may view it with: imf_disp, Photoshop CS2 or any compositing software like: Nuke, Shake, Digital Fusion or After Effects(ver 7.0 and higher, previous versions don't support 32bit images)
Please don't worry about that some passes may looks like it's not antialiased, just combine all passes in compositing software and you'll get normal image.

9. Compose images using your favorite software. You should use this formula:

color*diff_occl*diffuse*shadow + specular*spec_shd + amb_occlus*ambient + reflect + refract + indirect + incand

or this simple formula if you don't need full control, but need more speed: shading + specular*spec_shd + amb_occlus*ambient + reflect + refract + indirect + incand


shake graph
Shake Graph


nuke graph
Nuke Graph

10. Well done.

11. 'Mitchell' and 'Lanczos' filters don't recommended. These filters may cause of some artifacts during render passes (negative pixels and some noise). Please use more simple filters like: 'Gauss', 'Triangle' or 'Box' ('Triangle' 2 2 recommended).
If you have no any artifacts with filtering (check it in compositing software after combining all passes) you may use any filter you want, but please be careful.

If you still have some artifacts in your passes, please try disable filtering (set filter 'Box' 1 1).
It's not shader limitation, it's recommendation for all multipass rendering techniques, mostly if you render to float point format(32 bit per channel).





SourceForge.net Project

CGRU

Раздел на форуме CGTALK.RU