One other thing, not sure if this is of any help but I know that extrusions made with the Sandy3D lathe class produce a mesh which works as expected with phong shading when using that engine.
http://code.google.com/p/sandy/source/browse/trunk/sandy/as3/trunk/src/sandy/extrusion/data/Lathe.as Tim On Jun 9, 9:22 am, Fabrice3D <[email protected]> wrote: > yes that would be possible, I would tho, use curves for the profile instead > of points > of course if the points you pass are incremented on y at the equivallent of 1 > pixel (which i suppose you do), you of course get the same. > but it would simplify the work if you do not use straight lines definition. > Also another way would be to consider a map. > where x equals the rotation axis. The benefit would be not only to have > variable profiles written on the map, but also bump info... > > This is very interresting addOn for the Lathe class. However there are first > some issues that need to be resolved first in this class. > Your snippet is saved, will see if we can implement this in more generic way, > as it would be cool to get a map from more primitives/generators classes. > > thx for pointing this out. > > Fabrice > > On Jun 9, 2010, at 1:36 AM, Marko Schütz Schmuck wrote: > > > as an aside: > > > In one (circular) LatheExtrusion the profile was described as exact > > shapes (arcs and lines). Also, the profile changes dynamically. So I > > obtained a higher resolution profile than the one I extruded and used > > > package { > > import Kreis; > > import away3d.core.math.MatrixAway3D; > > import away3d.core.math.Number3D; > > import flash.display.BitmapData; > > public class NormalMapGeneratorCircularExtrusion { > > private var _profileNormals : Array; > > //private var _axis : String; // around y axis only for now > > private var _normalMap : BitmapData; > > private var _width : uint; > > private var _height : uint; > > > /** > > NormalMapGeneratorCircularExtrusion > > profileNormals : normals of the profile (normalized) > > **/ > > public function NormalMapGeneratorCircularExtrusion(profileNormals : > > Array, //axis : String, > > width : uint):void { > > var stepAngle : Number = 360.0 / width; > > var rot : MatrixAway3D = new MatrixAway3D; > > _profileNormals = profileNormals; > > //_axis = axis; > > _height = _profileNormals.length; > > _width = width; > > _normalMap = new BitmapData(_width, _height); > > > var point : Number3D = new Number3D; > > for (var x : uint = 0; x < _width; x++) { > > rot.rotationMatrix(0.0, 1.0, 0.0, Kreis.radians(-stepAngle*x)); > > for (var y : uint = 0; y < _height; y++) { > > point.clone(profileNormals[y]); > > point.rotate(point, rot); > > var r : int = 127 + point.x * 127; > > var g : int = 127 + point.y * 127; > > var b : int = 127 + point.z * 127; > > _normalMap.setPixel(x, y, > > ((r>255) ? 255 : r) << 16 | ((g>255) ? 255 : g) > > << 8 | ((b>255) ? 255 : b)); > > } > > } > > } > > public function get normalMap():BitmapData { > > return _normalMap; > > } > > } > > > } > > > in order to generate a much more detailed normal map. > > > I was thinking that the LatheExtrusion class could actually be > > modified to optionally compute a normal map from an optional > > high-resolution profile when the extrusion is done. > > > Best regards, > > > Marko > > > At Tue, 8 Jun 2010 08:55:48 -0700 (PDT), > > timdiacon wrote: > > >> OK cheers guys, > > >> Unfortunately the math in that class is way over my head so good to > >> know you have an idea where it's going wrong. > > >> I shall await any further developments with eager anticipation ;-) > > >> On May 19, 10:58 pm, Fabrice3D <[email protected]> wrote: > >>> problem is more linked to face neighbourgs calculation I think, I've > >>> noticed vertex normals being equal to face normal itself. > >>> its a problem I want to look at. > >>> recalcucating each normals "by hand" in prefab allows perfectly smooth > >>> surfaces, without changing the gnerated mesh at all > >>> same applies to all extrusions. > > >>> but I'll know for sure once I come to it. > > >>> Fabrice > > >>> On May 19, 2010, at 11:15 PM, Rob Bateman wrote: > > >>>> Yes, taking a quick look it seems the problem here is that the lathe > >>>> creates separate vertices for each face segment along the axis of a > >>>> lathe - which creates problems for the vertex normal calculations. this > >>>> could be potentially fixed by using the weld class on the created lathe > >>>> to weld together any duplicate vertex positions, although fab would know > >>>> more as these are his classes. fab? > > >>>> On Mon, May 10, 2010 at 4:42 PM, timdiacon <[email protected]> > >>>> wrote: > >>>> Hello, > > >>>> I know this has been mentioned a couple of times before here... > > >>>>http://groups.google.com/group/away3d-dev/browse_thread/thread/52b00f... > > >>>> and here > > >>>>http://groups.google.com/group/away3d-dev/browse_thread/thread/eb3543... > > >>>> Just thought I would mention I have tested the now renamed > >>>> LatheExtrusion in both 2.5 and 3.5 and this problems still seems to be > >>>> there :( > > >>>> The following example shows the results in 3.5 which give a sort of > >>>> flat shaded effect? > > >>>>http://www.iamarobot.co.uk/lathee/main.html > > >>>> I'm desperate to create some nicely shaded lathe objects, has anyone > >>>> got any further insight into this? > > >>>> -- > >>>> Rob Bateman > >>>> Flash Development & Consultancy > > >>>> [email protected] > >>>>www.infiniteturtles.co.uk > >>>>www.away3d.com
