1 / 52

Introduction to Materials

Introduction to Materials. Contents. Materials Editing materials Quick methods for editing materials in UDK. Introduction to Materials. Materials affect the appearances of games Let objects appear to be what they should look like. What are Materials ?.

rico
Télécharger la présentation

Introduction to Materials

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Materials

  2. Contents • Materials • Editing materials • Quick methods for editing materials in UDK

  3. Introduction to Materials • Materials affect the appearances of games • Let objects appear to be what they should look like

  4. What are Materials ? • Simple approach: the pigment r of a surface • pigment controls colors • Materials make the surface apear to be something what they should look like

  5. Material vs Texture • Texture is an image • Materials contains textures and more, for example, transparency, emittance and etc.

  6. Texture UV Coordinates • A texture is defined a two-dimensional space • We have to map the 2D texture to the surface of an object in three-dimensional space

  7. Texture UV Coordinates • Horzontal axis : U-axis • Vertical axis : V-axis • Sometimes, the texture coordinate is called the tangent space。 • Each vertex should be assoicated with a texture coordinates

  8. Example V Direction 1.0 0, 0 U Direction 1.0 Source:http://en.wikipedia.org/wiki/File:UVMapping.png

  9. Example • Cube Representative UV A representation of the UV mapping of a cube. The flattened cube net may then be textured to texture the cube Source : http://en.wikipedia.org/wiki/File:Cube_Representative_UV_Unwrapping.png

  10. Set instructions to compute the appearance of a material • There are default values for each instruction for simulating the the lit surface • Remember to turn on light in order to see the materials.

  11. Material Components • Components: • Material Nodes (材质节点) • Basic components • Material Channels (材质通道) • Set the specific properties of a material • 材质表达式(Material Expressions)。 • A building block for creating materials. • Each expression defines a specific function, for example, connecting textures, adding two values, vectors or modify coordinates of textures.

  12. Material Components Material Expressions Material Nodes Material Channels

  13. Example: Creation of a Material • 1. Run UnrealEd • 2. Open Generic browser • 3. File - > New • 文件包(Package): MyFirstGameLevel • 组(Group): Materials • 名称(Name): mat_test_01 • 组件工厂(Factory): Material

  14. Double click the new material, you will see the following: Left hand side: the appearance of the material A material node represent the new material

  15. Material Channels • Diffuse (漫射) • Emissive(自发光) • Specular(高光) • SpecularPower(高光次幂) • Opacity(不透明) • Opacity Mask(不透明蒙板) • Distortion(扭曲) • Transmission Mask/Transmission Color(透射蒙板/透射色) • Normal(法线) • Custom Lighting(自定义光照)

  16. Show demo for the following items • Diffuse (漫射) • Emissive(自发光) • Specular(高光) • SpecularPower(高光次幂)

  17. Diffuse Emissive

  18. Opacity(不透明) • Set“LightingModel”(光照模型)as MLM_Unlit - Set BlendMode”(混合模式)as BLEND_Masked、 BLEND_Translucent、BLEND_Additive或BLEND_Modulate

  19. BLEND_OPAQUE BLEND_Translucent

  20. Opacity Mask(不透明蒙板) A simplified version of the opacity. Can be used if MLM_Phong is not available. It’s value boolean map. 1 for on 0 for off If the pixel value is smaller than a clipping value, it’s computed value is 0; otherwise it is 1.

  21. Opacity Mask(不透明蒙板) BLEND_MODE = BLEND_Masked

  22. Distortion(扭曲) Model refraction effect Used when MLM_Unlit is used. http://upload.wikimedia.org/wikipedia/en/e/eb/Rays_incident_on_medium.png

  23. Transmission Mask/Transmission Color - Model sub-surface scattering(次表面散射) • Subsurface scattering (or SSS) : a mechanism of light transport in which light penetrates the surface of a translucent object, is scattered by interacting with the material, and exits the surface at a different point. • Source: wikipedia

  24. Subsurface scattering http://en.wikipedia.org/wiki/File:Subsurface_scattering.png

  25. Normal Map • or "Dot3 bump mapping", is a technique used for faking the lighting of bumps and dents. It is used to add details without using more polygons. A normal map is usually an RGB image that corresponds to the X, Y, and Z coordinates of a surface normal from a more detailed version of the object. Normal map

  26. Without Normal Map Normal Map

  27. Transmission + Normal BLEND_Translucent

  28. Custom Lighting(自定义光照) Define your own lighting function You must enable this channel by setting lighting model as MLM_Custom

  29. Custom Lighting

  30. Material Expressions • Abs(求绝对值) • Add(加法) • AppendVector(向量合并) • BumpOffset(凹凸偏移) • CameraVector(相机位向量) • Ceil(值上限取整) • Clamp(区间值限定) • ComponentMask(分量蒙板) • 常量表达式 • Constant(常量) • Constant2Vector(二维常数向量) • Constant3Vector(三维常数向量) • Constant4Vector(四维常数向量)

  31. Material Expressions • Desaturation(冲淡颜色) • DestColor(目标色) • DestDepth(目标深度) • Divide(除法) • DotProduct(点乘、内积) • Cosine(余弦) • CrossProduct(叉乘、外积) • DepthBiasedAlpha(深度偏移Alpha) • DepthBiasedBlend(深度偏移混合)

  32. Material Expressions • FlipBookSample(翻书采样) • Floor(值下限取整) • Frac(取小数值) • Fresnel(菲涅尔) • If(条件表达式) • LightVector(光照向量) • LinearInterpolate(线性插值)

  33. Material Expressions • MeshEmitterVertexColor(网格物体发射器顶点色) • MeshSubUV(网格物体子UV) • Multiply(乘法表达式) • Normalize(单位化) • OneMinus(一减去) • Panner(平移器) • ParticleSubUV(粒子子UV) • PixelDepth(像素深度) • Power(求幂值) • ReflectionVector(反射向量)

  34. Material Expressions • Rotator(旋转器) • ScalarParameter(标量参数) • SceneDepth(场景深度) • SceneTexture(场景贴图) • ScreenPosition(屏幕位置) • Sine(正弦) • SquareRoot(开平方根) • Subtract(减法) • TextureCoordinate(贴图坐标)

  35. Material Expressions • TextureSample(贴图采样) • TextureSampleParameter2D(贴图采样参数:2D) • TextureSampleParameterCube(贴图采样参数:立方体) • TextureSampleParameterMovie(贴图采样参数:影片) • Time(计时) • Transform(变换)

  36. Material Expressions • VectorParameter(向量参数) • VertexColor(顶点色)

  37. Issues about designing your own materials • Texture format: Targa(.TGA)。It can accept other formats too. • Dimension of the texture: the power of 2. • Need not to be a square, e.g. 32, 1024, etc. • The number of pixels in width or height is not larger than 2048. • Make sure the resolution matches your need. For example, if you use a texture with resolution 2048x2048 but the players never have a chance to see it. Don’t do it.

  38. Import textures • 1. Generic browser->File> Import。 • 2. Click OK • 3. A dialogue is shown to ask for more information • Package(包): MyMaterials • Group(組): Textures • If DeferCompression(不壓縮)is checked, the package is not compressed before saving. • 4. Save

  39. A Walkthrough to build new materials • How to set a texture for TextureSample? • - Generic browser (Content Browser)->select a texture (highlight it) • Go back to Material Editor • Click the block of TextureSample • - at the line “Texture” (bottom of viewport) • - Click “use the selected object in Content Browser”

  40. Example

  41. Example • Try Pan • Try Rotation • Try Scaling • Try Relative

  42. Alignment - Select the planes that you want to adjust, i.e. aligning all - Open Surface Properties -> Alignment->Planar

  43. Hints • After you select an object, press right mouse button. • Additional actions will be shown for manipulating the object • Select Geometry Mode (left hand side) • After you select a BSP, you can change the texture coordinates by using widgets too.

  44. BumpOffset • Purpose : Virtual Displacement Mapping • To generate the illusion of height differences when normal map is used. • Inputs : Height(高度值)和UVs Height:a scaling factor for height HeightRatio(高度比):pixel height / surface area ReferencePlane(参考平面)。 Determine how the displacement is computed, value in [0, 1]. Denote as h. - If pixel height > h, move along the direction of camera - If pixel height <h, move in the negative direction of camera

  45. BumpOffset • Change “height value” from -1.0 to 2.0 and observe the effect • Change ReferencePlane and observe the effect

  46. Fresnel (value in [0,1])

  47. Examples • TexCoord • Panner • Rotator • OneMinus • Power • etc.

  48. Specular Instead of applying an intensity of specular uniformly over a surface, you can assign the intensity of specular to it based on a texture.

  49. Exercises • Learn from UDK examples.

More Related