In the previous chapter we introduced the Twaver 3D environment mapping effect, we will then share the highlight effect.
Specular reflection defines an area on an object that is more reflective than anywhere else. In specular-reflective maps, the reflectivity of the black area is 0 (completely non-reflective) and the reflectance in the white area is 100% (fully reflective). In real life, it is also ubiquitous, such as a rusty object with low light, and a polished metal should use high-strength light; the watch's dial should be more reflective than the strap, and the lips should have a stronger light than the skin, and the skin should be more reflective than a cotton dress. With this high-gloss effect, the 3D object is more realistic and more vivid.
Let's take a look at how to use specular reflection in a model, such as the building where we need to create a building. A cube can be modeled by pasting a map of the building. We have prepared a map of the glass:
Create the building code as follows:
var node = new Mono. Cube (1000,3000,1000); Node.setstyle (' M.texture.image ', './images/building.jpg '); Node.setstyle (' M.texture.repeat ') , new mono. VEC3 (2,4));
Next we'll prepare a high-gloss map that defines which parts of the map need to reflect the high-intensity light and which parts of the light need to be weaker.
The code is set up as follows:
Sets the color of the light that needs to be reflected, and if the setting is set to red. Node.setstyle (' m.specular ', ' white ');//Set Specular map Node.setstyle (' m.specularmap.image ', './images/specularmap.jpg ');
Then add the lighting and Skybox effects as follows:
Twaver3d Special effects High Light reflection