Thats probably the well known issue of righthanded to left handed system. that is if you see a flipped map if this is a lightmap issue, say renderings shows the light coming from another position, I've added to Prefab on normalmap renderer a "invert x", which basically inverses the normal x at the vertexes.
in case you do not want use Prefab to render the map, you simply can apply a colorshift like this: var ct:ColorTransform = new ColorTransform(-1,1,1,1,255,0,0,0); apply or draw this transform to your (destination) map. Fabrice On Feb 10, 2010, at 12:03 AM, Sylvain Godbert wrote: > Hi, > > Now it is working.. sort of. Problem now is that the faces that are > lighted are not the ones directed to the light. > > I made an object-space normal map for my cube. What I did is that : > 1 - Made a cube with blender and an objet-space normal map > 2 - Saved the geometry (including uv) using the "obj" exporter > 3 - Used Prefab to convert my geometry into an as file > 4 - Instanciated my objet, loaded the map and created my > PhongPBMaterial object > > It seems that, for some reasons, the orientation of the object does > not match with the coordinate of the texture. Any idea how I can fix > that ? > > Sylvain > > > On 8 fév, 10:20, Sylvain Godbert <[email protected]> wrote: >> Hi, >> >> Thanks again >> You are spot on. Indeed I was using a linear normal map. I will give >> it a go with an object space map. >> >> Sylvain >> >> On 8 fév, 00:00, David Lenaerts <[email protected]> wrote: >> >>> Hi again! >> >>> Looks to me you're using a tangent space normal map rather than an object >>> space one, which is required for these pb shaders. Using tangent space maps >>> will make the shader think all faces are in the same direction :-) >> >>> Cheers! >>> David >> >>> On Sun, Feb 7, 2010 at 10:05 PM, Sylvain Godbert >>> <[email protected]>wrote: >> >>>> Hi David, >> >>>> Tks for your reply. >> >>>> I forgot to mention that the whole cube gets black (including the back >>>> face where the light is directed to). >>>> I put the demo online so that you undertand what I am on about (http:// >>>> www.sylvaingodbert.net/away3d/). >> >>>> Cheers >> >>>> Sylvain >> >>>> On 7 fév, 20:30, David Lenaerts <[email protected]> wrote: >>>>> Hi Sylvain, >> >>>>> Makes perfect sense to me for a point light that's placed behind the cube >>>> to >>>>> cause completely dark sides (since they're pointed away from the light, >>>>> there's no way a ray starting from the light's position could reach that >>>>> side of the faces). What you could do is to try and add an ambient light >>>> to >>>>> the scene in addition to the point light, and see if that helps. >> >>>>> Cheers, >>>>> David >> >>>>> On Sun, Feb 7, 2010 at 1:36 PM, Sylvain Godbert >>>>> <[email protected]>wrote: >> >>>>>> Hi all, >> >>>>>> I made a little demo using "PhongPBMaterial". I have a simple cube >>>>>> that has a diffuse texture and a normal map texture. I made a >>>>>> PointLight3D light orbiting around this cube. >> >>>>>> The weird thing is that when the light goes behind the cube, the >>>>>> entire cube gets no light at all (the cube becomes pitch black and >>>>>> therefore disappears) >> >>>>>> The code to instanciate my cube and the material is the following : >> >>>>>> var normalMap = new _Texture_bois_nmp().bitmapData; >>>>>> var diffuseMap = new _Texture_bois().bitmapData; >>>>>> _phongShaderMaterial = new >>>>>> PhongPBMaterial( diffuseMap,normalMap,_Cube,null,{specular: 0.5,gloss: >>>>>> 20,smooth : true}); >> >>>>>> _Cube = new Cube(); >>>>>> _Cube.width = 150; >>>>>> _Cube.height = 80; >>>>>> _Cube.depth = 80; >>>>>> _Cube.material = _phongShaderMaterial; >>>>>> _View.scene.addChild(_Cube); >> >>>>>> The declaration of the light is done like this : >> >>>>>> _pointLight = new PointLight3D({color: 0xffeedd}); >>>>>> _View.scene.addChild(_pointLight); >>>>>> _pointLight.brightness = 0.8; >>>>>> _pointLight.specular = 0.5; >>>>>> _pointLight.radius = 56000; >>>>>> _pointLight.fallOff = 60000; >>>>>> _pointLight.x=-150; >>>>>> _pointLight.z = -200; >> >>>>>> Am I missing a parameter somewhere that I should set? Like : >>>>>> "cube.getsLightWhenLightIsBehind=true" :) ? >> >>>>>> Sylvain >> >>>>> --http://www.derschmale.com >> >>> --http://www.derschmale.com
