Graphic PIZiadas

Graphic PIZiadas

My world is in..

3D Animation, Shading: Transparent materials [Blogs experimental] [Blender]

In any program editing and 3D modeling have settings that define the properties of each material.

Transparency or opacity of the object is one of the more complex features simulate.

To handle transparent objects we use a value that measures the opacity (Contrary transparency) . A null value represents an object completely transparent, while the maximum value is assigned to fully opaque objects.

Transparency is associated with another parameter that governs the change of direction of the light rays passing through the material, is the coefficient of refraction; the software performs calculations to simulate these effects are based on the “Ley de Snell“.

Refraction is the change of direction experienced a wave when passing from one material medium to another. Only occurs if the obliquely incident wave on the interface of two media, and if they have different refractive indices. Originates refraction change speed of wave propagation. (Wikipedia)

Law of refraction (Ley de Snell) (Fuente Wikipedia)

This law tells us how changes direction a ray of light passing from one medium to another, for example from water to air, by impinging under a certain angle with respect to the normal to the surface separating two media, and is modeled according to the following expression:

n_1\sin\theta_1 = n_2\sin\theta_2\

Where:

  • n1 = refractive index of the first medium,
  • θ1 = Angle of Incidence,
  • n2 = refractive index as it means
  • θ2 = angle of refraction.

 

Refraction and Reflection Effect

Applying transparency to objects should be viewed from three different perspectives:

  • Image distortion
  • Mixture of Light and Color
  • Shadows cast

Let us see in more detail what we mean.

Image distortion

The visible effect of refraction is a distortion of the image.

A simple example is seen when we put a pencil in a glass and seems to be split.

In the following sequences, is calculated the same image first using a certain value for refraction and then no refraction effect.

Actually getting harder for us to see this real-life example, since “Gestalt laws“, in particular those relating to the experience, we say that the pen is continuous and our perception of this visual effect partially cancels. With a picture we can observe without cognitive interference.

Mixture of Light and Color

The color used for the transparent surface modifies the colors of objects that reveals. Lighting adds or subtracts each of the channels, depending on whether or not containing these components.

In the following images can observe the effect of superimposing a colored semitransparent plate on each of the basic colors cubes;

The composition or mixture of colors depend on the mode of calculation in each case, it is important to anticipate the outcome based on a simple analytical model.

Shadows cast

The shadows cast can fade eliminating its “hardness”. This blurring effect occurs when there are multiple light sources, but also may be associated with atmospheric effects, the light rays collide with suspended particles or due to the random bounces that occur on rough surfaces.

A first interesting case occurs in the scenes with windows. The shadow of the transparent areas light becomes, reversing its effect.

When multiple overlapping transparent forms are created phenomena light refraction, because shadows can alter its trajectory.

The shadow becomes part of the object color, and merges with the colors of the scene; if smoothed by supersampling in raytracing (several rays are calculated for each point, very close) blur occurs similar to a paint spray.

Like the layout of shadows and refraction, specular reflection is done with raytracing. Allows “reflect” on other surfaces, adding color (lighting).

Application with Blender

Blender can have two “modes” render to simulate the effect of transparency:

  • ScanLine: A buffer shadows with the projection from the point of light.
  • Raytracing: Ray Tracing from the observer's position.
  • From the viewpoint of plastic, Raytracing model produces brighter images, and is the only one able to realistically simulate refraction and reflection effects.

    Seeing “Lights and Shadows” We made an approach to the channel changing transparency “Alpha” material, determining the degree of opacity.

    Their extreme values ​​are zero and one translucent glass for an opaque. Therefore we manage in the range of actual values [0,1]

    The calculation of transparencies must be activated in one of two modes of calculation that incorporates blender.

    The simplest in results, but also the fastest in its calculation, is the mode “scanline” in which the scene is projected from the point to determine which dots are lit; The technique consists of this projection from the different points of light and stored in a buffer (memory) the distance to each point seen from them, then render the scene to be analyzed if the point is to represent “viewed” by luz or no, in which case a shadow.

    To activate the “scanline” select the button “ZTransp” located on the tabs that determine the properties of the material.

    For each material we have to indicate their particular way of calculating.

    The most realistic and more “expensive” rendering based on ray tracing models. We can turn on the tab “Mirror Trans” selecting the button “Ray Transp”. In this same tab you can enable reflection (Ray Mirror) and the parameters that govern both effects.

    In particular the variable “IDR” determine the “Refractive Index”, which will produce the aforementioned deformation effects.

    To adjust the calculation must select the lamp shades you want to modify and enable editing of their properties with the icon representing a bulb.

    If you want to get more realistic results we enable raytracing mode calculation, clicking the “Ray Shadow” we deploy new options.

    Number “samples” or sampling is one of the parameters which increase the computation and we must use wisely.

    With this variable you can define the number of rays to be calculated for each element or pixel to represent, to determine the degree of diffusion of the shadow.

    We see that the calculation times vary substantially, because if the value is doubled so will the number of rays and thus determine the time spent in obtaining.

    Recommended “play” with simple scenes to determine in detail the result of the modification of parameters, analyzing “grain” from shade to change the value of “Soft size”.

    Another parameter that affects especially the end result is the type of “Shaders” or “Shadow” (calculation algorithm) that we apply to each material.

    To work with transparency mode “Fresnel” is the most recommended, although according to the type of effect or atmosphere we want to obtain may use one or the other.

    Refraction (Wikipedia)
    Ley de Snell (Wikipedia)

    Tutorial made for version 2.49b

    Blender Tutorial