Let there be light
Web August 3rd, 2007
Lighting model used in dojox.gfx3d is merged from Eugene’ s 2D lighting utility library. We take a simplified Phong reflection model to gear towards the vector graphics:
- All light sources are infinitely far away
- No shadow support
- Second-order reflections is not accounted
The reflection from a surface is divided into three subcomponents, specular reflection, diffuse reflection, and ambient reflection. Due to the effect of parallel light, a polygon surface is ubiquitously the same since the angle between the light and the normal vector is the same. The curved surface in Cylinder can be imitated by the linear gradient. Here is an example how the cylinder looks like in the sunshine.
Here is the snapshot of development. They look real, but we still need more calculation to verify whether the lighting model is precise or not.







Sigh — can you post a live demo link for some of these? This looks really cool and I want to play with it without, you know, working….
Will perspective and a sphere object be implemented?
Gavin,
Good to hear you again. I am working on a big refactor of the code. Next week, I could work on some show case to promote this library.
To Masashi,
Current implementation simplify a lot to make the performance bearable. For example, the light sources are placed indefinitely far away, Perspective may bring some complexity that prevent us releasing the library on time. We may consider the possibility once this library merged into the trunk.
Sphere is achievable in SVG side, however, MSIE could not render the radientGradient correctly, hope some VML developers could pick up the ball.
Think of all one could do if this was used to create a nice little game for others to enjoy.