我目前正在尝试在 Away3d 4 内创建一个“平面”阴影 ColorMaterial,以用作加载的 .obj 文件上的网格。
这是我想要实现的截图。平面阴影模型在左侧。
我将在 Away 中使用的同一个 .obj 文件加载到一个名为 MeshLab 的程序中。MeshLab 有两种渲染模式设置,平坦或平滑。
平面渲染模式在左侧,平滑在右侧。当我将 .obj 加载到 Away3D 中时,结果看起来与 MeshLab 的平滑渲染模式完全一样。
为了获得平坦的结果,我尝试将 ColorMaterial 上的平滑标志设置为 false,但这似乎并没有改变任何东西。 http://away3d.com/livedocs/away3d/4.0/away3d/materials/MaterialBase.html
我现在开始研究材料 shadowMethod,因为我能够在 ShadingMethodBase 上找到一个平滑的布尔值,尽管老实说我不确定这是否是你可以处理的地方。
http://away3d.com/livedocs/away3d/4.0/away3d/materials/DefaultMaterialBase.html#shadowMethod http://away3d.com/livedocs/away3d/4.0/away3d/materials/methods/ShadingMethodBase.html
下面是创建我的灯光和灯光选择器的代码,
dL = new DirectionalLight();
dL.diffuse = 20;
dL.ambient=.6;
dL.specular=15
scene.addChild(dL);
lightPicker= new StaticLightPicker([dL]);
dL.direction = new Vector3D(0,1,-2);
这是我的材料,我尝试过使用它的大部分属性:
primitiveMaterial = new ColorMaterial(0xcccccc);
primitiveMaterial.smooth = false;
primitiveMaterial.bothSides = false;
//primitiveMaterial.gloss = 800;
//primitiveMaterial.diffuseLightSources = LightSources.LIGHTS;
primitiveMaterial.diffuseMethod.alphaThreshold = .3;
primitiveMaterial.ambient =.2;
primitiveMaterial.lightPicker=lightPicker;
谁能帮我指出正确的方向?
谢谢!