Vizard 7 » Tutorials & Examples » Example scripts » Texturing » Environment mapping
7.6

Environment Mapping

\examples\nodes\env_mapping.py

This script demonstrates how to perform environment mapping. This technique will automatically generate texture coordinates to make the object look reflective.

"""
This script demonstrates how to perform environment mapping.
This technique will automatically generate texture coordinates
to make the object look reflective.
"""
import viz
import vizact

viz.setMultiSample(4)
viz.fov(60)
viz.go()

import vizinfo
vizinfo.InfoPanel()

#Add the vizard logo
logo = viz.addChild('logo.ive')

#Add the texture that will represent the environment
texture = viz.addTexture('lake3.jpg')

#Apply the texture to the logo
logo.texture(texture)

#Set the appearance of the logo to viz.TEXGEN and viz.TEXDECAL
logo.appearance(viz.TEXGEN|viz.TEXDECAL)

#Spin the logo
logo.addAction(vizact.spin(0,1,0,10))

#Place the logo in front of the viewer
logo.setPosition([0,1,2])

#Turn the sky blue
viz.clearcolor(viz.SLATE)