After working on projectors, I moved onto environmental mapping. By way of a cube map (a map of six textures shaped in a cube), one could use the reflection of the view vector and trace it to a value on the skybox. The skybox itself does not have to be rendered in the scene, but can be applied to the surface of that reflected object to make it look like a mirror. This has been applied to the ellipsoid below by reflecting a charming winter scene:
Very similar calculations can also be utilized with a built in refraction function, similarly to reflection but involves a refractive index as a parameter:
I also looked into more complex lighting calculations, including anisotropic specular reflection. When specular lighting is calculated, one must take into account that light does not reflect in a very specific direction, but splits into many directions. The function that determines such a reflection is the bidirectional reflectance distribution function, or the BRDF. The BRDF can come in handy for brushed surfaces like brushed aluminum, when the reflection relies on something less isotropic.
It's quite the complex equation, relying on the halfway vector (average of view and light direction), the tangent vector (referred to as a brush direction), its binormal, and roughness of those vectors. The result is not completely noticeable but improves the quality of lighting and allows for brushed surfaces to be more properly represented. This also allows further control of specular reflection as is done below:
The roughness of the tangent vector has been modified for a much broader specular reflection. The specular reflection can also be modified with a Fresnel factor for a much brighter and opaque effect, such as light silhouettes under a large backlight. This can result in incredibly bright and glaring surfaces at the edges of objects like this sphere below:
And last but not least, hemisphere lighting is another special type of lighting that varies the normal with an up vector on the sphere, where one can specify a main sky light color that fully illuminates the top of the sphere but can vary with lighting below the sphere, like the reflection of a pool of water or a dark effect like below:
There are a couple other special things we can do with lighting in shaders, and I will probably dive into those before the next prototype project comes about.
No comments:
Post a Comment