zoukankan      html  css  js  c++  java
  • 《Essential Guide》读书笔记【4】 【第5章】

      我试着翻译了第五章几段要紧的概念,算是用来加深理解吧。

      先讨论下shading”翻译成什么?翻成“着色”,3D中的shading专指根据灯光对材质着色,普通的WireFrameMaterial也可以填充指定颜色,但这种“着色”不叫“shading”。看下百度百科:

      Shading(着色处理)
      绝大多数的3D物体是由多边形(polygon)所构成的,它们都必须经过某些着色处理的手续,才不会以线结构(wire frame)的方式显示。这些着色处理方式有差到好,依次主要分为Flat Shading、Gouraud Shading 、Phone Shading、Scanline Renderer、Ray-Traced 。
    -----------
    翻译部分:
    ------------------------------------------------------------------------------------------------------------------------------------------

    Shading materials in Away3D
    As previously mentioned, shading materials are specific material types in Away3D that react to light. In this
    section, we will take a tour through the most frequently used types, highlighting the strengths and
    weaknesses of each. It is worth reiterating that almost all shading materials are very processor intensive
    and need to be used sparingly in an Away3D project. Recent advances in the Flash 10 Player have
    allowed some optimizations to be performed on certain shading material classes, but if the frame rate of an
    application is to remain smooth, the amount of shading materials use will always need to be kept within
    limits set by the processing overheads.

    Away3D中的灯光材质(shading material)

    前面已经提到,灯光材质是Away3D中专门与光线交互的材质类型。我们将在本节了解一些个最常用的光照材质,并着重讲讲它们各自的优缺点。需一再强调的是,几乎所有的灯光材质都十分消耗处理器资源,在Away3D项目中应谨慎使用(need to be used sparingly)。Flash 10 Player新近引入的特性已允许我们对一些灯光材质类做出优化,但要想程序运行流畅,还是得把灯光材质的使用量控制在处理器的容忍范围之内。

     ------------------------------------------------------------------------------------------------------------------------------------------


    ------------------------------------------------------------------------------------------------------------------------------------------

    Flat shadingmaterials

    One of the simplest and most efficient methods of shading a 3D mesh object is known as flat shading.

    This calculates a single reflected intensity for each face based on the angle of the face to the light source.

    The result is applied to the base color of the material, producing the final output. There are two classes

    that perform this type of shading: ShadingColorMaterial and WhiteShadingBitmapMaterial. Both of

    these material classes work similarly to their respective nonshading counterparts, without the use of any

    processor-intensive layering, and are therefore useful as fast shading options.

    For simplicity, the WhiteShadingBitmapMaterial class assumes the light color to be white for all light

    sources. The ShadingColorMaterial class is more versatile in its coloring, reacting to different colored

    lights and allowing you to configure different material colors for the three components of the light source.

    For example, a ShadingColorMaterial can use a red hue for its ambient color, a blue hue for its diffuse

    color, and a green hue for its specular color. The disadvantage of using ShadingColorMaterial is its

    lack of texture mapping, meaning that any color settings are applied across the entire material surface.

     ------------------------------------------------------------------------------------------------------------------------------------------


    ------------------------------------------------------------------------------------------------------------------------------------------

    Flat Shading (恒定着色) materials

    flat shading是最简单、最高效的着色方法之一。它仅根据面与光源的夹角计算出一个反射光强,再结合材质的颜色,渲染出最终结果。Away3D中有两个类实现了这种着色方式:ShadingColorMaterial和WhiteShadingBitmapMaterial。这两个材质类的工作方式,与他们各自的非光照对应部分(nonshading counterparts)类似,未使用处理器密集型的layering。因此,它作为一种快速着色的途径是很有用处的。为了降低复杂度,WhiteShadingBitmapMaterial类设定所有光源的颜色都是白色。ShadingColorMaterial在着色上更为灵活,它不仅可以感知各色光源,而且允许你针对光源的三个分量设置不同的材质颜色。像比,一个ShadingColorMaterial可以使用红色作为环境光下的颜色,使用蓝色作为漫反射光下的颜色,使用绿色作为镜面反射光下的颜色。(*现实生活中大概找不到这样的材质:同一个面,环境光下是红色材质,散射光下是蓝色材质,而高光区又成了绿色材质..) ShadingColorMaterial的缺点是不具备纹理仿射,也就是说整个材质面都得用一个颜色。

     ------------------------------------------------------------------------------------------------------------------------------------------


    ------------------------------------------------------------------------------------------------------------------------------------------

    Using lights and shading materials
    In the real world, light reflected from the surfaces of the objects around us enters our eyes and produces a
    perceived image of the scene. Without a light source, everything would appear black. Simulating this
    process in a computer is known as shading and typically requires a large amount of processing.
    One method of shading calculates virtual light rays for every pixel in the view, in a technique known as ray
    tracing. This method is used by the majority of professional 3D modeling programs to render high-quality
    3D images. However, real-time 3D engines require a fast render speed and consequently aim to
    approximate a lot of real-world processes rather than carrying out faithful simulations. Instead of
    measuring light intensities for every pixel in an image, values are estimated using a variety of techniques
    ranging from precalculating intensities in a texture (the previously mentioned texture baking technique) to
    texel-based normal mapping that uses an extra texture image to calculate light intensities across the
    surface of an entire object’s texture in a single step. We will look at the latter technique in more detail later
    in this chapter.

    使用灯光和灯光材质

    在现实世界中,周围的物体反射光线进入我们眼睛而被感知、成像。若没有光源,一切都是黑的。用计算机模拟这个过程被称为shading,它特别消耗处理器资源。一种shading方法是对视野内每一个像素进行光照计算,这种技术被称为光线跟踪(ray tracing)。它被很多专业的3D建模程序用来渲染高品质3D图像。然而,实时3D引擎需要高速渲染,因此它的渲染目标定位在接近真实而非精准模拟。这样就出现了诸多优化技术,从预处理纹理光照强度(即前面提到的纹理烘焙技术(texture baking)到基于texel的法线映射,后者额外使用一张纹理图像一步完成整个物体表面纹理的光强计算。我们会在本章详细的介绍texel-based normal mapping技术。

     ------------------------------------------------------------------------------------------------------------------------------------------

     ------------------------------------------------------------------------------------------------------------------------------------------

    In the majority of preceding chapter examples, we have gotten away with not using any shading

    techniques on our materials. This approach is perfectly acceptable when speed is a priority over image

    quality. But if we want to produce 3D scenes with a higher degree of realism, shading materials are one

    option we can use. When a shading material is applied to a face, the resulting rendered surface can be

    brighter or darker than the actual color, depending on the shading calculations. In simple terms, a surface

    that directly faces toward a light source will appear brighter, while one that directly faces away will appear

    darker. A shading material produces an overall intensity map of light to be applied to the underlying texture

    or color of the object, commonly referred to as the light map of the object.

    In Away3D, several different types of shading material exist, offering varying degrees of detail and

    requiring varying amounts of processing. As is the case with much real-time 3D content,

    在前些章节的示例中,我们没有在材质上使用任何的光照技术。当优先考虑速度而非图像质量时,这种方式是可以欣然接受的。但如果我们想渲染出更具真实度的3D场景,灯光材质就成为一种选择。当一种灯光材质被应用到某个面上,渲染结果可能比真实颜色偏亮或偏暗,这取决于光照计算。简单来说,朝向光源的面显得亮些,背面则暗些。一个灯光材质会产生整体光照强度的map(常叫做light map),叠加在物体本身的颜色或纹理上面。

     ------------------------------------------------------------------------------------------------------------------------------------------

     ------------------------------------------------------------------------------------------------------------------------------------------

    In Away3D, several different types of shading material exist, offering varying degrees of detail and

    requiring varying amounts of processing. As is the case with much real-time 3D content, finding a happy

    balance between these two quantities is the main basis on which choices are made.

     Away3D支持几种不同类型的光照材质,它们提供不同的渲染精度,对处理器的消耗度也不同。对绝大多数实时3D内容而言,取得渲染效果与程序性能的平衡是我们选择材质的主要依据。

     ------------------------------------------------------------------------------------------------------------------------------------------

  • 相关阅读:
    性能测试
    领域驱动设计(DDD)的实际应用
    Js模块模式
    Roslyn and NRefactory
    前端与后端分离的架构实例3
    angular + easyui 做界面验证
    java.lang.OutOfMemoryError: unable to create new native thread(转)
    oracle client server那点事
    一次处理ORA-07445的历险记(转)
    一条执行4秒的sql语句导致的系统问题 (转)
  • 原文地址:https://www.cnblogs.com/weiweishuo/p/3082596.html
Copyright © 2011-2022 走看看