Hi Sylvain,

There doesn't seem to be a real standard with normal maps and the direction
of the axes (for instance, 0x00ff00 green could either be up or down). A
quick way to check is to set the light in the same position as the object,
and then try with light.x += 5000 (or so) and see if it matches. Repeat for
y and z. You can use Photoshop to invert colour channels (red = x, green =
y, blue = z).

Hth,
David

On Wed, Feb 10, 2010 at 12:03 AM, Sylvain Godbert <[email protected]
> 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
>



-- 
http://www.derschmale.com

Reply via email to