Creating a Flat shaded materiall in Away3d 4

Software: Away3D 4.x

frank_a, Newbie
Posted: 15 March 2012 09:13 PM   Total Posts: 5

Is there support for creating a flat lighted shaded material in away3d 4?

   

Avatar
Fabrice Closier, Administrator
Posted: 15 March 2012 10:50 PM   Total Posts: 1265   [ # 1 ]

use the Explode class on your mesh.

 

   

frank_a, Newbie
Posted: 16 March 2012 01:45 PM   Total Posts: 5   [ # 2 ]

Thanks for your reply but that doesn’t seem to do the trick.

Attached is a screenshot that may help illustrate what I’m trying to achieve here.

I loaded the same .obj file I’m working with in Away into a program called MeshLab. MeshLab has two settings for Render Mode, flat or smooth.

The Flat render mode is on the left and smooth is on the right. When I load my .obj into Away3D the result looks exactly like MeshLab’s smooth render mode.

In order to get a flat result I’ve tried to set the smooth flag on my ColorMaterial to false but that doesn’t seem to change anything.

I’m now starting to look into the materials shadowMethod because I was able to find a smooth boolean on ShadingMethodBase although I’m honestly not sure if adjusting this will have any effect either.

Below is the code for creating my light and light picker,

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); 

And this is my material:

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

Thanks!

 

   

frank_a, Newbie
Posted: 19 March 2012 03:30 PM   Total Posts: 5   [ # 3 ]

Anyone happen to have any ideas?

 

   

Nina, Newbie
Posted: 25 March 2012 11:26 PM   Total Posts: 3   [ # 4 ]

I happened to have the opposite problem when exporting from Blender for Proscenium.

I forgot to include face normals to the export so I first only got flat shaded models.

Maybe just disabling face normals in the obj file could get you the results. Or if they aren’t enabled already, just try to export them (when exporting with Blender, there is an options menu on the left hand side of the screen)

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X