Status of lighting in

Jan 28, 2011 at 12:17 AM

Hello.  I'm new to Balder and I'm having lighting issues.  I'm trying to get Ambient working but it doesn't seem to pay attention to any setting I've tried.  I think Specular and Diffuse are working.  Also the tutorials and sample browser don't seem to have working lighting either.

Jan 29, 2011 at 12:09 PM

You're absolutely right - I'm not sure, but Ambient was commented out in the lighting calculations - and not included in some of the rendering methods. 

I'm working on fixing that right now and checking it in. Will let you know when you can get the latest source.

Jan 29, 2011 at 12:12 PM

In fact - now its fixed. :) Pushed to the source repository

Feb 1, 2011 at 5:24 PM

Thanks.  I had downloaded the latest source and it wouldn't compile.  So I tried and it worked.  Then I discovered that came with source and it compiled and it's compiled binaries worked while the provided binaries did not.  Now I got the latest source again and now it does compile and the light samples appear to be working again.

Now the problem I have is Ambient light for an object with a Material.  I'm not sure if you intend there to be a Global Ambient Light (which is what I'm used to) or a per Light Ambient (never liked this approach), or per Material (never heard of this approach) or what?

Feb 1, 2011 at 8:08 PM

Good to hear thats its sort of working out for you.

I'm very open to suggestions. I've been a bit back and forth with this myself. And at one point there was a global ambient light and I also added a per light ambient. The ambient on the material decision is basically based on how 3DSMAX handles it, although there is ambient for the scene for 3DSMAX as well. So maybe that could be a good combo, or even a combination of the three - with black being the default ambient for all three and then you'd have the flexibility to adjust this as one pleases. 

What do you think?


Feb 1, 2011 at 8:51 PM

One article I ran across defines it like this:

The lit color of a vertex is the sum of the material emission intensity, the product of the material ambient reflectance and the lighting model full-scene ambient intensity, and the contribution of each enabled light source.

Each light source contributes the sum of three terms: ambient, diffuse, and specular. The ambient light source contribution is the product of the material ambient reflectance and the light's ambient intensity. The diffuse light source contribution is the product of the material diffuse reflectance, the light's diffuse intensity, and the dot product of the vertex's normal with the normalized vector from the vertex to the light source. The specular light source contribution is the product of the material specular reflectance, the light's specular intensity, and the dot product of the normalized vertex-to-eye and vertex-to-light vectors, raised to the power of the shininess of the material.

All three light source contributions are attenuated equally based on the distance from the vertex to the light source and on light source direction, spread exponent, and spread cutoff angle. All dot products are replaced with 0 if they evaluate to a negative value. Finally, the alpha component of the resulting lit color is set to the alpha value of the material diffuse reflectance.

If I understand it properly, there's a certain amount of global ambient.  I light's ambient can allow for 0%, 100% or perhaps amplify the ambient within it's domain.  The material ambient is how much of the resulting ambient is seen.  0% (Black) and ambient has no effect, 100% (White) and global ambient is fully applied.  I don't have access to Max or I'd try some tests to see how it handles things.  As I said, I never liked the per-light ambient.  It doesn't seem useful (realistic).

In the Torque engine they also have the ability to override certain lighting properties like adding a custom ambient value that's independent of lighting.

Feb 2, 2011 at 7:37 PM

Excellent input - thanks! 

I'll revisit lighting and make it more robust and flexible. 

Feb 2, 2011 at 7:37 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.