light refraction question

Blitz3D Forums/Blitz3D Programming/light refraction question

stayne(Posted 2005) [#1]
does anyone know how the effect of light reflecting off of asphalt is achieved? pixel shaders? would the asphalt need to be bump mapped? i've seen the effect in high-end racing/driving games... stands out strongly around sunset. i wonder if it's the same effect used with water...


Jams(Posted 2005) [#2]
Yes bump mapping, and possibly specular mapping aswell, you'd defo need pixel shaders.

B3D can do normal mapping, which is similar to bump mapping - try doing a search on these forums...


Ross C(Posted 2005) [#3]
If you mix cubemapping and normalmapping, it is acheiveable.


Mustang(Posted 2005) [#4]
Umm... you mean "reflection", not "refraction"? And this is easily doable with specular and specular mask for example without pixel shaders. Blitz doesn't have any maskmap capabilities, just one "shininess" value which is quite useless. What Ross said is the best way to do it with Blitz but it's not easy.

Bump / normal mapping itself is not enough - it just makes the surface bumpy, not shiny. To make it react (reflect) light you need specular / glossiness too, and since surface might have varying specularity / glossiness mask(s) would be good to have.


Shading

This is a more general name for the lighting stage within the 3D graphics rendering pipeline - it is not to be confused with shaders. To accurately model how an object appears in a 3D scene, one must account for where the light sources are in the scene, what type of material the object is constructed from and which the camera is facing.

There are many shading procedures, each one suited to a particular type of lighting, but the 3 of the most well known are:

Flat Shading: The object has the same light intensity all over it. The process calculates this intensity per vertex and then applies it to the whole polygon. Although unrealistic, the process is very quick.

Gouraud Shading: This lighting process takes into account the direction of the light source and viewer, but assumes that the object has a dull or rough surface. This method is used to calculate the light intensity at each vertex of a polygon and then interpolate it across the rest of the surface, allowing for smooth colour gradients. This process is obviously more computationally intensive than the ambient lighting model, and is therefore slower. However, when applied to objects with lots of polygons, it can look very realistic. Note that Gouraud Shading can be used in conjunction with other techniques to produce specular lighting, such as using lightmaps.

Phong Shading: This shading method produces the best looking results but at the highest cost to the rendering performance. Accounting for everything (surface material, position of surface to the light source and camera, etc), it also calculates the colour value per pixel and not per vertex. DirectX uses a simplified version of the Phong lighting model to produce specular highlights.
The total lighting effects of any model are worked out by accumulating the light properties of the object; in other words, final light = ambient + diffuse + specular + emission.



Specular Lighting

See Shading. A dull, rough object will have a dull, rough colour - ambient or diffuse lighting is sufficient to accurately model how the object will appear. Shiny or smooth objects though will produce specular highlights and therefore require a different lighting model.

Specular lighting is more realistic than diffuse lighting but it is much slower as it requires details of the direction of the light source (or sources), plus the viewpoint of the camera.



Gloss Mapping

A gloss texture map contains information about the reflectivity of an objects surface - some parts might be shiny, others may be dull. The process of gloss mapping involves several texture stages: firstly, a specular texture map is generated and then multiplied with the gloss map (correctly adjusting the overall highlights). This result is then added to the base texture map that has been adjusted for the diffuse lighting in the scene.

Gloss Mapping produces more realistic highlights than specular mapping or environment mapping as additional information about the object is used to modulate the final effect.