- 浏览: 251716 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
15665280578:
[color=red][/color]加executeUpda ...
HQL如何执行update,delete相关的createQuery -
thy_mm:
多谢。
如何取消SVN管理 -
zhys1314:
[url][url][url][url][url][url][ ...
HQL如何执行update,delete相关的createQuery -
demojava:
大哥,你代码不全啊,无法运行啊。。
Away3D Lite:Basic_InteractiveObject -
demojava:
我做了一个demo,发现和你的不一样。
你可以看一下:
htt ...
Away3D Lite:Basic_SceneSetup
Away3D中的光照可以分为三个基本要素:
- the light source(s) defining the properties of the light(s)
- light source(s) 定义了光照的属性
- shaders providing algorithms that determine how a light source interacts with a material
- shaders 提供一些决定光源如何同材质交互的算法
- a material type combining different shaders along with base colours or bitmaps
-
一种组合
了不同 shaders 和 colors 或者 bitmaps 的 material type
第一个同PV3D不同之处是我们可以指定超过一个光源 。这样会加大CPU的负担,但同时也可以制造出更加真实的场景渲染。
三种主要的 light sources:
- AmbientLight3D which has no position and provides a uniform ambient light to all objects
-
AmbientLight3D
(环境光源
)没有空间坐标,他为所有的 object 提供了一种统一的环境光照
- DirectionalLight3D which provides light from a specified position but with a strength that does not diminish with distance
- DirectionalLight3D (定向光源 ),有一个空间坐标,有一个不会减弱的光照强度
- PointLight3D providing light from a specified position that weakens in intensity with distance
- PointLight3D (点光源 ),有一个空间坐标,光照强度会随着距离的增加而减弱
以下几种 shaders:
- AmbientShader which provides ambient shading to a triangle face
- AmbientShader 为一个三角面提供环境阴影
- DiffusePhongShader which, depending on the angle between the light source and a triangle face, produces a diffuse shading pattern
- DiffusePhongShader 根据光源和三角面之间所成的角度,产生一个散射阴影
- SpecularPhongShader which produces specular shading on triangles to imitate a surface that is reflecting light, depending on the observer’s position and the light position
-
SpecularPhongShader
根据观察者和光源的位置,为三角面产生一个模拟的反射光源的效果
- EnviroShader allowing for environment mapping, producing a reflection from a surrounding environment on an object, independent of a light source. Requires bitmap data for the environment
-
EnviroShader
根据光源位置和环境贴图,给 object 添加一个环境贴图反射的映射
- DiffuseDot3Shader to increase scene reality by adding more small scale structure through the use of normal mapping to an object. Requires bitmap data for the normal map
- DiffuseDot3Shader 通过增加更多的 structure 来增加场景的真实感
以上shaders,除了 EnviroShader ,其余的 light source 都是DirectionalLight3D
我们可以选择使用CompositeMaterials ,这种材质包含了一些不同的 shaders 和基于这些 shaders 的materials。
material列表如下:
PhongBitmapMaterial used to create ambient, diffuse and specular lighting on a texture-mapped material
Base material : BitmapMaterial
Shaders : AmbientShader , DiffusePhongShader and SpecularPhongShader
PhongMovieMaterial used to create ambient, diffuse and specular lighting on a material based on another Flash movie
Base material : MovieMaterial
Shaders : AmbientShader , DiffusePhongShader and SpecularPhongShader
PhongColorMaterial used to create ambient, diffuse and specular lighting on a simple coloured material
Base material : ColorMaterial
Shaders : AmbientShader , DiffusePhongShader and SpecularPhongShader
EnviroBitmapMaterial used to create environmental lighting on a texture-mapped material
Base material : BitmapMaterial
Shaders : EnviroShader
Dot3BitmapMaterial used to create ambient and normal-mapped lighting on a texture-mapped material
Base material : BitmapMaterial
Shaders : AmbientShader and DiffuseDot3Shader ,
Dot3MovieMaterial used to create ambient and normal-mapped lighting on a material based on another Flash movie
Base material : MovieMaterial
Shaders : AmbientShader and DiffuseDot3Shader
以上这些 materials 都是很耗性能的 ,如果你想使用简单点的 shade ,你可以选择CenterLightingMaterial 这种材质的效果就相同于PV3D里的 flat-shaded materials ,Away3D里有两种选择 :
- ShadingColorMaterial for simple flat shading of a ColorMaterial
- WhiteShadingBitmapMaterial for simple flat shading of a BitmapMaterial , but assuming that the light source is always white (independent of colour given to light source).
// create a new directional white light source with specific ambient, diffuse and specular parameters var light:DirectionalLight3D = new DirectionalLight3D({color:0xFFFFFF, ambient:0.25, diffuse:0.75, specular:0.9}); light.x = 100; light.z = 500; light.y = 500; scene.addChild(light); // Create an object container to group the objects on the scene group = new ObjectContainer3D(); scene.addChild(group); // Create a new sphere object using a very shiny phong-shaded bitmap material representing the earth var earthMaterial:PhongBitmapMaterial = new PhongBitmapMaterial(Cast.bitmap(earthBitmap)); earthMaterial.shininess = 100; sphere = new Sphere({material:earthMaterial, radius:50, segmentsW:10, segmentsH:10}); sphere.x = ORBITAL_RADIUS; sphere.ownCanvas = true; group.addChild(sphere); // Create a new cube object using a tiled, phong-shaded bitmap material var tiledAway3DMaterial:PhongBitmapMaterial = new PhongBitmapMaterial(Cast.bitmap(away3DBitmap), {repeat:true, scaleX:.5, scaleY:.5}); cube = new Cube({material:tiledAway3DMaterial, width:75, height:75, depth:75}); cube.z = -ORBITAL_RADIUS; cube.ownCanvas = true; group.addChild(cube); // Create a cylinder mapping the earth data again cylinder = new Cylinder({material:earthMaterial, radius:25, height:100, segmentsW:16}); cylinder.x = -ORBITAL_RADIUS; cylinder.ownCanvas = true; group.addChild(cylinder); // Create a torus object and use a checkered, flat-shaded (from white light) bitmap material var checkerBitmapMaterial:WhiteShadingBitmapMaterial = new WhiteShadingBitmapMaterial(Cast.bitmap(checkerBitmap)); torus = new Torus({material:checkerBitmapMaterial, radius:40, tube:10, segmentsT:8, segmentsR:16}); torus.z = ORBITAL_RADIUS; torus.ownCanvas = true; group.addChild(torus); // Create a new cube object using a smoothed, precise, phong-shaded, mat (not shiny) bitmap material var away3DMaterial:PhongBitmapMaterial = new PhongBitmapMaterial(Cast.bitmap(away3DBitmap), {smooth:true, precision:2}); away3DMaterial.shininess = 0; centerCube = new Cube({material:away3DMaterial, width:75, height:75, depth:75}); centerCube.ownCanvas = true; group.addChild(centerCube); // add mouse listeners to all the 3D objects sphere.addOnMouseDown(onMouseDownOnObject); cube.addOnMouseDown(onMouseDownOnObject); cylinder.addOnMouseDown(onMouseDownOnObject); torus.addOnMouseDown(onMouseDownOnObject); centerCube.addOnMouseDown(onMouseDownOnObject);
sphere.ownCanvas = true;
这句话很重要,没有这句话,当 objects 被别的 objects 遮挡了 ,他们可能不会被正确渲染
发表评论
-
Away3D(八):Texture mapping
2009-12-04 16:09 1126BitmapMaterial :用于简单texture ma ... -
Away3D(七):Primitives(Part 3)
2009-12-04 14:58 1566The Cone:(圆锥) // creat ... -
Flash3D 编程技巧:全景浏览的键盘交互(Away3D)
2009-12-04 14:12 1632创建三个侦听: this.stage.add ... -
Away3D(六):Primitives(Part 2)
2009-12-04 14:07 1155The Trident:(坐标轴) ... -
Away3D(五):Primitives(Part 1)
2009-12-01 17:03 1274The Triangle: var tri: ... -
Away3D(四):Create the Earth and heavens in less than an hour with Away3D
2009-12-01 16:18 1450原文:http://www.flashmagazine.com ... -
Flash3D编程技巧:物体环视浏览器(Away3D)
2009-11-30 19:59 2173定义一些以后会用到的 ... -
Away3D(三):Manipulating 3D objects
2009-11-30 19:55 1132Movement in 3D space: ... -
Away3D(二):The View and the Scene
2009-11-30 19:49 1120The View: var view:View3 ... -
Away3D(一):The Camera(s)
2009-11-30 19:44 1367原理图: Away3D Cameras: ... -
Flash3D 编程技巧:全景浏览的鼠标交互(Away3D Lite)
2009-11-26 14:20 20641. 注册侦听器 addEventListe ... -
Away3D Lite:Flex Project 使用模板
2009-11-26 09:57 17531. 3D as实现类,同ActionScript Proje ... -
Away3D Lite:Others
2009-11-24 19:42 2067使用TargetCamera: // 将ca ... -
Away3D Lite:ExMD2Cubic
2009-11-24 19:28 1113加载MD2模型文件: // 位图文件材质 ... -
Away3D Lite:ExCollada
2009-11-24 15:26 1083采用FastTemplate模板: 默认st ... -
Away3D Lite:Basic_LoadModel
2009-11-24 13:57 2054开启Debug模式:具体什么作用,尚不知 / ... -
Away3D Lite:Basic_InteractiveObject
2009-11-22 20:29 1856初始化引擎: sce ... -
Away3D Lite:Basic_SceneSetup
2009-11-20 16:35 1450scene = new Scene3D(); // 亦可 ...
相关推荐
斯坦福的图形学课件 The Graphics Pipeline and OpenGL II: Lighting and Shading, Fragment Processing
光照和着色相关,详细全面阐述了光照和着色的基础知识。
pbrt-skin-bssrdf Donner & Jensen 的“A Spectral BSSRDF for Shading Human Skin”在 PBRT 中的实现
* Implement basic lighting and shading techniques such as diffuse and specular shading, per-fragment shading, and spotlights * Apply single or multiple textures * Use textures as environment maps ...
Flat Kit Toon Shading and Water 2.1.3 最新版本
示例代码 大卫·沃尔夫(David Wolff)出版并由Packt Publishing发行的的示例代码。 要求 要编译这些示例,您将需要以下内容: 0.9.6或更高版本。 请注意,0.9.6之前的版本可能无法正常使用,因为从度数转换为弧度...
图形学实验:flat shading C++源码(用opengl实现) 给定物体的动态序列(见附件),请利用局部光照模型将其渲染。要求: (1)给场景增加一个平坦的地面模型,增加纹理到地面上更好; (2)在适当位置设置两个光源; ...
OpenGL is the leading cross-platform 3D-graphics API, and the OpenGL Shading Language allows developers to take total control over the most important stages of the graphics-processing pipeline.
apple公司的lens shading专利,用于iphone手机上使用。
shape from shading 的matlab实现
OpenGL® Shading Language is the experienced application programmer's guide to writing shaders. Part reference, part tutorial, this book thoroughly explains the shift from fixed-functionality graphics...
Flat shading Flat shading Flat shading Flat shading Flat shading Flat shading Flat shading Flat shading Flat shading Flat shading Flat shading Flat shading Flat shading
Abstract_Isophote_Distance_A_Shading_Approach_to_Artistic_Stroke_Thickness
1、Ruo Zhang,Ping-Sing Tsai, James Cryer and Mubarak Shah, Shape from Shading: A Survey' 2、 James Cryer, Ping-Sing Tsai and Mubarak Shah. Shape from Shading and Stereo 3、Ping-sing Tsai and Mubarak ...
介绍了一种shape from shading的新方法
Deferred Shading延迟光照,例子简单易懂,很容易理解哈
Introduction to the OpenGL Shading Language Section 2.2. Why Write Shaders? Section 2.3. OpenGL Programmable Processors Section 2.4. Language Overview Section 2.5. System Overview Section 2.6. Key ...
非常不好找的 opengl 4.0 shading language cookbook 源码 GLSL COOKBOOK 源码 opengl 4.0 shading language cookbook 源码 GLSL COOKBOOK 源码 opengl 4.0 shading language cookbook 源码 GLSL COOKBOOK 源码 ...
- Ramp Shading (manual or texture) - Normal/Parallax mapping - Specular (classic, PBR or cartoon) - Reflection Cubemap/MatCap - Reflection Probes (Unity 5 only) - Rim Lighting/Rim Outline - Colorable ...
Shading Language, Third Edition, includes updated descriptions for the language and all the GLSL entry points added though OpenGL 3.1, as well as updated chapters that discuss transformations, ...