I had a look at the normal map. It is a tangent space version, rather then the object space.
Ian On Jan 20, 8:45 pm, Fabrice <[email protected]> wrote: > Are you sure you are outputing a objectspace normalmap? > > Try the generator class, to make your normalmap. > If it looks good, that's probably because you export your map as > tangent normalmaps. > the z information is used/applied another way, and I think that's what > is happening here. > not sure tho... > > note that tangent maps will be supported soon > > Fabrice > > On Jan 20, 2009, at 9:28 PM, zhil wrote: > > > > > > > Hi there! > > I have created simple application, which load normal map, simple > > texture and shirt model, but for some reasons it looks pretty strange > > - like if normal map was inverted for some reason (showing dark > > instead of light and vice verse) > > > Online demo here > >http://files.rightinpoint.com/tailor_65s6d562/tailor2.html > > > Source model > >http://files.rightinpoint.com/tailor_65s6d562/shirt4.jpg > > > Source code > > > package { > > import flash.display.*; > > import flash.events.*; > > import flash.net.*; > > import away3d.core.*; > > import away3d.events.*; > > import fl.controls.List; > > import fl.data.DataProvider; > > > import away3d.core.base.*; > > import away3d.containers.*; > > import away3d.primitives.*; > > import away3d.materials.*; > > import away3d.loaders.*; > > import away3d.cameras.*; > > import away3d.core.utils.Cast; > > import away3d.events.*; > > import away3d.lights.*; > > > public class Tailor2 extends Sprite { > > var view:View3D; > > var scene:Scene3D; > > var camera:HoverCamera3D; > > var objLoader:Object3DLoader; > > var obj:ObjectContainer3D; > > var objLoader2:Object3DLoader; > > var obj2:ObjectContainer3D; > > var material:Dot3BitmapMaterial; > > var _loader:Loader; > > var _loader2:Loader; > > var _bitmapData:BitmapData; > > var light:DirectionalLight3D; > > var move:Boolean = false; > > var lastPanAngle:Number; > > var lastTiltAngle:Number; > > var lastMouseX:Number; > > var lastMouseY:Number; > > > var selectGroup:Sprite; > > var selectMiddle:List; > > > function Tailor2() { > > stage.frameRate=60; > > away3dcreate(); > > // initSelect(); > > } > > function initSelect() { > > selectMiddle = new List(); > > selectGroup.addChild(selectMiddle); > > } > > function away3dcreate():void { > > scene = new Scene3D(); > > camera = new HoverCamera3D({zoom:3, focus:200, > > distance:10000}); > > camera.targetpanangle = camera.panangle = -10; > > camera.targettiltangle = camera.tiltangle = 20; > > camera.yfactor = 1; > > view=new View3D({scene:scene,camera:camera,x:450,y:450}); > > addChild(view); > > _loader = new Loader(); > > > > _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, > > onLoadTextureComplete); > > _loader.load(new URLRequest("assets/t.jpg")); > > } > > function onLoadTextureComplete(e:Event):void { > > trace("onLoadTextureComplete"); > > _bitmapData = Bitmap(_loader.content).bitmapData; > > _loader2 = new Loader(); > > > > _loader2.contentLoaderInfo.addEventListener(Event.COMPLETE, > > onLoadNormalComplete); > > // _loader2.load(new URLRequest("assets/wp/normal.jpg")); > > _loader2.load(new > > URLRequest("assets/normal_from_Zbrush6.jpg")); > > } > > function onLoadNormalComplete(e:Event):void { > > trace("onLoadNormalComplete"); > > // light = new DirectionalLight3D({color:0xFFFFFF, > > ambient:0.25, > > diffuse:0.85, specular:0.95}); > > light = new DirectionalLight3D({color:0xFFFFFF, > > ambient:0.15, > > diffuse:0.95, specular:0.95}); > > light.x = 10; > > light.z = 1; > > light.y = 1; > > scene.addChild( light ); > > material = new Dot3BitmapMaterial(_bitmapData,Bitmap > > (_loader2.content).bitmapData,{}); > > //material = new > > Dot3BitmapMaterial(Cast.bitmap(TorsoImage), > > Cast.bitmap(TorsoNormal)); > > // objLoader = Max3DS.load("assets/wp/men_normal_fit.3DS", > > {material:material, ownCanvas:true, name:"torso", centerMeshes:true}); > > objLoader = Max3DS.load("assets/2009_01_20v2.3DS", > > {material:material, ownCanvas:true, name:"torso", centerMeshes:true}); > > objLoader.addOnSuccess(objOnSuccess); > > //objLoader2 = > > Max3DS.load("assets/collar.3DS",{material:material, > > ownCanvas:true, name:"torso", centerMeshes:true}); > > //objLoader2.addOnSuccess(obj2OnSuccess); > > } > > function objOnSuccess(e:Event):void { > > trace("objOnSuccess"); > > obj = (objLoader.handle as ObjectContainer3D); > > autoAdjust(obj); > > view.scene.addChild(obj); > > camera.lookAt(obj.position); > > initListeners(); > > } > > function autoAdjust(obj:ObjectContainer3D) { > > trace(obj.minX); > > trace(obj.maxX); > > trace(obj.minY); > > trace(obj.maxY); > > trace(obj.minZ); > > trace(obj.maxZ); > > > > obj.movePivot((obj.minX+obj.maxX)/2,(obj.minY+obj.maxY)/2,(obj.minZ > > +obj.maxZ)/2); > > > > obj.scale(10000/Math.max(Math.abs(obj.minX-obj.maxX),Math.abs > > (obj.minY-obj.maxY),Math.abs(obj.minZ-obj.maxZ))); > > obj.rotationX = 90; > > } > > function initListeners():void { > > addEventListener( Event.ENTER_FRAME, onEnterFrame ); > > stage.addEventListener(MouseEvent.MOUSE_DOWN, > > onMouseDown); > > stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp); > > } > > > /** > > * Navigation and render loop > > */ > > function onEnterFrame(event:Event):void { > > view.camera.moveTo(obj.x,obj.y,obj.z); > > view.camera.rotationY=mouseX/2; > > view.camera.rotationX=mouseY/2; > > view.camera.moveBackward(5); > > //obj.rotationY+=1; > > view.render(); > > > if (move) { > > camera.targetpanangle = 0.3*(stage.mouseX - > > lastMouseX) + > > lastPanAngle; > > camera.targettiltangle = 0.3*(stage.mouseY - > > lastMouseY) + > > lastTiltAngle; > > } > > camera.hover(); > > view.render(); > > } > > > /** > > * Mouse down listener for navigation > > */ > > function onMouseDown(event:MouseEvent):void { > > lastPanAngle = camera.targetpanangle; > > lastTiltAngle = camera.targettiltangle; > > lastMouseX = stage.mouseX; > > lastMouseY = stage.mouseY; > > move = true; > > stage.addEventListener(Event.MOUSE_LEAVE, > > onStageMouseLeave); > > } > > > /** > > * Mouse up listener for navigation > > */ > > function onMouseUp(event:MouseEvent):void { > > move = false; > > stage.removeEventListener(Event.MOUSE_LEAVE, > > onStageMouseLeave); > > } > > > /** > > * Mouse stage leave listener for navigation > > */ > > function onStageMouseLeave(event:Event):void { > > move = false; > > stage.removeEventListener(Event.MOUSE_LEAVE, > > onStageMouseLeave); > > } > > } > > } > > > Location of the models the same as in the source. > > > Any ideas what could be the reason? > > - problems in 3ds model (it was created in Maya, exported as obj, > > imported into 3dmax, exported as 3ds)? > > - problems in normal map? > > - problems in lights settings in action script? I have played with > > different settings, but was failed to locate reason. > > - bug in away3d? > > > Right now I dont have any ideas how I can move forward with this bug, > > so any help are welcome.- Hide quoted text - > > - Show quoted text -
