—
(汉氏秘笈)
帖子后面有部分图片是反盗链的,会员们看不到的,请楼主上传到论坛并插入布局好图片
(2012-09-09 12:30)
—
这篇教程主要讲述了如何用分层渲染合成的方法来制作无闪烁且更高效的动画。 本日志参考Spot3D-Chaos Group门户网站教程转译,源网页地址: 由于本人经验及水平有限,转译可能有部分偏差。 Wu[&Wv~
这种合成方法具有较高的实用性,在包含移动对象的场景使用分离渲染再合成的方法可以大大提高工作效率。 这种方法可以用于:3dsmax+vray下的包含较少部分移动对象的建筑动画和其它类似的情况下。 请注意,这篇教程的分层渲染是借助VR球形褪光 实现的,而非VR无光对象。 相比无光对象有它特殊的优势。 这种方式通过将运动物体和静止的场景分开,用穿行模式渲染背景,用逐帧渲染运动物体。这种方式极大的提高了对于包含运动物体的渲染效率。 请注意,这种方式可能看起来比较繁琐,但是它是无损失的,常规的很多分层方法都会造成影子发虚等损失,这种方式则不会,虽然它看起来要麻烦一点,但是仍然是高效且有意义的。 请注意,它的合成方法是基于图形通道混合运算,节点后期软件支持这些运算,如fusion、nuke,AE则不支持。 ----------------------------------------------------------------------------------------------------------------------------------------------------------- General 概述 3?V_BUoON In this tutorial we will render an animation with moving objects and GI with V-Ray. The goal is to make the process as efficient as possible. We can always use a high-quality GI solution to render an animation without any special tricks, however this will typically take very long. We would like to optimize this process as much as possible. * +"9%&? 在本教程中,我们将用VR渲染移动物体(场景中移动的参加渲染GI计算的对象,也就是不包含摄影机,辅助对象等等)的动画。我们的目标是使这一过程尽可能高效。我们可以使用高品质的GI解决方案、没有任何技巧的高参数来渲染高质量的动画(因为场景中包含移动的物体,你必须为每一帧渲染GI,静态场景的渲染方法使用于动画场景会出现黑斑),但是这通常要消耗很长的时间,我们希望尽可能的优化这个过程。 BJM.iXU)[ /aZ+T5O Typically, we have a small number of moving objects (i.e. a few characters) in some more complex environment. Our main optimization idea uses this fact: we can split the animation into a background part, and animation part. '98VYCL 通常情况下,在我们复杂的场景中只有少数的移动物体。我们的主要优化方案使用了这样一个办法:我们可以分离动画的背景部分和运动部分。 = \'}g? d1AioQ9 Since the background does not move, we can render it using a walk-through animation method, for example as pointed out in this tutorial. Then we can render out the moving objects, and composite these for the final animation. W6?pswQ 由于背景是不动的,我们可以使用穿行动画的方案来渲染它。然后我们渲染移动物体。最后综合这些动画形成最终的结果。 Z>)Bp/-
9N@W\DT Compositing basics 合成基础知识 kCR_tn
4 Before we go into details on rendering the animation, we will cover some compositing basics. Gft%Mq
v 在我们进入具体的内容之前,我们将介绍一些合成的基础知识。 yeXx',]a NidIVbT.A Our task is this: given an object in a 3d scene, we would like to composite it over a given background, taking into account as many effects as possible (shadows, reflections, GI etc). =]6%G7T 我们的任务是这样的:在三维场景中的对象,我们想将它合成到指定的背景中,并且还要考虑到很多效果(阴影,反射,GI等)。
coW:DFX N5Q[n d This is typically done with the help of two layers with the 3d object, which are then composited over the background. We will call one layer a mask layer, and it determines which parts of the background are altered by the 3d object, and which parts remain the same. The mask layer is multiplied by the background. We will call the second layer object layer, and it determines what color must be added to the masked background in order to get the final image. The object layer is added to the masked background. X:HacYqtC 通常的做法是在几层图像的帮助下,通过在背景上合成来达到目的。我们将其中一层称为遮罩层,它决定背景中哪一部分是变化的三维对象,以及哪一部分是不变的。遮罩层复合到背景层。我们将二层称为对象层,它决定了哪些颜色被添加到复合背景上,以获得最终的图像。对象层被添加到复合背景层上。 AL9chYP}/ 8(pp2r lR So, in general, the compositing formula is this: &e E=<x 所以,一般的合成公式是: PVe
xa|aaX 3{'Ne}5%I final_image = background_layer * mask_layer + object_layer nyQ&f'< 最终图像=背景层*遮罩层+对象层 (*是倍增 +是添加 详细请参考图形通道布尔运算) .+PI}[g
z[b@V Our background layer is given, and we don't have to worry about it. It may be a photograph, live footage, or a prerendered image. We must determine only the mask layer and the object layer. We will compute these using three separate renderings of the 3d object: 7%5z p|3 我们不必去考虑背景层。它可能是一张照片、现场录像或者预渲染的的图像。我们必须确定遮罩层和对象层。我们将为三维对象计算独立的渲染。 C'9Cr}cZ. TrlZ9?3#D - a render without the object; we will call this "pure" render;
- a render with the object, but with a perfectly black material applied to the object; we will call this "black" render;
- a render with the object with a normal material; we will call this "normal" render.
- 没有对象的渲染,我们称为“pure”渲染。
- 对象的渲染,但是应用纯黑色材质给对象,我们称为“black”渲染。
- 正常材质的对象渲染;我们称为“normal”渲染。
J"!vu.[ Given these three renders, we can compute the mask layer and the object layer in this way: Vc 1\i 由于这三次渲染,我们可以从中得到遮罩层和对象层: XW[j!`nlk `` ,fodA8 mask_layer = black / pure; \nXtH}9ZF object_layer = normal - black; 5 h-@|t 遮罩层=black/pure; D9<!mH 对象层=normal-black; !\-{D$E?H yQU{zY Then, we can use the mask and object layers to composite the final image. (7vF/7BZ|_ 然后,我们可以用遮罩层和对象层复合出最终的图像。 P@Hs`= pV9IHs} o*b] p- Compositing in 3dsmax 在3DSMAX中合成 (这一章节说了很多废话,主要的核心技术理论在下一章 VR球形褪光) ohRjvJ'v| Now, let us apply all this theory in practice. We will use 3dsmax for compositing, but this can be done in any compositing program that supports the necessary image operators (addition, difference, multiplication and division) - for example, Digital Fusion. 7r7YNn/? 现在,让我们在实践中应用这些理论。我们将使用3DSMAX合成,但它也可以在任何支持所需的图像运算(相加,差值,相乘,相除)的合成程序中完成。比如Fusion, nuke(注意的是,AE不支持通道布尔运算的,节点编辑软件支持,AE为层级编辑软件)。 Hkk/xNP 6g2a[6G5 Unfortunately, 3dsmax does not have the necessary compositing operators built-in, so we are going to use an additional plugin, the VRayCompTex texture map。 ;!=G 不幸的是,3DSMAX没有内置必要的合成环境,所以我们要使用一个额外的插件。VR合成纹理 贴图。 69PE9zz 2POXj!N This is the background plate that we will use: -C;^3R[
O 这是我们要使用的背景: 8LyD7P1\ SOs:]U-T3 q]\:P.x!> We are going to add a teapot in the middle of this rendering. US+Q~GTA 在此次渲染,我们要在中间添加一个茶壶。 |EIng0a c-x,fS"&W 1.1. Open the starting scene, which can be found here. The scene is not exactly the same as the one that was used for the background plate, but it is close enough for the composition. In general, you should try to match the plate as best as possible. If the background plate is a rendered 3d scene, then it would be best to use the same scene. 3]OE}[R 打开初始场景(后面是一堆废话)。 y_'Ub{w cW~}:;D4 1.2. Render the scene and save it as normal.png, with 48 bits per pixel (for increased precision during the compositing later on).
d:_t-ZZo 渲染场景并保存至 normal.png 文件,使用48位每像素(以便在合成时保留余量,每通道16位)。 x5|I ynmWW^dg .4_o>D 1.3. Open the material editor, create a new VRayLightMtl and assign a pure black color to the material - or you can use the black mtl material in the ME. Apply the material to the teapot in the scene. }wWKFX 打开材质编辑器,创建一个新的VR灯光材质并指定一个纯黑色材质- 或者你可以使用黑色应用给场景中的茶壶。 y>R=`A1b @+;$jRwq 1.4. Render the scene and save it as black.png with 48 bits per pixel (for increased precision). wJg1Y0nh 渲染场景并保存图像为black.png,使用48位/像素 设置(提高精度)。 ~Xw"}S5 g6W)4cC8a VGLaN%| 1.5. Hide the teapot. anuL1fXO 1.6. Render the scene and save it as pure.png (again, with 48 bits per pixel). zqd@EF6/bz 隐藏茶壶。 > pgX^ 渲染场景并保存图像pure.png(同样48位/像素)。 v.\*./-i `+`Z7 This is all the work we have to do with the 3d scene. Now we are going to composite the final result. d[[]PX 这是我们在3D场景中所有要做的工作。现在我们开始复合最终的图像。 *RT>`,t/ |HU@
> 1.7. Open 3dsmax with an empty scene. ,9?BcD1 1.8. Open the Material Editor and put the four images (normal.png, black.png, pure.png and the background) into four separate bitmap textures; set the mapping mode of the bitmaps to Screen environment. ?xK8# 打开3DSMAX(默认空场景状态)。 dCb`xR} 打开材质编辑器 ,把4张图像(normal.png, black.png, pure.png and the background)分别分配到4张位图纹理;设置位图纹理的贴图模式为屏幕环境。 VzBqjE_ 9s_vL9u Now we will create the mask and object layers. JROM_>mC 现在我们可以创建遮罩层和对象层。 2<li7c59 WegtyO 1.9. Create a VRayCompTex and name it object. c/Qt Ot 1.10. Drag the normal bitmap onto the Source A bitmap slot in the VRayCompTex (choose the Instancemethod when prompted). Gn&-X]Rrl 1.11. Drag the black bitmap onto the Source B bitmap slot in the VRayCompTex (again, choose the Instancemethod). - *F(7$ 1.12. Set the Operator of the VRayCompTex to Difference. This is what you should get: ?MXejEC 创建一个VR合成纹理并命名为对象。 1D16 拖动normal到VR合成纹理中的 来源A 操作框中(当出现提示时选择实例方法)。 Xm+8 拖动black到VR合成纹理中的 来源B 操作框中(同样选择实例)。 rxr{/8%f% 设置VR合成纹理中的 操作符 为 差异,你会得到这个: rI^zB mrr ]"+95*B Now we have our object layer. Next, we need to create the mask layer. "8'@3$>R= 现在我们有了对象层,接下来,我们需要创建遮罩层。 6Z#\CixG ^BUYjq%(` 1.13. Create a new VRayCompTex in an unused slot of the material editor and name it mask. :q
ti 1.14. Drag the black bitmap onto the Source A bitmap slot in the VRayCompTex (choose the Instance method when prompted). lAzjN~V 1.15. Drag the pure bitmap onto the Source B bitmap slot in the VRayCompTex (again, choose the Instancemethod). ex+\nD>t4 1.16. Set the Operator of the VRayCompTex to Divide. This is what you should get: G+F#n6Vx 在材质编辑器中创建一个新的VR合成纹理并命名为遮罩。 \(VTt|}By$ 拖动black图像到 来源A (实例)。 T(AVlI6 拖动pure图像熬 来源B (实例)。 /R~1Zj2& 设置运算符为 相除。你会得到这个: \=+b}mKV
m !iH-#B- Now we have the mask and object layers for the final compositing. We need to combine these with the background to get the final image. W3D c r@Dy 现在我们拥有了用来合成最终图像的遮罩层和对象层。我们需要将这些结合到背景上来得到最终的图像。 xfy1pS.[: umF
Z?a 1.17. Create a new VRayCompTex in an unused slot of the material editor and name it masked bg. %YSpCI 1.18. Drag and instance the mask texure into the Source A slot of the VRayCompTex map. N B\{' 1.19. Drag and instance the background bitmap into the Source B slot of the VRayCompTex map. *.~6S3} 1.20. Set the Operator of the VRayCompTex to Multiply. 6el;Erp 在材质编辑器上创建一个新的VR合成纹理并命名为masked bg。 %|^OOU} 拖动 遮罩 材质实例到 来源A。 )uK{uYQl 拖动 背景 图像实例到 来源B。 |}{B1A 设置运算符为 相乘。 K=C!b? mNb ?*3\ Now that we have the masked background map, we need to add the object map to it. Z4A!U~ 现在我们拥有了遮罩背景贴图,我们需要给它添加对象层。 {%VV\qaC by'DQ 00 1.21. Create a new VRayCompTex in an unused slot of the material editor and name it final. 7_.11$E=H 1.22. Drag and instance the masked bg map into the Source A slot of the VRayCompTex. :Xn7Ha[f 1.23. Drag and instance the object map into the Source B slot of the VRayCompTex. :N<.?%Kf 1.24. Set the Operator of the VRayCompTex to Add. *[r! 在材质编辑器上创建一个新的VR合成纹理并命名为final。 6*qL[m.F[o 拖动 masked bg 实例到 来源 A。 V7Z4T6j4 拖动 对象层 实例到 来源B。 ,bM-I2BR 设置运算符为 相加。 oT{@_U{*J l"q1?kaVg ~%/Wupf J0
k 'qArf This is our final composite texture map. Here is a schematic view of how we have connected the four input images: L>!8YUz7p$ 这是我们合成的最终图像。这里是我们连接4张图像的示意图: yJsH=5A cO\- Now we need to render that map in order to get the final image. ;uqx@sx ; 现在我们需要渲染以获得最终的图像。 F(
Ak >S1)YKgz 1.25. Open the Render scene dialog and in the Common Tab set the resolution to 600x600 (the resolution of all our images in this section). Q \]Xm> 1.26. Set the current renderer to Default scanline. MlJVeod 1.27. In the Renderer tab, turn off the Antialiasing option. w-b' LP 1.28. Turn off the Filter maps option. Sf/q2/r?6[ 打开 渲染场景 对话框,在通用设置面板下将分辨率设置为600*600(分辨率和我们的源图像一样)。 -h-oMqgu( 设置当前渲染器为默认扫描线渲染器。 [pg}S#A 在渲染面板中,启用 抗锯齿 选项。 w?mEuXc 启用图像 过滤器 选项。 Ch_xyuJ pi@Xkw 1.29. Open the Environment dialog and assing the final map as an environment map. w%c 1.30. Render the scene: ?0<w 打开 环境 对话框,将环境贴图设置为 flnal 贴图。 0_ yP\m 渲染场景。 ]lS@}W\ oc{EuW{Ag Here is the final scene for the composite that you should get if you followed all the steps correctly. K(T\9J. The beauty of using this method is that it can composite properly all effects (reflections, shadows, GI etc), without having to worry about any matte/shadow stuff or anything in 3dsmax. XD-^w_ 如果你按照所有正确的步骤那么这就是你想要的。 2GWDEgI1o 使用此方法的美妙之处是它可以正确的复合一些特殊效果(反射、阴影、GI等),无需担心3DSMAX中的任何无光/投影材质或任意事情。 RbQ < |