2009年1月29日 星期四

初五開工大吉

好幾年沒回老家過年,今年好不過容易小放幾天,總算可以不用老媽、老弟上來北部陪我們過年…!雖然我比較喜歡在北部的家過年…哈!!!不過回老家的感覺也很好…!

新春舊希望…!
對我而言:家人、及親朋好友都平安健康是最重要!
其次在這年頭人人在工作順順利利,去年離開舊工作人都可找到如意的新工作。
自己當然繼續玩、 繼續做我那小小的夢。在另一層面上而言,今天是屬於我自己的開工大吉日。

2009年1月2日 星期五

Part3-MSR介面註釋

Interface介面

Matte/Shadow/Reflection Parameters rollout

clip_image001

 

Camera Mapped Background

Sets the color or map for the matte material. To use the scene background, click the map button, browse from the scene, and choose the background map.

Note: Unlike(不像) the standard Matte/Shadow material, this material does not automatically pick the background (that is, the scene environment) as its color; rather, it’s necessary to provide the background explicitly. There are several ways to do this:

  • The most common method is to use a screen-projected map. However, using a Bitmap map with Screen environment mapping will not work correctly, because it does not handle reflections correctly. Instead, for this purpose, we recommed using the Environment/Background Camera Map shader. This shader projects the texture back from the current rendering camera.
    (一般就設一張圖片,但有個缺點,就是不會考慮到光的反射。所以用 Environment/Background Camera Map shader 來做貼圖的設定。)
  • Alternatively(兩種選擇), you can apply the color in any applicable UV texture space, perhaps if you previously projected the texture into that texture space.
    (第二方式可以用顏色來應用)
  • A third option is to project the background at render time with the Camera Map Per Pixel map.
    (第三個選項是在彩現算圖時用Camera Map Per Pixel map.)

Mask/Opacity

The opacity of the material.

Tip: One use case for the Mask/Opacity setting is to refine a rough stand-in object. For example, the plate might contain a person’s arm, and you want to put in a CG object that goes behind the person’s arm and/or has shadows thrown onto it by the person’s arm. You could create simple stand-in geometry (maybe even a cylinder) and then use a screen-projected opacity map that defines the exact edges of the arm. Also, if the arm in the plate is motion-blurred or out of focus, you can feather the opacity mask accordingly.
 

Bump

Specifies a bump map for the material.

Bump Amount

The multiplier for the bump map.

 

Shadows rollout

clip_image002

Receive Shadows

When on, the surface can receive shadows. If Shadow Casting Lights List is off, all lights cast shadows on the surface.

Ambient/Shadow Intensity

The amount of environmental light in the scene, which in a practical sense is how dark the shadows are. The Matte/Shadow/Reflection material does not use Skylights to generate shadows; any such shadows must come from the ambient occlusion feature. So when the shader is used together with a Skylight, this value should be similar to the level of light the Skylight provides.
(場境中的環境光總值,一般上是黑到不行。所以MSR材質不會使用Skylight來產生陰影。所有陰影都是由 the ambient occlusion 的作用效果。所以shaderSkylight 一起使用時,其值是非常近似的。)

The units value for this setting depends on the lighting unit. If you use the mr Photographic Exposure Control, and set Physical Scale to Physical Units (cd/m2), this value will be in physical values, and might need to be in the hundreds (or thousands for an outdoor shot lit by mental ray Sun and Sky). However, if you don’t use the exposure control, or set it Physical Scale to Unitless, this parameter is in a "traditional" unit space where 0 is black and 1 is white.
(使用單位依lighting unit設定,使用mrPhotographic exposure control則用(cd/m2),值的設定要上百或上千。如果用傳統則0是黑,1是白。)

Note: This "ambient" light is affected by ambient occlusion, so it is darkened by the occlusion at contact points and in areas hidden under objects.

Ambient/Shadow Color

Setting a color or map here tints the shadows. For accurate shadow tint, use a neutral(中立) color.

Shadow Casting Lights List

When on, you can use the Add/Replace/Delete buttons to edit the list, specifying lights that are to cast shadows on the surface. For the lights list to be in effect, Receive Shadows must also be on.

When off, and Receive Shadows is on, all lights in the scene cast shadows on the surface.

Note: Shadow-casting lights act as representations of any real-world lights in the background plate, such as the sun or any artificial light sources. For further information, see Direct Illumination rollout, following.

(陰影投射光用來"限制"是否只受名單內光源的陰影)

 

Ambient Occlusion rollout

clip_image003

(AO用在繪圖的觀念來說:就像對物件直接做明暗處理,來強化立體感。換言之,它的影響強度比較大。)

Use Ambient Occlusion (AO)

When on, ambient occlusion affects the surface.

AO Samples

The number of ambient-occlusion rays that are shot.

AO Max Distance

The reach of ambient-occlusion rays. At 0, the ray distance is not limited. Using short rays increases performance but localizes局部化 the ambient-occlusion effect.

AO Shadow Strength

The darkness of shadows the ambient occlusion causes. The default value is black, but you can cause a less-pronounced shading effect by using a lighter color.

Reflections rollout

clip_image004

 

Receive Reflections

When on, the surface reflects its surroundings.

Reflection Color

Reflections are tinted this color. For accurate reflections, use a neutral color.

Reflections (Subtractive Color)

The subtractive(減去) color for reflections. This amount is removed from the plate before reflections are added. If black, nothing is removed, and reflections are added purely additively on top of the plate. If 50% gray, the plate pixels are attenuated to 50% of their intensity, and the reflections are added on top of that, and so on.

Use this setting is used if the plate contains an area with many reflections that need to be removed before the new, synthetic reflection is added.

Glossiness

The glossiness of reflections.

Glossy Samples

The number of glossy-reflection samples.

Max Distance

At values other than 0, limits the distance from which reflections are cast.

Max Distance Falloff

The falloff curve for reflections at Max Distance. Lower values cause more rapid falloff.

Indirect Illumination rollout

clip_image005

 

Receive Indirect Illumination

When on, indirect light (final gather and global illumination) is gathered and scaled by the Indirect Illumination Multiplier value (see following).

Indirect Ilumination Multiplier

The multiplier for gathered indirect light.

Direct Illumination rollout

Note : The lights specified on this rollout actually illuminate the background, unlike shadow-casting lights. Thus, for the effect to be correct, make sure no light source exists in both lists.
(明確的設定使用那些光源)

clip_image006

 

Receive Direct Illumination

When on, the surface renders where struck by direct illumination. If Illuminating Lights List is off, all lights in the scene illuminate the surface.

Illuminating Lights List

When on, you can use the Add/Replace/Delete buttons to edit the list, specifying lights that are to illuminate the surface. For the lights list to be in effect, Receive Direct Illumination must also be on.

Maps Rollout

This rollout enables application of maps or shaders to the applicable material parameters. Of course, you can apply a shader to a parameter at its standard location in the user interface by clicking its map button (square button at the right side of the parameter), so the principal value of this rollout is that it also lets you toggle a parameter's shader, using the check box, without removing the map.

Part2-強化立體明暗、影子效果or合成用的matte圖

  Part 2: Marrying 3D with a photo :

打光、調明暗立體、合影子:加入一個mr Area Ommi (不過我覺得用mr Area Spot 比較好控制方向)
調整光度及影子等相參數,但如果加強明暗立體效果,則用
MSR材質中的AO來控制(相關AO在第三篇介面說明)


Now you’ll tune the lighting in the scene. Generally you need at least one key light to cast a directional shadow.

  1. Add a light source such as mr Area Omni and place it in a location similar to where the main light seems to be coming from in the photo.
  2. Tune the light so that the lighting direction and intensity on the teapot seems reasonable compared to the objects in the photo, and so the shadow directions seem to match. For now, ignore the shadow intensity; just consider the lighting on the teapot itself.

 

clip_image001

  1. Now tune the overall intensity of the shadow with the Ambient/Shadow Intensity parameter to match existing shadows in the photo. If the shadow needs tinting(色彩/濃淡), use the Ambient/Shadow Color setting. You might also need to modify the AO Max Distance value to make contact shadows more or less pronounced.
  2. You can adjust the shadow softness with the mr Area Omni light’s Radius setting, on the Area Light Parameters rollout.

clip_image002

  1. The scene is now set up, although further tuning might be necessary.
  2. Delete the teapot.
  3. Add any objects you want to use to the scene.
  4. Add any additional stand-in matte objects that you can use to occlude objects, receive and cast shadows, etc., to the scene, and apply the same Matte/Shadow/Reflection material to them.

clip_image003

 

Part 3: Prepare for compositing:合成前的準備

  • 打開材質編輯器,Cut E/B Switcher 中的 Background的值,改設純黑(或藍/綠布幕)值。
    >>>這個做法保留彩現時有環境/反射效果能力
  • CutMSR Material 中的 Camera mapped background,並設一個新的E/B Switcher shader
    在新貼
    E/B Switcher shader 圖中,只設定Environment/Reflectionsinstance上背圖(就是E/B camera map)
    >>>使matte做布幕的純色彩現,而加新Switcher這個部份能保留對3D物件的有matte時的彩現效果。

這個部份就會要讓3D物件的彩現能受到matte物件及環境反射光的影響。但又不把matte物件及背景圖彩現出來。

 

So far(到目前為止) the rendered 3D content has been added on top of the background directly in the renderer. Generally, you want to do this in an external compositing program, as follows:

  1. Open the Material Editor.
  2. Environment/Background Switcher shader (the one you instanced from the Environment panel).
    Right-click the Background map button and choose Cut.
  3. Click the color swatch(樣本) next to Background and make sure the color is transparent black; in other words, Red, Green, Blue, and Alpha all equal 0.0. These are the default values, so no changes should be necessary. Close the Color Selector dialog.
  4. Activate the Matte/Shadow/Reflection material and cut the Camera Mapped Background map.
  5. To the Matte/Shadow/Reflection material > Camera Mapped Background map, apply a new Environment/Background Switcher shader.
  6. Right click the Environment/Reflection map button (not the Background map button) and choose Paste (Instance) to apply the previously used map.
  7. Click the Background color swatch and make sure the color is transparent black as well.
    The scene now contains two Switcher nodes: one used in the environment (switching between transparent black and the chrome ball) and one in the material (switching between transparent black and the camera map).

 

If you render now, the resulting image still properly contains all the reflections, light, etc., from the background, but not the background itself. Shadows exist in the alpha channel, so the image is suitable for compositing directly on top of the background image.

clip_image004

 

A Note on Gamma

The preceding procedure did not mention gamma.

If you use a gamma-correct workflow, which yields a superior result, with literal mental ray textures (that is, you use the big Browse button to reffer directly to a bitmap file, rather than inseriting a Bitmap map), you must set the gamma of this bitmap explicitly in the appropriate Reverse Gamma Correction parameters.

Note: Intentionally exaggerating the Reverse Gamma Correction setting on the chrome ball photo can turn a low-dynamic-range photo into a “faux” HDR image by artificially exaggerating its contrast.

2009年1月1日 星期四

matte/shodow/Reflection (mi) - Part1

僅供參考:

Matte/Shadow/Reflection (mi) Material

Material Editor > Type button > Material/Map Browser > Matte/Shadow/Reflection (mi)

Note : 這個材質球只能用mental ray renderer做算圖。

 The Matte/Shadow/Reflection (mi) material appears in the Browser only if the mental ray renderer is the currently active renderer.

 

The Matte/Shadow/Reflection (mi) material, part of the Production Shaders library, is used to create “matte objects”; that is, objects that represent代理 real-world objects in a photograph, used as the scene background (also known as the plate).
The material provides a wealth of options for marrying a photographic background with the 3D scene, including support for bump mapping, ambient occlusion, and indirect illumination.

(MSR 材質,建造一個代替背景圖的3D遮罩物件(Matte Object),能有凹凸感、明暗立體、及對間接光度等功能。)

 

Applications include(應用包含):

  • Blocking another 3D object from the camera view, thus allowing the 3D object to appear to be behind the object in the photo.
    (在做圖時,3D物件的部份在matte物件後面,使3D物件被看來像是排放在背景圖的物件後方。)
    PS.這裡matte物件通常會很準確畫出背景圖內的物件外型。
  • Allowing 3D objects to cast shadows and occlusion on and receive shadows from objects in the photo.
     (在做圖時,可以把3D物件的影子投在matte物件上。)
  • Adding reflections of 3D objects to objects in the photo.
    (在做圖時,可以接收來自接3D物件的反射光。)
  • Allowing the interplay of indirect light between 3D objects and objects in the photo.
    (在個圖時,讓3D物件與matte物件之間的反射光。)

 

In all these cases the material is applied to a matte object that represents an object in the background plate, and the 3D object uses a traditional material.

For additional information, see Help menu > Additional Help > mr Production Shader Library > Matte/Shadow Objects and CameraMaps, as well as the Tech Note (following).

 

Tech Note

The Matte/Shadow/Reflection shader works by doing a form of differential shading. In other words, it determines(決定) the amount of light a point would receive if it were not in shadow, compares it to the amount of light the point actually receives, and shades it by the relative difference.

This means that any point that is fully lit(完全地被照亮), unshadowed by any object, returns the same color it already had, completely disregarding(不顧) the actual intensity of that light. If half of the incoming light is blocked, the point will be shaded at 50 percent intensity, regardless of the full-intensity amount in an absolute sense.

 

An important feature of the Matte/Shadow/Reflection material is that it is non-self-shadowing自己沒有影子, non-self-occluding自己沒有明暗立化, non-self- reflecting自己不反射, and does not cast indirect light onto itself不被間接光投射). Because it is designed to act as a stand-in(替身) for objects present in a photographic plate, which already contains self-shadowing, self-reflection, and so on, the material automatically excludes these effects. However, it is still able to cast shadows on other objects, receive shadows from other objects, reflect other objects, and so on, without creating unwanted double shadows or double reflections for such effects already present in the plate.

 

Procedure(步驟)

This multi-part procedure provides step-by-step instructions(講授) for a simple case of combining a 3D object with a photograph using the Matte/Shadow/Reflection material, the Environment/Background Camera Map shader, and the Environment Probe(探測)/Chrome(鉻黃) Ball shader.

 

Prerequisites(事先準備):

  • A photo of a background

clip_image001

 

  • A photo of a chrome ball, also known as a light probe, shot from the same camera angle and cropped(切剪) so the edges touch the image.

clip_image002

Ideally(理想地), these should be HDR(高資料率) photos, but non-HDR images can also work well.

 

Part 1 : To use the production shaders to marry a 3D scene with a photographic background :

Step1: 設定好(Perspective) Viewport的背景圖片,並注意用MR Renderer

  1. Make sure mental ray is the active renderer.
    (確定是用Mental Ray 算圖器。)
  2. Activate a Perspective viewport. Use Viewport Background to set the background image (see the procedure introduction, above) .
    (在透視視窗中,設定背景圖。)
  3. On the Viewport Background dialog, make sure both Display Background and Match Rendering Output are on. Click OK to continue.
    ( ViewPort Background對話視中,(直接用files選取背景圖檔。)注意Display Background and Match Rendering 是開啟。)

 

Step2: "E/B"這一系列的2D貼圖來作環境/特效的背景設定:
a.Environment/Background Switcher (mi)設定背景,並instance到材質球。
b.E/B Switch 中的 Background,及Environment reflection兩個參數中,分別貼圖:

E/B Camera map (mi)<---背景圖,拖拉instance到材質球;
E Probe/chrome ball (mi)<---反射圖,拖拉instance到材質球。

(把兩個貼圖instance到材質球<==可方便修改調整。

c.E/B Switch (mi)

 

  1. Open the Environment And Effects dialog to the Environment panel (press 8).
    開啟
    環境/效果 對話視窗
  2. On the Common Parameters rollout, click the Environment Map button (reads “None”).
     From the list that opens, choose
    Environment/Background Switcher (mi)
    選取
    (環境/背景 切換器)的材質。
  3. Open the Material Editor.
    開啓材質編輯器
  4. Drag the Environment Map button from the Environment And Effects dialog to a sample slot(材質球) in the Material Editor. Use the Instance option.
  5. On the Material Editor > Environment/Background Switcher (mi) Parameters rollout, click the Background map button (all the way to the right of the parameter). From the list that opens, choose Environment/Background Camera Map (mi).
    在這個材質中按背景貼圖鈕,並設定為(環境/背景 攝影貼圖)的材質。
  6. On the Environment/Background Camera Map (mi) Parameters rollout, click the Browse button and again open the background image.
    在攝影貼圖材質中,設定與背景一樣的圖片。
  7. In the Material Editor, click the Go To Parent button to return to the Switcher map.
    回到上一層(切換器)中。
  8. Click the map button to the right of Environment/Reflections.
    進入Environment/Reflections中。
  9. From the list that appears, choose Environment Probe/Chrome Ball (mi).
  10. On the Environment Probe/Chrome Ball (mi) Parameters rollout, click the Browse button and open the image containing the cropped photo of the chrome ball.
    If the two photos have different exposures, use the Multiplier setting for either or both maps to match them.

 

Step3: 設定物件的材質:

  1. 建立簡單的(幾個)平面物件來替代背景中的場景(如地面、牆、遮蔽物),並配到視覺透視的 角度。
    建立一個標準的Skylightcolor用Scene Environment。<---適度回收Ambient Color
  2. 建立用Arch & Design material的幾何物件。
  3. 建立MSR Material , Camera Mapped Background:用instance貼上從E/B Switch Background Copy來的貼圖。
  4. 測試算圖,可以得3D物件與2D背景的合成。有柔和的環境陰影。


Next you’ll make a
rudimentary model(基本的模型) that represents objects already present in the background. At the very least you need a simple plane for the "ground" to place things on.
Note: It is easier to see if you maximize the viewport and use wireframe display mode.

  1. Align the viewport so it matches the angle of the photograph as closely as possible.
    儘可能把視覺角度配合到背景圖。
  2. From the Create menu, choose Lights > Standard Lights > Skylight and then click in the Perspective viewport to add a Skylight to the scene.
    建立一個標準的 Skylight.
  3. On the Skylight Parameters rollout for the light, set Sky Color to Use Scene Environment.
     This retrieves(收回) the appropriate(適當) ambient color from the chrome ball photo.
  4. Create some geometry. For this example, add a plane to represent(代表) the ground.
  5. Add a teapot on top of the plane. You’ll use this temporarily to tune the shadows.
  6. In the Material Editor, create an Arch & Design material, change the color to white, and apply it to the teapot.
  7. Select the ground plane. Next you’ll set up the Matte/Shadow/Reflection material.
    1. In the Material Editor, activate the existing Environment/Background Switcher map.
    2. Right-click the Background map button and choose Copy.
    3. Activate an unused sample sphere and create a new Matte/Shadow/Reflection material.
    4. On the Matte/Shadow/Reflection Parameters rollout, right-click the Camera Mapped Background map button and choose Paste (Instance).
      (先建立一個新的 Matte/Shadow/Reflection material,並將E/B Switch中的Background值,用Instance的方式paste 到這新材質中的 Camera Mapped Background中。)
      PS.直接在SwitchBackground拉出一個新的材質球,會有問題。
       

This places the same background map that is used in the environment switcher into the background map in the material as an instance.

 

This completes the basic setup. If you render now, you should see the teapot superimposed over the background image. The teapot should have a soft shadow underneath, which comes from the ambient occlusion.
(在這裡如果先做render的話,可以算出如下面的合成圖,在teapot底部會有柔和的環境陰影。)

clip_image003