Monday, September 28, 2009

On Color, Materials and Lighting

First I should say what everyone says - yeah it's been a while. One excuse is I always think it'll take me a long time to write anything here so I put it off. That's because I want to write well, so I spend a lot of time expanding explanations. Maybe I can put more stuff in this blog if I just write my fast way - which is usually point lists.

Reading 'OpenGL SuperBible' by Richard Wright has given me something to say. I'm at the chapter on Color, Materials and Lighting. I think specularity should be a property of the material, not a lighting property. Every surface should have a reflectance specification. Then the amount of normal light that bounces off surface would be calculated.

Thus one would specify 'dull', 'matte', 'bumpy', 'shiny', 'glass' for surface (numerically). This could be specified per-vertex, like colours, and get gradiented like colours are. Or reflectance surface could be like a texture, but each pixel is a reflectance value 0.0-1.0. This would just specify the proportion of light that is reflected - at incidental angle. Or each point of the reflectance surface could be a vector showing which way that point points, so the renderer could calculate where the light reflects to.

You wouldn't need a specular light, or even a diffuse light. The rendering engine could calculate the effects of light bouncing off a shiny surface onto other surfaces for diffuse light. It will take more CPU, but provide more realism.

Because really what you want is to say there's a huge sun millions of miles away, but only its rays provide the primary luminance, everything else is reflected.

Also you want to add diffusion property for volumes, to define what happens to light passing through gas or water or glass. This is internal reflectance.

By the way, I have updated the projects list on the Nimajin web site.

So, it took 10 minutes to get the lighting points up, then another 20 for the picture, introduction, advertising and editing (and another 10 to fix fonts and spacing!).

2 comments:

DRB said...

...and about 1-2 minutes to read the post and glance at the photo : )

I don't really have anything constructive to say but I figure the more comments you get the more likely you are to continue making interesting posts.

Ted said...

Thanks, I am obliged for your comment Daniel. And, I guess, obligated to make another post! I suppose my policy should be that posts be made interesting to avoid meaningless comments. (Another 5 minutes to think of a witty follow-up comment)