Displacement Map

In Adobe Director 12, you can create displacement map as a shader and apply it to objects just like other shaders (#standard or #normalMap).


dispShader = mem.newShader("dispShader", #displacementMap)

dispShader.textureList[1] –must contain the displacement map texture. Remaining texture layers can be used as usual.


  • The larger the number of vertices, the finer the displacement effect will be. Therefore, it is recommended that you increase the number of vertices in the model resource before using the displacement map.
    • For a box resource:
      • resBox.lengthVertices = 100
      • resBox.widthVertices = 100
      • resBox.heightVertices = 100
    • For a sphere resource: resSphere.resolution =100
  • dispShader.scaleFactor = 0.02 --This is a scale value to alter the amount of displacement of each vertex along its normal. This value is multiplied to the value that the displacement map texture returns. Use a small value of scalefactor for better effects.
  • dispShader.renderFormat = #rgba8888 -- Rendering format for displacement map.

Fresnel Effect

The Fresnel effect lets you create translucent-looking objects. This effect allows you to control the reflectivity/refractivity of parts of an object by manipulating certain parameters. The effect is best seen in the following example: When we look at a container of water almost vertically down, we see through to the bottom of the container. However, as we move our eye closer to the edge of the container, we start to get more of the reflections off the water surface. Using the Fresnel co-efficients, you can control the degree to which this reflection/refraction changes with the changing angle of incident light.


tShader = p3d.newShader("SphereShader", #fresnel)

tShader.fresnelBias = 0.0

tShader.fresnelScale = 1.0

tShader.fresnelPower = 1.0

tShader.eta = 0.6

tShader.textureList[1] = pCubeTexture

tShader.texturelist[2] = diffTex

tShader.texturelist[3] = specTex

tShader.fresnelOpacity = 1.0 


  • TextureList:
    • The first texture in the list is the environment cube map texture, either a normal cubemap or a render-to-cubemap. Please note that setting a non-cubemap texture here is NOT supported.
    • The second is the diffuse color texture, to give the color to the object. This is a 2D texture.
    • The third is the specular highlights texture. This also functions as a mask for specular lighting – any specular highlight will appear on the object shaded according to the value of this texture at the highlighted pixels. That is, a completely white texture will result in behaviour identical to existing specular lighting.
  • FresnelBias: This acts as a ‘minimum reflectivity’ or ‘reflectivity boost’ and is a constant value that affects the reflectivity all parts of the object uniformly. It can be typically used to depict an object that always reflects a certain amount, irrespective of the angle, like a mirror-coated glass. It is an additive factor.
  • FresnelScale: This is a scaling factor for the variation of reflectivity with angle of incidence. The greater this value, more pronounced will be the effect of the angle-component. It is a multiplicative factor.
  • FresnelPower: This affects the sharpness of the drop off in reflectivity with angle. As the power increases, the ‘quickness’ with which reflectivity changes with respect to angle also increases. It is an exponential factor. It is not sign-sensitive.
  • Eta: The coefficient of refraction, Eta is the ratio of refractive indices of first medium with respect to the second. It determines the refraction/reflection of the object. A value of 1 indicates no deviation in light, while 0 indicates infinite deviation.
  • FresnelOpacity: This is a value from 0 to 1 that specifies the total contribution of the cubemap (reflection+refraction) to the final shader output. By setting this to 0, the cubemap is ignored and only the diffuse and specular lighting are done. By setting It to 1, the cubemap is fully blended on top of the existing output.


For the Fresnel shader, you must mandatorily set the values for diffuse and specular layers in texturelist.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy