Stage3D opengl : Flat shading

Software: Away3D 4.x

highrise, Newbie
Posted: 05 April 2012 10:32 AM   Total Posts: 9

Hi,

Is there a way to get old school flat shading when using stage3d? Seems like the opengl smooths everything out.

Thanks

Ben

   

Avatar
Fabrice Closier, Administrator
Posted: 05 April 2012 10:39 AM   Total Posts: 1265   [ # 1 ]

Just ensure your faces are not sharing normals.
or run the Explode class on your mesh(es)

 

   

highrise, Newbie
Posted: 05 April 2012 10:49 AM   Total Posts: 9   [ # 2 ]

Thanks for the quick reply.

Ah yes that works. The only issue is that when I manipulate the Vertex data the shape breaks up.

Thanks

Ben

 

   

highrise, Newbie
Posted: 05 April 2012 10:56 AM   Total Posts: 9   [ # 3 ]

This is the non exploded version.

I’m looking for something like this:

http://www.geepers.co.uk/software/spikeyballdemo.html

 

   

Avatar
kurono, Sr. Member
Posted: 05 April 2012 12:42 PM   Total Posts: 103   [ # 4 ]

1) Create a sphere:Mesh;
2) Move its vertices according to your wishes
3) Explode.apply(sphere);

If you want a sphere not to destruct, use Weld.apply(sphere) before new moving of vertices.

 

   

highrise, Newbie
Posted: 05 April 2012 01:05 PM   Total Posts: 9   [ # 5 ]

Thanks I’ll try this.

One of the issues is that I’m having to load the geodesic sphere as an .obj rather than create it. The geodesic primitive isn’t available for away3d 4, hence this post viewthread/2255/

Ben

 

   

Panax, Newbie
Posted: 05 May 2012 03:48 AM   Total Posts: 1   [ # 6 ]

I ran into a similar issue exporting an .obj from Blender and choosing to ‘Include Normals’ fixed it for me.

 

   

Avatar
Fabrice Closier, Administrator
Posted: 05 May 2012 01:43 PM   Total Posts: 1265   [ # 7 ]

@highrise what you want to achieve can be done in both “exploded” or “welded” state. The problem (shape breaks) is caused by the way you loop over the vertices for your updates. In welded case, you probably need only to loop over the vertices, alter and update, while in “exploded” case, you need to ensure that vertices sharing same original state value get the same update value (probably a direction by a factor) and only once. In welded state, even if your update value would be wrong (not saying it is) the mesh surface would remain “connected”. (assuming it was connected in original state)

 

   

Neuromancer, Newbie
Posted: 07 May 2012 12:31 PM   Total Posts: 2   [ # 8 ]
Panax - 05 May 2012 03:48 AM

I ran into a similar issue exporting an .obj from Blender and choosing to ‘Include Normals’ fixed it for me.

Many thanks for this very useful hint. That did it for me.

 

   

highrise, Newbie
Posted: 12 May 2012 04:19 PM   Total Posts: 9   [ # 9 ]

Thanks for the posts. I ended up Exloding a loaded .obj. Storing all of the verticles that are effectively the same point in a single Vector3D, I could then manipulate these points without the models breaking up. Sorry I don’t have the 3D jargon but happy to post code if it helps.

Thanks

Ben

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X