Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambient light/directional light shader errors - incorrect color displayed #33

Open
4creators opened this issue May 21, 2011 · 0 comments
Assignees
Labels

Comments

@4creators
Copy link

Test: set texture with any test gray color. Create object with texture without DirectionLight and PointLight. Set material

properties mat.ambientColor = 0xffffff;
mat.ambient = 1;

This values should result in 1 to 1 result for shader pass.

Run test and measure displayed by molehill engine texture color. In my test I have got the following result:

  1. Test color: 0xd3d3d3;
  2. Displayed color: 0xcacaca;

Obviously test and displayed color should be equal.

Similar test with directional light, ambient light and the following BitmapMaterial settings for test color 0xffffff:

        var dirLight:DirectionalLight = new DirectionalLight(-1, -1, -1);
        dirLight.color = 0xffffff;
        dirLight.specular = 0.5;
        dirLight.diffuse = 1;

        var mat:BitmapMaterial = new BitmapMaterial(this._cubeTexture.bitmapData);
        mat.lights = [dirLight];
        mat.ambientColor = 0xffffff;
        mat.ambient = 1;

gives 0xb2b2b2 displayed color (0xffffff was expected for face not lit by directional light and having only ambient contribution).

Another test run with point light and the following settings:

        var pointLight:PointLight = new PointLight();
        pointLight.color = 0xffffff;
        pointLight.specular = 0.5;
        pointLight.diffuse = 1;
        pointLight.position = new Vector3D(5000, 5000, -5000);

        var mat:BitmapMaterial = new BitmapMaterial(this._cubeTexture.bitmapData);
        mat.lights = [pointLight];
        mat.ambientColor = 0xffffff;
        mat.ambient = 0.9;
        mat.gloss = 30;

gives even more bizzarre result: faces are not lit according to light position changing light position to

pointLight.position = new Vector3D(-5000, 5000, -5000);

keeps this same faces lit on cube rotating in front of camera set at standard location.

Light on faces is strange as well as faces which should be visible to ambient light only have 0xffffff color, while faces lit by point light have 0xc5c5c5 color (expected is 0.9 * 0xff - for RGB in ambient light and 0xffffff for full point light).

All tests were done with b2d76b2 commit.

@ghost ghost assigned DerSchmale May 21, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants