Hi,

I have finally sorted this out.
I found two isssues. The first one was due to the obj exporter that
inverts X and Y. Since this is an option when exporting to obj, I
simply unticked this option.
But even after that, the colors where inverted on some axes. I then
used photoshop to invert the colors to get this right.

Now I am doing to very same demo with a more complex geometry. And, as
expected, the same problem arises: the colors are inverted on some
axes. While it was easy to spot the area to invert on a simple cube,
now it is way more complex. I tried to export to obj and 3ds and the
same problem occurs.

My question is how can I get the oriention right when exporting from
Blender? or, is there a trick to invert the colors after the geometry
and the textures have been generated ?

Sylvain

On 10 fév, 10:29, David Lenaerts <[email protected]> wrote:
> Hi Sylvain,
>
> To test things, why not set the normal map you're using as a normal texture
> using BitmapMaterial. That way we can easily see what points which way :-)
>
> Cheers,
> David
>
> On Wed, Feb 10, 2010 at 10:25 AM, Sylvain Godbert <[email protected]
>
>
>
> > wrote:
> > Tks David,
> > It seems that this is not only a problem of the mapping being upside-
> > down. It seems that colors were used regardless of the axis (e.g. the
> > face on top of the cube in the demo is lighted when the light is
> > directed to the rear face.). check "http://www.sylvaingodbert.net/
> > away3d"
> > I can still use photoshop to re-position my texture based on the
> > result I get, but I am wondering where there issue comes from.
> > Does that mean that either the uv coordinates are wrong or that it got
> > changed somewhere in the process of importing my object + texture into
> > my project ? Or maybe, Blender calculated the colors in the wrong
> > way ?
>
> > Sylvain
>
> > On 10 fév, 09:37, David Lenaerts <[email protected]> wrote:
> > > 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
>
> --http://www.derschmale.com

Reply via email to