Jump to content

Negative specular: feature or bug?


qqdarren
 Share

Recommended Posts

I was playing around with animating specularColor and accidentally made it negative, which gave a black circle instead of a white one. (compared to no circle at all when I set to 0,0,0).

 

And with a specularColor of -0.3,-0.3,-0.3 and changing the point light to purple, I get a green circle instead of a purple one. (See sphere4 in http://www.babylonjs-playground.com/#1FSFVV )

I just wondered if this was a feature, that will stay supported, or a side-effect that could change? (I noticed that the documentation for the Color3 class just says they are "number", not 0.0 to 1.0 numbers, so it might be good to clarify the intention there?)

 

No, I don't have a use-case for it... yet :-)

Link to comment
Share on other sites

That link is still working for me. (I don't have to set anything to make my playground entries public, do I ?)

 

Anyway, it was just the Materials start demo, with these lines added:

light.specular = new BABYLON.Color3(1, 0, 1); //Purple light ...materialSphere4.specularColor = new BABYLON.Color3(-0.3,-0.3,-0.3);

Then I added this at the end:

var animDelta = 0.01;scene.registerBeforeRender(function () { materialSphere2.alpha += animDelta; if(materialSphere2.alpha <=0.0 || materialSphere2.alpha >= 1.0)animDelta = -animDelta; materialSphere2.specularColor.r = materialSphere2.specularColor.g = materialSphere2.specularColor.b = -materialSphere2.alpha;});
Link to comment
Share on other sites

I've found the exact same result by mistake.  I thought of reporting this as a bug, however, I view it more as a feature - since there might be a use for it - although I haven't found one yet.  I never tried changing the color of my scene light and testing with negative specular values. This might be a case were there could be a use for allowing and using negative values in a scene; not only in the specular channel, but with diffuse and other color channels.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...