Lighting in 3d max mental ray. Fragment of the book: Daylighting system. What you need to know about lighting

💖 Do you like it? Share the link with your friends

Lesson taken from the site RENDER.RU

I continue the topic of lighting in Mental Ray. In this lesson I want to talk about simulating artificial light sources to illuminate rooms. Photometric light sources will be used, which 3D MAX 2009 puts at our disposal. Photometric exposure control will also be considered.

It is assumed that those reading this lesson are familiar with the lesson on indirect lighting: posted earlier.

Let's get started

When choosing any photometric light source, Max insistently suggests turning on photometric exposure control, so I’ll start the lesson with a description of this type of exposure.

Exposure control:

After creating a light source based on its physical characteristics (brightness, color, ...), it is assumed that illuminating the scene with it is the most correct and we can only globally change the brightness of the image (render) using exposure control.

Photometric exposure control is done in MR by analogy with the operation of a camera.

Answering yes to the warning when creating a photometric for the first time:

we agree to the inclusion of appropriate exposure.

The exposure control menu is accessed from the main menu:

or through the “Environment” item (key 8).

in the mr Photographic Exposure Control rollout you are prompted to select preset exposure parameters:

for the exterior scene (day/night) and interior (day/night) scene, but they are usually very rough and it is still better and more correct to configure manually:

Those who use cameras know that the main parameters (for lighting) when shooting are film sensitivity / matrix (ISO), aperture and shutter speed (shutter speed). The brightness of the image depends on the settings of these parameters.

For example, pictures showing a table lamp with a light bulb with the following parameters:

that is, the brightness is 370 lm, and the color of the light flow is 4500-5000K (halogen)

Due to the setting of different shutter speeds, the brightness of the image is different. Similarly, in MR, by setting different exposure parameters, we change the brightness of the rendered image, without changing the parameters of the light sources .

For example, I made a very simple scene where there is a light source with the same physical parameters as in the photo, and only the exposure speed changes:

Options:

Shutter speed- this is the shutter speed or shutter speed, the value by which 1 second is divided - the higher the set value, the darker the photo

Aperture- aperture size - the larger, the brighter the picture

Film speed- film sensitivity - the higher, the more sensitive the film is to light and the brighter the picture.

In 3d MAX it is not necessary to edit all three parameters; a parameter is created based on them Exposure Value which is used by the renderer, so it is enough to either set EV, or, as I usually do, set only the shutter speed.

Below the exposure parameters are the image processing parameters, similar to those in digital cameras or similar to the use of film filters. - gamma, adaptation to the type of light sources.

Actually, there is nothing complicated in using exposure, the main thing to remember is that you should not change the intensity of the light sources, thereby introducing an imbalance into the scene - just adjust the exposure for a darker/lighter image in the render.

Now, actually, the light sources

When creating an artificial light source, the editor divides them into targeted and free:

no matter what source is created, you can make it either targeted or free at any time by checking the target checkbox in the main source parameters tab.

From my own experience, I can advise you to first create a targeted source, for the convenience of its location on the stage, and then turn off the target, so that later there will be no problems with the orientation of the emitter in sources other than point ones.

To correctly calculate shadows, it is proposed to use “Ray Traced Shadows”, which are created taking into account the characteristics of the object’s material.

depending on the requirements of the scene, or created effects you can use Shadow Maps, which are calculated faster, but do not take into account all the characteristics of materials.

Examples of shadows:

Traced shadows:

shadow map with default settings:

As you can see, the transparent material is not taken into account, the shadows are created based on the object mesh. The quality of the shadow depends on the quality of the creation of the shadow map and is configured in the “Shadow Map Params” rollout of the light source settings. For example, by increasing the map size or sampling quality, you can achieve sharper shadows.

Since the lesson is aimed at creating artificial light sources for the interior, I will not dwell in more detail on creating a shadow map, since in interiors (my opinion) it is more relevant to use traced shadows.

As for traced shadows - sometimes when using glass like Thin Geometry, Glass (lume), some artifacts appear on the object, in the form of separate spots (look at the first picture with traced shadows - the right cube has spots on the inner shadow). There is no use in improving the sampling parameters in rendering. You need to enable the two-sided shadows option in the light source settings:

Photometric Web- a light source, the configuration and intensity of which is calculated based on the “photometric web,” most accurately conveys the light parameters and saves a lot of time when creating scene illumination.

Spotlight- a light source of the “spotlight” type is usually used for global illumination of the scene; its use in interior solutions is irrelevant (again, my opinion), except for simulating projectors or special effects.

Uniform Diffuse- a light source illuminating in the direction from the emitter to the target.

Uniform Spherical- a light source that illuminates in all directions from the emitter.

Uniform Diffuse and Uniform Spherical

The settings for these types of sources are identical; with their help, you can simulate almost any light source well - fluorescent lamps, light bulbs and ceiling panels:

In the settings you are prompted to select the emitter type:

and if the emitter is different from the point one, it will be possible to include it in the rendering process

Let's look at some of the nuances of creating specific light sources:

Fluorescent lamps:

When creating a fluorescent lamp, its intensity based on the entered data will be calculated as from a conventional light source, but for fluorescent lamps (especially older models), the light distribution will be visually slightly different. Due to the fact that the luminescent layer is irradiated by ions with a certain frequency (and in old lamps with a frequency of 50 hertz) and due to the peculiarities of our vision, the light intensity will decrease faster than from a source with a filament (this applies only to the visible image, physically , over a certain period of time, the weakening of light is quite normal).

So, let's increase the attenuation:

Pre-render with normal settings:

Let’s set the attenuation to 50% (I didn’t find any information about the exact values, but using the example of the Soviet LB’eshka, testing showed exactly that)

It would seem that you can simply reduce the brightness at the source, but when using ready-made source profiles from IES, it is more convenient and the calculations are more correct:

Incandescent lamps:

Incandescent lamps also have an additional effect of changing light with distance, but it is expressed in a shift of the source spectrum to the red region:

To enable this effect, you just need to check the box:

for example, I slightly increased the attenuation value to have a more visual effect:

preliminary render with a light temperature source of 4000K:

and attenuation is enabled:

examples of scenes using these source types

In this scene, the emitters are not involved in the rendering process, but the highlights on the surfaces still correctly account for the presence of sources:

in the second scene of an object like “public MeZho”, the sources are visualized and imitate the surface of lamps:

Photometric Web

In the real world, the flow of light from lamps is extremely rarely uniform, due to the fact that the lamp bulb itself is a lens, and, as a rule, the flow is changed by reflectors and additional optics in the lamp.

For example, here is a photo of the first light source I came across at lunch:

to create such a picture of the light flux, you need additional constructions near the source, or drawing a map for the “Projector Map”, which requires additional time and distracts from the creative process.

They will simplify the procedure for creating light sources, using the type Photometric Web:

When choosing of this type In the source settings, a scroll will appear to select a settings map:

By clicking on the file selection button, a dialog for selecting a map will open:

The “IES information” section provides a diagram of the propagation of light on the “web” and information about the light source.

IES files can be downloaded from the Internet; as a rule, lighting equipment manufacturers present such maps, or you can find interior design archives. There are also IES generators with which you can create your own sources.

After applying the IES map, the light source icon takes on the source configuration:

in the Photometric Web settings there are parameters for rotation along three axes; these settings are relevant when the source is different from a point one. If the source is, for example, linear, and the card has a complex configuration, then the method of positioning the card becomes relevant:

In the figure at the right source, the map is rotated 90 degrees in Z.

Here is an example of applying a map to a point light source to simulate a lamp

Once upon a time, during 3D Max 6.0, I had a problem with simulating road lighting with car headlights. Then using IES would save me a lot of time.

With the help of IES's juice you can simulate not only individual light sources, but also groups of sources; in fact, this is their widest application.

For example, ceiling lamps consist of several fluorescent lamps and are additionally divided into several cells by reflectors. To simulate such a light panel, it is enough to create one light source and apply it to it the desired card. The description of the card describes in sufficient detail the parameters of the light and what generates it. IES files can be opened with Notepad.

For example info:

IESNA:LM-63-1995/GPA22-3t

Photopia 1.10 PHOTOMETRIC REPORT

L.A. LIGHTING MFG. CO.

GPA520-3-2TH-S9

2X2, 3-LAMP, T-BAR, 9 CELL PARABOLIC.

FO17/31K

17 WATTS T8 FLUORESCENT LAMP

indicates that a panel of 3 is being simulated fluorescent lamps, with a power of 17 watts, enclosed in 9 parabolic cells.

An example of simulating LSD lamps with two separated lamps:

On the wall you can clearly see the darkening under the light source, which gives rise to a stiffening rib between two lamps as part of the entire lamp.

Well, that's all I wanted to tell you about simulating artificial light. Perhaps I missed something, because I write about those things that I use in my work and what is relevant in my opinion.

Current page: 25 (book has 31 pages total) [available reading passage: 21 pages]

Font:

100% +

Lighting and setting up light sources

The scene is fully textured and cameras are installed to obtain suitable rendered images of the interior. Now it’s time to build the correct lighting for the scene and add certain visualization effects, with the help of which the images of the scene will become more spectacular and realistic.

It has been noticed that only a well-lit space allows one to get a certain impression of the constructed scene. Usually for beginners correct installation and adjusting the scene illumination presents some difficulties, since it is with the help of light that the surrounding space opens up for a person. After all, the colors of objects, the properties of surfaces and everything else that a person sees in the world around him is nothing more than the reflection from the surface of an object of light directed at it at different angles. When light hits a surface, it is scattered and the composition of its frequency spectrum changes (depending on the reflective properties of the object). From the above, the conclusion follows: using correct settings Textural qualities of objects and lighting can both improve the impression of a mediocrely constructed scene, and, conversely, ruin a well-prepared visualization.

Physical representation of light

From the point of view of physics, light radiation is characterized by the concepts of luminous flux, luminous intensity and illumination. Light flow specifies the light energy emitted per unit of time and is measured in lumens (lm). The luminous flux emitted within a given region of space is called by the power of light and is measured in candelas (cd, cd). Characteristics of luminous intensity make it possible to compare sources with different spatial distributions of light. Illumination - this is the ratio of luminous flux to the area of ​​the illuminated surface, measured in lux (lx, lx).

In addition to the above lighting characteristics for 3D graphics Color temperature and placement of light sources are very important. Under color temperature is understood physical quantity, characterizing the color and brightness of a light source, measured in kelvins (K). Shades with a temperature below 4000 K are considered warm (colors from red to yellow - the color of a candle, incandescent lamp, etc.), and sources with a color temperature above this are considered cold. Fluorescent lamps and strobes are examples of cool lighting sources. Using color temperature, you can change how a person feels when viewing a scene (a similar technique is often used in cinema and photography).

Types of lighting sources in 3ds Max 2009

In the previous version, mr Sky Portal (Mental Ray Sky Portal) was added to the light sources. This illuminator simplifies the setting of daylight in interior scenes, its operation is reminiscent of lighting based on HDRI effects. Considering Mental Ray light sources, the program provides twelve by default. various types stage light fixtures and Sunlight and Daylight object systems. There are several software and hardware lighting algorithms, each of which has its own settings and lighting settings.

Standard illuminators - without taking into account reflected light from the surface of objects.

Photometric illuminators - calculation of global illumination and diffuse scattering.

Built-in external rendering module Mental Ray, which has its own light source objects.

In addition, it is possible to connect other rendering modules, each of which, as a rule, provides its own illuminators for use.

Starting from the sixth version, another lighting method appeared in the program - using HDRI (High Dynamic Range Image - an image with an expanded dynamic range). One way to use HDRI is described later in this chapter.

In each specific case, the choice of lighting method is determined by comparing the results of using several methods, which are assessed according to criteria such as photorealism and rendering time. If, for example, a photorealistic visualization of a scene lasts 5–6 hours, then animating such a scene is quite problematic due to the excessive time investment. But as an interior sketch, the image obtained using this method will be the most suitable. However, there are still no clear criteria for choosing one method or another. Having applied several times listed methods and seeing the difference between them, you can understand which method of setting up scene lighting is more suitable for you in a particular case. True, in any case, when using any lighting installation methods, fairly careful adjustment of the parameters is required, and, perhaps, a good result will not be obtained immediately.

Default lighting

If you do not include any lights in the scene, 3ds Max 2009 automatically sets the scene to default lighting. It represents built-in (omnidirectional) standard light sources with parameters that cannot be configured. There can be one (default) or two built-in sources. A single source produces contrasting, not very natural light (Fig. 5.15). Two built-in light sources are located: one in the left top corner scenes in the front, and another one in the back in the lower right corner. You can change the default lighting settings using the Views → Viewport Configuration menu command. A window will open with tabs from which you need to select the Rendering Method and in the Rendering Options area change the desired settings. Lighting with two built-in sources is softer and more natural than with one. These sources do not create shadows from objects, and rendering with them does not look natural, but they allow you to see the location of objects in the scene. The previous chapter described exercises in which rendering was done using only default lighting. If at least one light source is installed in the scene, the lighting is automatically turned off by default and further illumination is determined only by the presence and power of the installed illuminators.

Rice. 5.15. Default scene lighting with one source


If you do not select the Default Lighting checkbox in the default lighting settings, then in the viewports the scene will be illuminated by the set sources, which is not always good for clear visibility of objects. Therefore, it is better to check the box before you start working with lighting sources.

In addition, the illumination of the scene also depends on the ambient illumination, which has no source and is controlled by changing the overall illumination level according to three color parameters. The setting is carried out using the menu command Rendering → Environment (Visualization → Environment). A dialog box opens with two tabs, from which you need to select Environment (Fig. 5.16). Thus, both the level of influence of ambient lighting on the illumination of the scene and its color are established, as well as the possibility of using the image as an environment map. It is better to avoid using a high level of general illumination (Ambient) in a scene, and you should increase it only when necessary and only by a small amount. This is necessary because general illumination makes objects flat and erases their edges.

Rice. 5.16. Scene Environment Settings

Standard illuminators

There are seven standard illuminators in the program, not counting Mental Ray illuminators (Fig. 5.17). The set of standard sources is sufficient to simulate relatively realistic lighting from both artificial and natural light sources.

Rice. 5.17. Standard 3ds Max 2009 Lighting Sources


Now about each source in more detail.

The Sunlight source is designed to create and control simulated sunlight in a scene. This object can be found by clicking the Systems button on the Create tab of the command bar. When used, a directional light source is created that illuminates the scene at an angle simulating the sun's rays falling on the Earth's surface at specified geographic coordinates and in specified time. It is a legacy of older versions of the program and remained in 3ds Max 2009 mainly for project compatibility. Starting from the fifth version, it is replaced by an improved Daylight system.

Omni (Omnidirectional source) - emits light rays in all directions from one point evenly. By its physical properties it can imitate an incandescent lamp. To access this object, click the Lights button on the Create tab of the command panel and select the Standard object category. There are certain parameters to configure this source (Fig. 5.18), some of which will be discussed later in the exercises.

Rice. 5.18. Parameters of a standard Omni type illuminator (Omnidirectional)


Target Direct and Free Direct—Located on the same command panel tab as Omnidirectional Source. These objects emit a beam of light rays parallel to each other, with a circular or square cross-section resizable. A free source is directed along the axis of the light beam emitted by it, and allows a change in direction by rotating this axis. An aiming source has a target at which it is aimed and which is controlled independently of the light source, while it, in turn, remains constantly aimed at it. Directional sources have parameters similar to an omnidirectional source, except that they have an adjustment to the amount of the area of ​​the continuous beam of light relative to the area of ​​attenuation (Figure 5.19).

Rice. 5.19. Direct Source Beam Settings


Target Spot and Free spot – in the editor, these lights are located on the tab with standard light sources. The beams of a spotlight, unlike directional sources (Direct), are not oriented parallel, but diverge in a cone from one point where the light source is located. An example of such a source would be spotlights or a flashlight. Targeted sources have the same properties as described above. Like a directional illuminator, a spotlight can change the area of ​​undamped light relative to the attenuation area.

The SkyLight source, located on the same tab with standard sources, unlike other standard sources, strictly speaking, is not such: its imaginary rays of light do not emanate from one point. In addition, this illuminator uses the Light Tracer global illumination algorithm. When placed in a scene, an imaginary dome is located above it - an infinitely large hemisphere, each point of which emits light rays. This source is a component of the DayLight system, which will be discussed below. In addition, it is this source that allows the use of an HDRI (High Dynamic Range Image) card to illuminate the scene.

Photometric light sources

In this version of the 3ds max 2009 editor, the number of photometric sources has been reduced to three. However, despite the fact that in previous version there were eight of them; new sources can easily reproduce any of the eight illuminators of the previous version (Fig. 5.20). If previously each type of photometric source had a strictly defined shape (point, area, etc.), now the shape can be selected from a list in the settings of the illuminator itself. Their illumination parameters are indicated in lumens, candelas, lux, that is, like light sources in real life. With the help of photometric sources, it became possible to correlate the power of real lighting with virtual lighting in scenes, as well as calculate global illumination using the Radiosity algorithm (Radiation Transfer), as is usually observed in real life when light hits objects.

Rice. 5.20. Photometric sources 3ds Max 9


Photometric sources are divided into the following.

TargetLight - a universal photometric illuminator, depending on the selected settings, can emit light rays from one point in all directions, like a fluorescent lamp down and to the sides, like a raster source to simulate a light platform. It can be used both to simulate a regular incandescent light bulb and to simulate spotlight sources by changing the type of source using the Light Distribution (Type) list (Fig. 5.21). If Photometric Web is assigned, this allows you to control the distribution of light using special *.IES files, in which the shape and intensity of the light flow is recorded in a special way, which creates realistic reflections on scene objects.

Rice. 5.21. Selecting a Photometric Source Type


FreeLight - completely repeats the free source described above with the only difference that it has a purpose that allows you to direct the illuminator to a specific area or object.

Daylight sources – this object appeared starting with the fifth version of 3ds Max. This system allows one to take into account the reflection of light by the surface of objects and its scattering in the atmosphere. Using this source, two connected photometric illuminators are created - a simulator of solar illumination (taking into account geographic coordinates, time of year and day) of the scene and a simulator of diffused light of the sky.

Photometric sources included in the scene allow you to relatively accurately simulate the illumination, color and distribution of light intensity in space characteristic of real sources. Light emitted by photometric illuminators attenuates in inverse proportion to the square of the distance to the illuminated surface. The characteristics of light from photometric sources, as mentioned above, are specified in the program by existing physical units - candelas (cd), lumens (lm), lux (lx). Photometric sources exhibit their properties most accurately when using the Radiosity global irradiance calculation algorithm. If illuminators of this type are used in a scene without calculating global illumination, then, most likely, there will not be enough light from them and you will not feel their benefits.

An additional feature of photometric sources is that now, using the Templates list, you can set the type and power of the illuminator automatically according to the type specified in the list.

Mental Ray Lighting Sources

Since the Mental Ray external rendering module is included in the standard distribution of 3ds Max, we need to say a few words about its lighting sources, which by default are located on the command panel tab along with the standard ones. In principle, Mental Ray can work correctly with standard and photometric 3ds Max 2009 sources, but if it is used as a rendering system, of course, it is better to use the illuminators of this particular plug-in. In appearance, they resemble standard lighting objects of the Spot and Omni types (see Fig. 5.17). According to the list of parameters, they are also similar to their standard counterparts, only their Area Light Parameters are similar to those of photometric illuminators.

In total, the program contains five lighting sources for the Mental Ray module. Two of them: mr Area Omni (Omnidirectional area) and Mr Area Spot (Spotlight area) have settings and parameters similar to those of standard 3ds Max 2009 sources, but differ in one item - Area Light Parameters (Fig. 5.22 ), which allows you to control the size of the area from which the light comes, as well as its shape. In addition, when using shadows such as Ray Traced Shadows, these sources, after certain adjustments, produce soft, realistic shadows.

Rice. 5.22. Light Area Settings for Mental Ray Lights

Lighting settings

To select a light source object, click on the Lights button on the Create tab of the command panel, select the Standard or Photometric source group from the list, and click the button for the source of the required type. At the bottom of the command panel, lists of parameters will appear, the composition of which depends on the type of illuminator. The first in the list of parameters is the Object Type rollout. Next is a Name and Color rollout with source parameters that determine how it will appear in projections (rendering only shows the light emitted by the source). Below is the General Parameters rollout, where the On checkbox is located (set by default when selecting a source) and the “distance” to the target is indicated if the source is directional. Below is a checkbox for enabling shadows Shadows and a drop-down list of types of shadows used in constructing scenes. Here you can also exclude scene objects from lighting by clicking the Exclude button, and then selecting the ones you need from the list that appears and moving them to the right side of the list. Next is the Intensity/Color/Attenuation scroll. In it you can configure the color of the rays of the selected source (white by default) and intensity (unity by default, or in luminous flux units if the source is photometric). Here you can also configure the near and far attenuation of the source by selecting its type and assigning the beginning and end of the light attenuation area in the units of measurement used in the scene. If you select a point source of the Spot type, then in the Spotlight Parameters rollout you can adjust the diameter of the spot of light emitted by the source and set the shape of the spot as a circle or rectangle.

The parameters located in the Advanced Effects rollout are needed to specify the effect of the light source on the surface. Using the Projector Map function, you can use a light source as a projector by specifying an image (map) that will be projected onto any object where the target of the source points. In the Shadow Parameters rollout, which is located below, you can adjust the density of shadows and highlight them in different colors, as well as projecting the map onto the shadow.

Below is a scroll with the shadow appearance parameters that will be selected by the user for the source. It contains settings for the size and quality of shadows cast by the source. To assign additional post-processing effects (lens effects, volumetric light effect), the Atmospheres&Effects rollout is provided. And the last in the list of parameters are the parameters of the Mental ray Indirect Illumination rollout (Fig. 5.23) - provided that Mental Ray is used as an active visualizer, they can be used to control the diffuse illumination generated by the source; Mental ray Light Shader - allows you to assign a light shader and a photon emission shader to a source.

Rice. 5.23. Ambient Lighting Options for Mental Ray Source


Note

A shader is a small plug-in module (program) that determines the properties of an object (material, light, geometry, camera) under certain conditions. At the right time (usually during rendering), the program core includes the functions described in the shader. Shader libraries are usually supplied with the 3D graphics program, but can also be downloaded from the Internet from the websites of their creators.

Installing light sources in the scene

After approximately setting the illuminator parameters to include them in the scene, you need to move the cursor (which will take the form of a cross) to the desired point on one of the scene projections and click the left mouse button (and if this is a targeted source, then you must first move the cursor in the direction of the target, and then release the mouse button). After this, if necessary, it is worth adjusting the coordinates of the source and target with the Select and Move tool. To more accurately configure the source parameters and subsequently adjust them, you need to select the source in the scene and go to the Modify tab of the command panel, where you can see the same parameters as previously when creating the light fixture.

Scenes differ in the types of illumination, and for each scene it is worth taking an individual approach to setting up sources separately and all lighting in general, however, there are some recommendations for lighting certain scenes for 3ds Max 2009. For example, a street scene using a Daylight illuminator (Daylight ) will be illuminated differently than the cosmic landscape, since the distribution of light in a vacuum differs from its distribution in the atmosphere.

This is my first lesson, so be lenient.

For example, let’s take a simple interior object – a bathroom.

I won’t write anything about modeling - we’ll assume that everything is already ready.

Scene

(For 3ds max 2010 and higher)


In terms of materials, everything is also very simple here.

All chrome – ProMaterial: Metall (Chrome Polished).

Ceramics - ProMaterial: Ceramic. Glass - ProMaterial: Solid Glass.

Stretch glossy ceiling material:

The most difficult material is tile.

Here are the parameters of the black tile (the rest are done in exactly the same way):

Texture maps in the archive.

The main part is setting up the lighting.

Its main feature is that it is a closed part of the apartment, illuminated only by artificial light.

In this case, from lightingdevices we have several (1) halogen lamps on the ceiling (they constitute the main lighting) and one gas discharge lamp (2) above the mirror

(illumination of the mirror area).

Now let's move a little away from the conversation about the bathroom and remember a little physics.

You should know from your high school physics course that, strictly speaking, the phenomenon of “color” does not exist in nature.

This is just a feature of the eye’s perception of a rather small piece from a line of electromagnetic radiation.

This piece is called the visible spectrum (or something like that).

Moreover, the longest waves from this spectrum are perceived by the eye as red colors, and the shortest,

like purple ones (remember - every hunter wants to know where the pheasant sits).

Waves that are longer than “red” are called infrared (or also thermal radiation).

Waves that are shorter than “violet” are ultraviolet (and then X-rays, etc.).

There is a connection between body temperature and its electromagnetic radiation.

Everyone knows that if you heat an object high enough, it begins to glow.

Those. it begins to emit first in the infrared and then in the visible spectrum.

And the stronger the heating, the shorter the radiation length will be. Everyone saw how a piece of metal glows red hot in a fire.

Theoretically, if the same piece of metal is heated further, it will begin to turn from red to orange,

You may ask why I remembered this? And then, so that you understand that the “color” of light is a very relative concept.

And this is of great importance if you use Mental Ray for rendering and want to work with real values ​​in the development of your projects.

The thing is that with photometric light sources, in addition to the glow power and various shadow tracing settings, you can adjust the so-called Glow Temperature.

This is a kind of conditional scale showing how warm (i.e. closer to the red spectrum) or cold (i.e. closer to the blue spectrum) the radiation from it will be.

By the way, most lamp manufacturers indicate this temperature in the data on their product.

For example, the glow temperature of incandescent lamps is about 2800K.

For halogen lamps this temperature is about 3000K. For gas-discharge lamps the spread is quite large from 4000-8000K.

It’s already clearer, but still, where is the connection with Mental Ray and our bathroom?

Everything becomes clearer when we go to the Environment tab in the Rendering menu (press number 8 on the keyboard)

and set the mr Photographic Exposure Control option in the Exposure Control rollout.


Taking a closer look at the parameters inside, we notice the Image Control section there.

And in it we see the Whitepoint line and the temperature value in Kelvin.

Now we understand the connection between Mental Ray and the physical part outlined above.

For those who are in the tank, I’ll explain - Whitepoint is the value of the temperature of the light taken as white.

If some IC has a light temperature less than this value, then the color of its emission moves towards red (the greater the difference, the redder the light).

If the temperature of the light is greater than this value, then the color of the radiation moves towards blue (the greater the difference, the bluer the light).

Now that we've sorted this out, let's return to our bathroom. As we said, our main lighting consists of halogen lamps on the ceiling.

We conscientiously model lamps (or less conscientiously take them somewhere else).

Looking at the catalog, we see that these lamps are equipped with halogen lamps with a power of 50W (or approximately 65 cd).

We go online again and find that the glow temperature of these lamps is 3100K.

We create photometric light sources for them (spherical for simplicity) and set the power to 65cd and temperature to 3100K (or you can use one of the presets, which is very convenient for Max).

You can, of course, change the color of light sources using Filter Color, but these are not our methods.

Although sometimes you have to use it to create colored lamps.

We do the same with the IC for the lamp above the mirror. We create a cylindrical photometric and

We set its power to 32cd and select Fluorescent (Daylight) from the temperature presets so as not to have to worry about searching.


We won’t configure anything else for now – it’ll be fine for previews.

Again go to Rendering -> Environmet and in the Exposure Control rollout press Render Preview.

What do we see? A dark window with an indistinct yellow picture... meh...

No problem! By rotating the Exposure Value, we ensure that the picture becomes sufficiently light.

We see that strong highlights have appeared in the IC area. To get rid of them you need to turn down the Highlights (Burn) value.

I usually leave the value around 0.05 - 0.025, but this is a matter of taste.

You can also tweak the Midtones and Shadows to make the picture more contrast.

And also add a little Color Saturation to make the colors more rich.

Okay, we achieved the desired brightness and removed the highlights, but the picture is still YELLOW!

This is because our main light comes from halogens on the ceiling.

And they shine with a temperature of 3100K as we set in the settings.

In the Whitepoint line we have a value of 6500K (default value).

This means that the relative white color produced by our halogen lamps is shifted towards red.

No problem, change the Whitepoint value to 2100K – i.e. We eliminate this difference and bring the color of the radiation from the lamps to absolutely white.

We see that the picture has changed and the lamp above the mirror has become slightly bluish - the temperature of its light is more than 3100K, which means its light has shifted towards blue.

In principle, we could calm down on this - the bathroom no longer looks yellow. But it has become quite faded - the light from the lamps is too sterile white.

Personally, I don’t really like it... let’s spice it up! To “revive” it, let’s simulate a photo flash.

Let me make a reservation right away: I have never been involved in professional photography in my life and all my experience in this area is limited to amateur photographs on digital point-and-shoot cameras.

But, as they say, what is rich in... So we will imitate a soap box.

If you've ever taken photographs in a room with artificial light, you've probably noticed

that the flash creates a fill white light that makes an incandescent or halogen light glow bright orange.

This is exactly the effect we will try to recreate.

Create a photometric and select a rectangle as the shape. Its size affects the blurriness of the shadows that the flash will produce.

Well, since we are imitating a “soap box”, the dimensions can be made small - 20x40mm is quite enough.

In addition, we need this disk to shine in only one direction - forward.

Therefore, in the Light Distribution (Type) rollout, we will select Uniform Diffuse.

We will set its power to 1500cd, and set the temperature to 6600K.

This is most conveniently done using the Align tool.

Again we go to Rndering -> Environment, render the preview and set Whitepoint to 6500K - the light from the halogens again shifts to warm orange colors,

and the flash will flood the scene with cool white light.

Now I like it - it’s clear that the halogen lights are shining with yellow light, and in general the picture has become more saturated and vibrant.

Although the last picture is a little overexposed. No problem - slightly reduce the Exposure Value in the exposure settings...

That's it - you can make final render quality settings and read the final image.

You can also play with Glare to get beautiful highlights around the highlights on the lamps and around the lamp above the mirror.

Here are the Glare settings that I used in this work:

A little about render settings.

What I really like about Mental Ray is that most scenes can be easily rendered with default settings.

Below I have marked with a red marker all the settings that I changed:

And no dancing with tambourines :)

I don’t think it’s necessary to describe each parameter in detail - it’s better to read about this in the lessons of Alex Kras (many thanks to him for his work).

In general, that's all. And finally, my final render without post-processing.

Although the concept of Global Illumination (GI) is very simple, properly illuminating scenes using this algorithm poses some challenges.

As a rule, a paradox arises - mental ray calculates scenes quite quickly, but when we turn on GI, we see a deterioration in quality and try to correct this by increasing the number of photons and decreasing their radius (the last definition is not correct, but details are in the lesson), thereby increasing the calculation time to infinity , but the result is not visible. The lesson will show examples of calculation problems and ways to solve them.

The first part of the lesson is short and theoretical, for those who have encountered the global illumination algorithm for the first time, the second part is practical and assumes that students are already practically using mental ray or have studied all my previous lessons on lighting.

Will be executed in 3ds Max 2009.

In this tutorial I use abbreviations:

GI - Global Illumination - global illumination

FG - Final Gather - final assembly (indirect lighting algorithm - more details Mental Ray Lighting part 1 - FG

IS - Light sources more details Mental Ray Lighting part 3 - sources

In the second part, I show the solution to some problems, but I do not pretend that the methods are 100% correct; they all follow from individual practice.

Part one - theory

Global illumination (hereinafter GI) is an indirect lighting algorithm based on the generation of GI photons by a light source (hereinafter IC), which, when encountering an object, change taking into account its material and, when reflected, illuminate nearby objects. I visually depicted this effect in a simple drawing:

where the GI is turned on, the light reflected from the sphere, took on its red color and illuminated the box from the inside.

Using GI takes scene lighting to a more advanced level, especially since mental ray has light sources that do not generate direct lighting, but only GI photons.

The GI algorithm is enabled for the entire scene in the Render Setup, Indirect Illumination tab - Enable checkbox:

GI Settings:

Multiplier - the overall brightness multiplier of the effect and the color of the filter.

Maximum Num Photons per Sample - qualitative characteristic - the number of photons to count in a sample - a decrease leads to the appearance of noise.

Maximum Sampling Radius - the radius of the photon collection area, very often confused with the radius of the photon - in mental ray photons do not have a radius, a parameter on which the quality of lighting directly depends, changing the setting of only this indicator, as a rule, does not lead to a direct improvement in quality (details in the practical parts)

Merge Nearby Photons - a qualitative characteristic - an algorithm for combining photons - sets the distance at which several photons are combined into one - enabling the parameter can lead to a deterioration in quality, but saves memory - it is important to enable it when we are trying to increase the quality of the image in one problem by increasing the number of photons regions, while other regions do not need such a quantity.

Optimize for Final Gather - when using GI in conjunction with Final Gather (hereinafter referred to as FG), it optimizes the calculation of jointly illuminated areas. Works as an additional algorithm and takes a little longer to render.

Field - Light Properties:

Average GI Photon per Light - the number of photons emitted by the light source. As a rule, changing this parameter without changing the sample radius does not lead to tangible positive results (details in the practical part).

Decay - photon attenuation parameter, physically correct value = 2 (according to the square of the distance) if you are using physically correct lighting, do not change the value, for artistic purposes it is interesting to reduce the value together with reducing the IC energy.

The parameters in Trace Depth indicate the number of reflections and refractions that will occur with a photon before it disappears; it is advisable to set the maximum depth to 5, rather than the default 10 - this will save time, and the result will remain virtually unchanged.

So, that's all we need to know about the theoretical part of GI.

Let's simulate a room and adjust (and sometimes fight) global illumination.

Part two - practice

So we have a scene that we want to light. I made a small room:

the main stream of sunlight will fall from the hole in the ceiling (now there is a dark hole), everything will be illuminated by a daylight system, the sun is almost at its zenith. As a result, at the base of the column there should be a bright spot from direct illumination (direct sunlight), and everything else will be illuminated by indirect illumination created by this bright spot and partly by the light of the sky that could get through the upper hole.

I turn on the sun, adjust the exposure and immediately see the first GI problem.

The whole room is in beige tones! Why?

Sunlight (direct) illuminated a spot on the floor, which was covered with A&D material (polished wood) in brown tones, photons from indirect illumination took on the shade of the material and flew to illuminate the inside of the room, coloring everything beige. In principle, in this picture everything is still more or less tolerable, but we will cover the floor with blue tiles (also A&D):

tell me it's creepy? No, this is also tolerable, but let’s take a material from the ProMaterials set - Plastic, also blue:

Now this is closer to horror!

I modeled in the metric system, theoretically the calculation of GI and FG should be correct. Maybe I'm wrong, but in the real world there is no such strong color transfer from bright surfaces; if the Sun illuminates the red carpet in my room (and this happens in our gloomy city of St. Petersburg), then the room does not plunge into crimson tones.

The developers missed something here, or they think that we ourselves should take care of this effect.

Let's take care and correct this misunderstanding. I will describe three methods - two special cases and one cardinal.

Let's return to the room with a wooden floor (Figure No. 2)

The first method is to select a filter on GI and, accordingly, put it on FG.

To compensate for the yellow-beige color, we need a light blue filter, so we’ll put it on (although we had to put slightly different filters on GI and FG, but who said it would be easy):

let's render:

Clearly they got the hang of the beige color. What are the two disadvantages of this method?

The first is the selection of the filter color (especially since there are two of them) and the second is that this way we can compensate for only one color. What should I do if half of my floor is red and the other half is green? In this case, the filter will not help.

Second way. Let's think about why such strong coloring of photons occurs. Maybe I'm wrong, but in my opinion, the diffuse color from the surface shader is transferred unchanged to the photon shader, or it is not attenuated enough (this, of course, applies to preset materials; when working with the mental ray material, we configure this shader ourselves). Let's change the shader. Open the “mental ray Connection” tab in the material properties and remove the lock (lock) from the photon shader:

and infuse the diffuse component of the color as desired:

this is exactly the color that GI photons will acquire when colliding with the material, it should be more faded than the diffuse color of the material itself, and accordingly, the darker it is, the less the effect of GI lighting from this material.

Change and render:

This property also has a couple of disadvantages. The first is that the FG algorithm will still do its dirty work (or beige in our case), and the third is that it is impossible to change the photon shader for the preinstalled materials of the ProMaterials group.

So, the third way.

It is based on working with photon maps, and at the same time with the FG map.

We save our project (just in case, although we can later get by with the undo function ctr+Z)

We make another material of a pale gray color, with minimal reflection and completely opaque (I used the material for painting walls, which in principle I recommend):

Please note that I have activated the Ambient Occlusion option, for now we just check the box there, the details will be below.

Select all objects in the scene and assign this material to them (don’t be afraid, we saved the normal scene)

The scene took on the following form:

grey, gloomy, but that's what we need.

Now go to the indirect illumination settings

First, let's save the FG map. Final Gather Map section, turn on the “Read/Write File” checkbox, then click on the button with dots and indicate the name and location where the map will be saved:

then click the “Generate FG Map File Now” button and wait for the generation process.

Attention - if this is the final render, set the quality parameters to normal, especially since you will only wait for the FG generation now, in the future you will not waste any more time on this!!! Everything will be taken from the saved map.

We do the same for GI:

check the box, specify the file name and click on generate.

Both maps are saved, now we load the saved scene with normal materials, or cancel the actions.

Again, check the boxes in Read/Write File on both algorithms (or check that they are checked if you canceled the action)

We check that our saved file is indicated and in the algorithm for FG we “freeze” the card by clicking on the “lock”:

Now feel free to press the RENDER button, we notice that there is no process of generating photons and FG:

and we observe an acceptable result of color transfer by photons.

Many may now be indignant:

“But what about the concept of color transfer of a material by photons!!! we killed her in the bud!!! and people wrote algorithms and worked!!!”

Firstly, they didn’t kill anything, who’s stopping you from assigning all materials one gray/white color, and the floor can be made a little yellowish :)

And secondly, let's turn to physics, how the process of color transmission occurs, or rather the reflection of the spectrum.

In mental ray it is assumed that it is immediately mixed (either completely or in a weakened form - I don’t know for sure, you need to study the shader program)

And in the real world, coloring occurs due to light entering the thickness of materials and returning from it with a filtered spectrum, even the most “opaque materials” have transparency on a section of very small thickness, but the bulk of light is reflected from the polished surface immediately, without penetrating into inward and the denser the material, the more.

therefore, stones will reflect mainly white color (the color of the source is more accurate), metals will tint it a little, plastics will mix it even more with their color, and glass. and so it’s clear .. there is more caustic, in addition, the color of reflection is also influenced by the quality of polishing, rough surfaces will be colored more by reflected light, polished ones less.

For now, we cannot set the density of the material in Max, and in preset materials it apparently does not work as well as we would like. Therefore, you will have to simulate GI using the methods described above, or for greater reality you can turn on the caustic effect (this is the black arrow in the figure, we are used to thinking that caustics is only for glass objects, and these are also specular highlights) or use mental ray based materials sublayer scattering - SSS group.

Now let's take a closer look at the second problem.

In picture number 7, the wall and columns seem to merge, or rather, the volume is lost on them - the picture is blurred. The root of the problem is poor-quality illumination by GI photons. Direct light from the IC produces pronounced shadows, emphasizing the volume of scene elements. With photons it is a little more complicated - they do not produce shadows, shadows are obtained in those places where the fewest photons hit, respectively, the fewer photons (and the larger the photon receiving area - samples), the lower the contrast.

Let's take, for example, a room that is illuminated only by indirect illumination and has a structure with uneven surfaces installed in it, I made something like stairs:

and make a render by turning on GI, but without changing the number of photons:

I marked in yellow the places where the problem being discussed is clearly expressed. Agree, this is an unpleasant situation. The conclusion suggests itself - increase the number of photons and reduce the radius of the sample, but this greatly increases the calculation time, after which we will notice a couple more places where there are again weak shadows and the process of increasing the number of photons will be endless until the computer refuses to work. I immediately remember a bunch of anecdotal situations about quality and quantity, on the basis of which one can interpret an anecdote about graphics:

Three CG workers sit in the evening and discuss their projects.

The first one says:

The second one answers:

— I’ve also finished everything, but I don’t have enough computer power, I’ll get the memory and finish the project.

They sit and complain about the speed of the technology, and then ask a third person:

- Why are you silent? How do you deal with complex calculations?

— And I use Ambient Occlusion! I passed everything and go on vacation tomorrow.

Let's not solve the problem extensively, but use the imitation of global illumination on the material.

If materials from the ProMaterials group are used, then they have the Special Effects option, in which you can enable Ambient Occlusion

The samples parameter is the quality of the calculation - the more, the better.

The Max Distance parameter is one of the main ones - this is the distance from which adjacent geometry is taken into account to create the effect of global illumination (from all sides). If we want to show the effect clearly, then we need to set the distance to the neighboring object, and if we just want to emphasize the geometry of the objects (as in our case), from 10 cm to half a meter is enough. Below are the blending and blur parameters; we don’t really need them now, since the AO function is secondary.

If you use a material not from the ProMaterials group, then you will have to mix the diffuse color with the AO shader, preferably using the Falloff map. And some materials and material shaders have an Ambient slot, in which you need to install the Ambient/Reflective Occlusion shader and adjust the distance:

In no case do you leave the default distance (equal to 0) for enclosed spaces; if the parameter is zero, then the material is rendered from the maximum distance (from the background of the scene) and taking into account the walls of the room you will get completely darkened material. The Samples parameter is the same as quality. The remaining parameters do not need to be configured for our case.

So, we add Ambient Occlusion, which works very quickly and does not touch the number of photons:

agree there is a difference! Considering that the rendering time has hardly increased.

Let's move on to the third and fourth problems, they are interconnected.

Take a closer look at the drawing (No. 8) at the top hole on the ceiling, if you look closely there is a round light spot.

To reveal this effect, I will cut through two windows and slightly spoil the ceiling of the room:

The first is indicated by a red arrow - this is a lightened spot; now we can see with our own eyes the photon collection sample, which is lighter than the usual background. The fundamental solution to the problem will be below, but now a special case:

I placed Raytrace material on one of the columns near the window. In fact, mental ray supports rendering standard 3D Max materials; when adjusting the surface of this material, I did not touch the photon shader, but it turns out that it is not configured correctly! Therefore, an unbalanced stream of photons was reflected from the column, which became a sample, creating a platform brighter than the background.

Conclusion - it is advisable to use mental ray materials, and if you have a favorite and customized old material, take care of setting up the photon shader as we did above in discussing the first problem. But this is a special case. The common thing, of course, is setting up the samples and the number of photons.

Look at the yellow arrow, it feels like my ceiling above the windows is not matched to the walls (or vice versa), in fact, everything is in order there, otherwise there would be light along the entire perimeter of the joint. The fact is that I extended the ceiling to the street and got the effect that we often encounter when visualizing interiors illuminated by bright light.

Let's analyze the effect using the most common and obvious example. Such spots usually appear under window sills, where it should be dark by default, and for some reason Mental puts such spots there. Here is a diagram of their formation:

The black circle is a photon collection sample. The visualizer program places a photon collection sample in the visible part of the wall, the center of which is located under the window sill and, accordingly, almost all of it is in the shadow. But a small part of it crawls out into the illuminated part, and there it is very bright, and this “small part” collects a lot of photons, as a result, the arithmetic mean of photons for a dark place is large, but for a light place it is small. The sample is an indivisible unit, so the visualizer does not calculate the lighting in this place correctly.

The only way out is to reduce the sample radius and increase the number of photons. By default, the sample size is one tenth of the scene size, and in our case it needs to be made according to the height of the window sill.

The optimal calculation can be done like this:

Sample size (Maximum Sampling Radius) = Y

Number of photons (Average GI Photons per Lihgt) = initial value multiplied by X divided by Y (for me it is 20000 * 40 = 800000)

It is useless to set the parameters higher - it will not give anything - we will only waste time.

(geometry lovers may now be indignant - why do we divide by 40, and not by 2 to the 40th power? After all, the area decreases according to the square!!! We are doing everything correctly, because the samples are placed intersecting and overlapping! And not side by side and the impact of each photon decreases by the root of 2)

in my scene I got 400,000 photons, plus some more environment settings:

As a result, the rendering time together with the generation of light maps on a 2x2GHz processor was 4 minutes 31 seconds (148 thousand polygons - the tree outside the window added)

Agree, this is better than generating millions of photons for hours and getting minimal results.

At the end of the lesson, I will make a reservation again - all these are the results of my own experience and calculations and I do not pretend to be one hundred percent correct.

This concludes the lighting lessons.

This entry was posted on April 20, 2009 at 8:24 am and is filed under Uncategorized. You can follow any responses to this entry through the feed. You can, or from your own site.

Hi all! Today we will continue to delve into the intricacies of 3D modeling. In the last lesson we learned about polygonal modeling and texturing. Today we will pay more attention to lighting and visualization. In today's lesson you will learn:

  • Work with texture maps
  • Install light sources
  • Render a scene using Mental Ray
  • Create splines

So, let’s open the model we created in previous lessons, select all its components and combine them into a group. To do this, select the item in the main menu - "Group > Group" and click ok.

Grouping

Now we can work with the model as a single object. Let's leave the stool alone for now, we'll come back to it later. For visualization, you need to set up the scene, that is, the environment, so that the model does not hang in the air. Let's use a spline (line) for this. You can find them all in the same right panel by clicking on the button in the form of a circle with a square ( Shapes).

Let's select an object - "Line", switch to the left view and draw an L-shaped polyline. To draw polylines, you need to click the mouse at the beginning of the line, move the mouse to another point and click again, when the desired line is drawn, click the right mouse button. To correct irregularities, press “1” on the keyboard and move the points of the line as necessary. It should look something like this:

Let's return to the perspective window and apply a modifier to the line - "Extrude" with meaning "Amount" equal to 10000mm and place it exactly under the stool.

Place the objects so that the stool stands at the intersection of the thick grid lines, as in the screenshot below:

Now let's convert our L-shaped squiggle into "Edit Poly", and combine all its faces into the first smoothing group (Remember the last lesson).
We’ll immediately assign her a new white material. See screenshot:


The scene is ready, let's move on to the visualization settings. The first step is to reassign the render from standard to "Mental Ray". Open the render settings by clicking on the button "Render Setup" or "F10" on the keyboard, at the very bottom of the “Common” tab we will find the stack "Assign Renderer". Click on the first ellipsis (Production) and in the window that appears, select "mental ray renderer".

We assign mentality as the main one)

We won’t touch the render settings for now, but let’s move on to the lighting. Light sources can be found to the right of the splines. In the drop-down list, select the item "Standard" and create a light source - "mr Area Spot".

Place it above the object, moving it to the side. To see the position of shadows in real time, you need to switch from display mode - "Shaped" to mode "Realistic". Screenshot below:
Make sure shadows are turned on in your light settings.

Turn on shadows

Now let's go back to the render settings. First of all, let’s increase the size of the displayed resolution in the tab "Common". To begin with, I recommend setting it to 800*600, and before the final visualization you can increase it further.

See also the screenshots for other settings:

The quality of the future picture

Final Assembly - Global Illumination Simulation

After visualization we will see the following:

Somehow not very...

Not bad, but could be better. The shadows are too sharp; to fix this, let’s increase the radius of the lamp several times using the “scaling” tool (discussed in the first lesson) and visualize again:

Better, but not the same

This is much better, but the wood looks unnaturally smooth. Well, this can be easily fixed. First you need to create a relief map. This can be done, for example, in Gimp.
Open the original texture in the editor and apply the “threshold” tool to it. Of course, not the best option, but fast.

Tool - “Threshold”

Something like that

Returning to 3d Max, let's move on to the settings of the material for the stool, which we created in the last lesson. There at the bottom we find the stack - “Maps” and in it, opposite the “Bump” item, click on the button with the inscription: “None”. In the window that opens, select “Bitmap” and specify the black and white version of the texture. Leave the texture settings unchanged and return to the basic material settings. Set the “Bump” value to 20.

Let's also add some highlights. Settings in the screenshot:

Before the final render, we will increase the image size and quality:

Improved quality

Now you can make yourself some tea, since you will have to wait quite a long time)). The result is visible at the beginning of the lesson.
Quite a decent visualization for a beginner Autodesk 3ds Max user. We can say that the foundation has been built and now you can begin to dive into all the intricacies of 3D modeling.

Tweet Subscribe via E-Mail



tell friends