Menu
Is free
registration
home  /  Firmware/ Interior lighting system in mental ray. Excerpt from the book: Daylighting System Lighting in 3d max mental ray

Interior lighting system in mental ray. Excerpt from the book: Daylighting System Lighting in 3d max mental ray

Create volumetric light in Mental Ray using 3D Max.

First step. Installing Mental Ray Renderer.

First you need to install Mental ray to our editor. This is done as follows, open Rendering (in the main menu)> Render Setup ...> Common tab> Assign Renderer stack> Production> mental ray Renderer. Everything is now basic Scanline renderer replaced with Mental Ray.

Second step. Geometry for rendering.

Volumetric light in an empty scene will not look, you need to create a simple blank. Let it be a model of a house with small windows. Let's start with a basic Box primitive, go to Create panel> Geometry> Standard Primitives> and select Box. Now we can set the following parameters to it:

Step three. Let's create windows.

For volumetric light to enter our home, windows are needed! Now let's add modifiers to the Box object. Follow the path Modify panel> Modifier List> Object-Space Modifiers> here activate Edit Poly. In the Right window, you can activate editing at the polygon level, do this and delete two polygons on our house, these will be the windows.

It's time to activate the geometry change at the vertex level, let's change our house a little, making the windows lower and wider. You can do as we have in the picture or experiment on your own.

In fact, the geometry is ready, it remains to flip the normals, this is done as follows:

1) Activate polygonal mode.

2) Select all polygons by hot CTRL keys+ A.

3) Open the modify panel, look for the Edit Polygons stack and click on the Flip button.

After flipping the normals, outwardly, our structure turned black, but this is normal, because we will have a working area in the interior.

Fourth step. Let's add a camera.

Now you need to add the main camera to the scene. Open Create panel> Cameras> Target, set the camera. It is best to mount the camera in a top view window, but you can use any window for this. You need to rotate the camera so that the windows are visible.

Also, the camera needs to be adjusted, set the Lens parameter to 20mm. It remains to change the view of the picture from the camera, just go to the perspective window and press the C key.

Fifth step. Working with materials.

We need to assign the necessary materials, for this we open the Material Editor, just press M on the keyboard. Before us will be a list of materials, we advise you to immediately learn how to name them accurately, for example, call it warehouse. While you have few materials, this is not very important, but then, when there are 20-30 materials, you will get confused.

  1. First of all, click Get Material or Standard, in the list that opens, select the Arch & Design (mi) material.
  2. Now we activate the warehouse by selecting it in the viewport and applying our material to it.
  3. Adjust the Reflectivity parameter by setting it to 0. After all, gloss is inappropriate in our house.

You can add a bump for a more realistic display.

  1. Look for Bump in the material properties and set the Composite parameter in the Standard rollout.
  2. Add a layer, the button is located near Total layers. Usually the first layer (Layers 1) is the Smoke basemap. However, it is necessary to correct the parameters:

# Iterations: 20

Color # 1 - black

Color # 2 - dark gray in RGB 50, 50, 50

  1. Let's add a second layer with the Speckle map, also fix the parameters:

Color # 1 - light gray in RGB 180, 180, 180

Color # 2 - black

Now you need to set up the Diffuse map, go to Maps> Standard> Bitmap> concrete-texture-high-resolution.jpg.

In fact, the main volume is done, you can create a render and enjoy the result. For now, it is intermediate, but you should get it like in the picture.

Sixth step. Setting up the lighting.

It's time to add light to our building. To do this, you need to open the mr Area Spot, it is located at Create panel> Lights> Standard> mr Area Spot. Create the light in the Front window, so it is better to position it from the point that it passes through our windows. After setting the light, we will achieve better results by adjusting the following parameters:

In the Spotlight Parameters suite, set Hotspot / Beam: 24 and Falloff / Field: 26.

In the General Parameters rollout, set Shadows: On (Ray Tracted Shadows).

Another intermediate render can be done.

Seventh step. Creation of the environment.

It's time to start creating the environment. You need to open Rendering> Environment and go to the background section:

  1. Set it to "None" and activate the Glow map in the drop-down menu.
  2. Press M, opening the material editor, drag our Glow map there. To drag and drop, hold down and hold the left mouse button. We use an empty slot, in the dialog box that appears, select Instance. This will link the cards.

It remains to adjust the color, for Glow we will choose pure white, set the brightness parameter (Brightness) to level 4, however, you yourself can adjust the brightness according to the situation.

You can do the next intermediate render. If everything is done as it should, then the result will be as follows.

As you can see, gradually our scene becomes more and more interesting. However, there is still much to be done. First, let's apply the shaders to the camera by going to Renderer> Camera Effects stack> Camera Shaders> Output> Glare. In other words, we have applied a Camera Shader to our Glare.

If you wish, you can do another render in order to commit the changes.

By the way, if you want to get a more intense glow, then simply link the Glare card to a slot in the Material Editor (M) and increase the Spread parameter.

Eighth step. Add side lighting.

Now the only light source on the stage is our windows. It is necessary to add side lighting for better visibility of the scene. Go to Create panel> Lights> Standard> Skylight to create the light. Immediately change the parameters in the Make a selection> Modify panel, we are interested in the Multiplier, it is better to set it to 1.5, however, small deviations from this value are possible, try it!

Now go to Create panel> Lights> Photometric> mr Sky Portal and add some more lights. Some difficulties are possible here, it is necessary to make our lamps exactly the size of the windows and turn them into the room with light. Oh, and don't forget to do Multiplier 1.5 or as much as you did for the Skylight.

As you can see, the light will become more natural, it will illuminate the space surrounding the window, namely, part of the ceiling and walls.

And despite everything, the room is still too dark. You need to fix this by adding more lights, go to Rendering> Render setup ...> Indirect Illumination tab> Final Gather stack. Here you need to set the following parameters Multiplier to 2, and Diffuse Bounces to 5. You can do another intermediate render to evaluate the results. Recall, if you are not satisfied with the intensity or brightness, you can safely change, adjusting everything to your vision.

As you can see, it has become even brighter, the whole scene is already visible.

Ninth step. Create volumetric light.

Actually, finally, we come to the topic of our today's lesson. All preparations are complete, you can work on the volumetric light! We will use the Volume Light effect, which is included in the render. Activate it along the path Rendering> Environment ...> Atmosphere, now follow this procedure:

  1. By clicking on Add, you must select Volume light.
  2. Now click on Pick Light and select the mr area spot that we set up earlier. On more complex scenes, in order not to look for the lamp in the list of objects, just press the H key.
  3. Let's play with the light density by setting the Density parameter to 20.

You can render and enjoy volumetric lighting while in preview.

Tenth step. Final light settings in mental ray render

It is necessary to carry out the final adjustment of all our light. You can do it a little differently, setting other parameters or leaving everything as it is, but we did it in the following way. In Rendering> Render setup ...> Indirect Illumination> Final Gather we slightly lowered the Multiplier from 1.5 to 1.4. However, these are games with light, they are individual, you can set completely different settings.

It is also necessary to improve the quality of the render. To do this, go to Rendering> Render setup ...> Renderer> Sampling Quality and set there:

Samples per pixel

Minimum parameter by 4

The Maximum parameter is 64

Filter select Type: Mitchell

Virtually everything! You can do the final render while enjoying the great picture!

Global illumination ( GlobalIllumination, GI) allows you to simulate the effect of surface scattering of light, which is observed as a result of the reflection of the diffused light from a wide variety of surfaces. An example of such lighting is sunlight falling through a window, which bounces off the floor and illuminates the entire room. When rendering by standard means in such a scene, only the floor will be illuminated, and when rendering in Mental Ray, walls with a ceiling can also be illuminated (what exactly and to what extent depends on the location of the window and the intensity of the light). The global illumination effect is implemented in two ways: using the function GlobalIllumination(Global illumination) or by connecting a method FinalGather(Final fee). In both cases, the visualization process is quite long and takes even longer if both methods are used, but this is often done, since the combination of both methods allows you to get more impressive results.

Using GlobalIllumination photons are emitted from the light source, and the visualizer (as in the simulation of the caustic effect) tracks their distribution in the scene and sums up the energy of all photons at each point in space. Method FinalGather works differently, although its purpose is the same as GlobalIllumination: after the first ray hits a point on the surface of the object, an additional beam of rays is emitted from this point into the scene, with the help of which information about the color around this point is collected, on the basis of which the illumination of the scene is calculated. Such a miscalculation requires b O longer time than using GlobalIllumination, but smoother highlights and shadows are formed. In addition, the application of the method FinalGather It turns out to be useful in simulating the caustic effect, since it allows one to reduce or even eliminate artifacts arising in some cases.

For example, create a new scene with a plane, a ball and a teapot (fig. 20). Set up one directional light, place it on the left side of the scene, and turn it on shading by type RayTracedShadows(fig. 21). Create a luminous material from a shader Architectural by changing the color in the box DiffuseColor and increasing the value of the parameter Luminancecd/m 2, which is responsible for the glow level, up to about 7000 (Fig. 22). Make the ball glow by assigning the created material to it. Render with the Scanline renderer - despite the fact that the ball is glowing, the light from it does not spread anywhere, which in reality cannot be (Fig. 23).

Set Mental Ray as the current renderer. Turn on simulated global illumination: activate in the window RenderScene tab IndirectIllumination and in the section FinalGather enable the checkbox EnableFinalGather... Render the scene again, and you will see that now the light from the ball illuminates slightly the space below it (Fig. 24). Increase the parameter value Multiplier up to 1.5, and RaysperFGPoint up to 500 - the intensity of the light propagating from the ball will noticeably increase (now the reflections of the scattered light are visible not only on the plane, but also on the teapot) - fig. 25. In addition, the image quality has become noticeably higher, which was achieved due to an increase in the value of the parameter RaysperFGPoint, which adjusts the number of light beams in each beam.

Let's complicate the task. Create a new scene with a closed linear spline in the form of a rectangle (it should be formed in the viewport Top) and a kettle inside. Assign a modifier to the spline Extrude, which will make it possible to turn it into a kind of closed cubic space - an imitation of a room, inside which there will be a kettle (Fig. 26). Add a camera to the scene so that the space inside the room can be seen and place a flat cube on the ceiling of the room (in our case, it will play the role of a lamp operating in the night lighting mode) - Fig. 27.

Assign a luminous material to the lamp and texture the walls, floor and ceiling of the room if desired, and then render the scene using standard tools (Figure 28). Set Mental Ray to the current renderers and activate simulated global illumination by checking the box EnableFinalGather... Increase the light intensity by setting the parameter Multiplier equal to 1.7, and to speed up the rendering process, decrease the value of the parameter RaysperFGPoint to 50. Render through Mental Ray (fig. 29). Obviously, in both variants (Scanline and Mental Ray) the lighting turned out to be completely unnatural. The idea is to illuminate the space with a lamp on the ceiling. In the first version, no glow is visible from it, and at the same time, the walls of the room are illuminated, although no light sources were created. At the same time, the kettle seems to float in the air, which is a consequence of the absence of shadows. In the second case, the lamp illuminates the space with diffused light, a shadow has appeared under the kettle, but the walls of the room are still unnaturally lit - the presence of another light source is felt. It is clear that this source is set by default (after all, we did not create sources), but in this example it turns out to be superfluous. To get rid of it (you cannot delete it, since the source does not appear in the list of scene objects), create your own light source (after that, the lighting is turned off by default) and block it by unchecking the checkbox On in the area of LightType section GenerelParameters(fig. 30).

If now we render immediately, then practically nothing will be visible in the room (fig. 31). Therefore, increase the value of the parameter RaysperFGPoint up to 500 - the illumination will slightly increase (although the walls will still not be visible) due to the increase in the number of scattered rays (Fig. 32). Set the parameter DiffuseBounces equal to 4, which will ensure the appearance of light and shade on the floor, walls and ceiling (with a further increase in this parameter, the shadows become lighter), and Multiplier- 2.2, which will increase the light intensity (Fig. 33). Increase the number as well as the density of the scattered rays again by setting the parameters RaysperFGPoint and InitialFGPointDensity equal to 700 and 1.5, respectively (Fig. 34), - the image obtained during rendering will be of higher quality, although still somehow ghostly (it seems that some kind of haze is hanging in the air - Fig. 35).

Rice. 34. Configuring scroll parameters Final gather

Now let's see what results can be obtained using the method GlobalIllumination (GI). In chapter FinalGather uncheck the box EnableFinalGather, and in the section GlobalIllumination (GI) enable the checkbox Enable and render. The results will be disappointing (Fig. 36), since the method GlobalIllumination is based on the emission of photons by the light source, and the only source in the scene is blocked. Unblock the source, move it inside the lamp, reduce the intensity of the source to about 0.3 and change the hue to close to that of the luminous material (Fig. 37). Enable shading by type for the source. RayTracedShadows and visualize the scene - the room will be lit, but it will be lit evenly (without chiaroscuro) and no glow from the lamp will be felt (Fig. 38).

Let's try experimenting with the global illumination settings. To begin with, increase the energy of photons and the amount that takes part in the Global Illumination by highlighting the source and increasing in the scroll mentalray: IndirectIllumination parameter values Energy and GIPhotons up to 10 and 400, respectively (Fig. 39). As can be seen from the result (Fig. 40), the increase in energy was excessive (decrease Energy up to 5), the size of photons and their intensity are clearly insufficient, as well as their number. At the same time, realistic, soft light and shade can be obtained only with a very large number of photons of an acceptable size (with a small radius of photons, setting an arbitrarily large value of the number of samples has practically no effect on the result) and intensity. Try setting parameter values Multiplier, MaximumNumPhotonsperSample and MaximumSamplingRadius equal to 1.2; 1500 and 14 respectively (Fig. 41). The result has improved markedly (the light and shadow on the walls, floor and ceiling are quite natural) - Fig. 42, but without connecting the method FinalGather it is not possible to achieve a glow from the lamp.

3ds Max includes dedicated sources that simulate realistic daylight. They help to set the daylight of the scene with a few mouse clicks. But at the same time, they have sufficient flexibility, allowing you to adjust parameters such as: horizon height, sky color, atmospheric condition, cloudiness, and even the exact geographic position. These light sources in a bundle are called Daylight system(Daylighting system).


Rice. 2.4.01 Example of exterior illuminated Daylight system

While creating Daylight system, 3ds Max will prompt you to activate exposure. A dialog box will appear in which you can activate it by pressing the button Yes(Yes). Alternatively, you can manually activate the exposure later. In addition, a request for creating mrPhysical Sky as an environment.

Rice. 2.4.02 Dialog box for activation of exposure

Rice. 2.4.03 Installation Dialog Box mr Physical Sky as an environment

Mental ray's daylighting system includes mrSun, mr Sky and mrPhysicalSky(which will be discussed later in this section). Exposure controls should also be considered. mrPhotometricExposureControl described earlier in this chapter.

Rice. 2.4.09 Setting time (left), and geographic location (right)

Select the map of the desired continent from the drop-down list Map(Map). The map image is updated. Click the mouse on the location you need to set the desired point on the map. When installing a checkbox NearestBigCity(Nearest large city), the pointer will be positioned at the location of the city nearest to the specified place from the list City(City) on the left side of the dialog box.

Daylight sources inmentalray.

The light sources and tools for simulating daylight in mental ray are: mr Sun, mr Sky, mr Sky Portal, shader mr Physical Sky.

For the most realistic results, it is best to use all of the above components in the system. Daylight, and in a bunch, for example, the parameter Red/ Blue Tint which is present in the sun and sky light source as well as in the environment shader mr Physical Sky... Each component is described later in the chapter.

On a note:Projection windows 3ds Max support interactive display of daylight bundle,mr Sun andmr Sky.

To begin with, let's consider separately the parameters of the mr Sky light source.

mr Sky Parameters.

A source mrSky is a photometric omnidirectional light source (firmament), which serves to simulate the diffused light of the firmament.


Rice. 2.4.10 Parameters mr Sky daylighting systems

On(Enabled) Turns the light source on and off.

Multiplier(Multiplier) Light intensity multiplier. Default value 1.0 .

Ground Color(Earth color) The color of the "surface" of the earth.


Rice. 2.4.11 Impact examples Ground Color on global illumination

On a note: Figure 2.4.11 shows the effect of the color of the earth on the reflected light on the walls of the house, in addition, the "surface" of the earth does not perceive shadows from objects in the scene.

SkyModel(Sky model) In this drop-down list you can select one of three sky models: HazeDriven,PerezAllWeather,CIE.

We'll look at one of these models. HazeDriven(Driven by haze).

Haze is a uniform veil of light that grows with distance from the observer and covers parts of the landscape. It is the result of light scattering by particles suspended in the air and air molecules.

Haze reduces the contrast of an image and also affects the clarity of shadows. see also AerialPerspective(Aerial perspective) described later in this section.

Haze(Haze) The number of solid particles in the air. Possible values ​​from 0.0 (absolutely clean atmosphere) to 15.0 (maximum "dusty"). Default value 0.0 .


Rice. 2.4.12 Parameter influence Haze per ambience of the scene: 0.0 (left) ; 5.0 (center); 10.0 (right)

mrSkyAdvancedParameters(Advanced options mr Sky)


Rice. 2.4.13 Additional parameters mr Sky

Horizon(Horizon)

Height(Height) The height of the horizon line, negative values ​​lower the line, positive values ​​raise the horizon line. Default value 0.0


Rice. 2.4.14 Horizon line height: 0.0 (left); -0.6 (right)

On a note:The horizon height only affects the visual representation in the light sourcemrSky. Apart from this, the hue of the horizon also depends on the light source.mrSun.

Blur(Blur) Blurs the horizon line. A higher value makes the horizon line more blurry and less obvious. The default is 0.1.


Rice. 2.4.15 Blur the horizon line: 0.2 (left); 0.8 (right)

NightColor(Night color) Minimum "value" for the color of the sky: meaning that the sky will never be darker than the color value set here.

NonphysicalTuning(Not physical settings)

The parameter in this group can artificially tint the color of the sky with cool or warm tones to give the image a more artistic look, as opposed to a photorealistic image.

Red /BlueTint(Shades of Red / Blue) The default is 0.0, which is physically correct (has a color temperature of 6500K). By changing the value to -1.0 (deep blue), to 1.0 (deep red), you can adjust the color of the sky to give the color of the sky you want.

AerialPerspective(Aerial perspective)

Aerial perspective is such a natural phenomenon that as objects move away from the eyes of the observer or the camera, the clarity and clarity of the outlines disappears. Objects at a distance are characterized by a decrease in color saturation (the contrast of light and shade softens, and the color loses its brightness). That. the background appears lighter than the foreground.

The phenomenon of aerial perspective is associated with the presence of a certain amount of dust, moisture, smoke and other minute particles in the atmosphere. see also Haze(Haze) described above.

Checkbox AerialPerspective(Aerial perspective) This checkbox turns on the aerial perspective display.

(Visible Distance) This counter indicates the distance influenced by aerial perspective and the range of objects.

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

Font:

100% +

Lighting and setting up light sources

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

It is noticed that only a well-lit space allows you to get a definite impression of the built scene. Usually for beginners correct installation and adjusting the illumination of the scene 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 a reflection from the surface of an object of light directed at it from different angles. Falling on the surface, the light 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 setting textural qualities of objects and lighting, you can both improve the impression of a mediocre scene, and, conversely, spoil 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 sets the light energy emitted per unit of time and is measured in lumens (lm, lm). The luminous flux emitted within a given area of ​​space is called by the power of light and is measured in candelas (cd, cd). The characteristic of the luminous intensity makes it possible to compare sources with different spatial distribution of light. Illumination - it is the ratio of the 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 location of light sources are very important. Under color temperature is understood as a physical quantity that characterizes the value of the color and brightness of the light source, measured in kelvin (K). Shades with temperatures below 4000 K are considered warm (colors from red to yellow are the color of a candle, incandescent lamps, etc.), and sources with a color temperature above this are considered cold. Fluorescent lights, strobe lights are examples of cold light sources. Color temperature can be used to change how a person feels when viewing a scene (a similar technique is often used in cinema and photography).

Light source types in 3ds Max 2009

In the previous version, mr Sky Portal was added to the light sources. This light makes it easy to set up daylight lighting in interior scenes, and it functions like HDRI-based lighting. If we take into account the Mental Ray light sources, then the program provides twelve by default different types stage lights and the Sunlight and Daylight object systems. There are several software and hardware lighting algorithms in it, each of which has its own settings and lighting settings.

Standard fixtures - ignoring the reflected light from the surface of objects.

Photometric Illuminators - Calculation of global illumination and diffuse scattering.

Built-in external renderer Mental Ray, which has its own objects of light sources.

In addition, there is the possibility of connecting other renderers, each of which, as a rule, provides its own fixtures for use.

Starting with the sixth version, the program has another lighting method - using HDRI (High Dynamic Range Image - an image with an extended 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 applying several methods, which are evaluated according to criteria such as photorealism and rendering time. If, for example, a photorealistic rendering of a scene lasts 5–6 hours, then animating such a scene is rather problematic due to too much time spent. But as a sketch of the interior, the image obtained in this way will be the most suitable. However, there are still no clear criteria for choosing one method or another. Having applied the listed methods several times and seeing the difference between them, you can understand which method of setting the scene lighting is more suitable for you in one case or another. True, in any case, when applying any methods of setting lighting, a rather thorough adjustment of the parameters is required, and, perhaps, a good result will not immediately be obtained.

Default lighting

If you do not include any lights in the scene, 3ds Max 2009 automatically sets the scene to default lighting. It is built-in (omnidirectional) standard light sources with parameters that cannot be adjusted. There can be one (default) or two built-in sources. A single source provides contrasting, not very natural light (Figure 5.15). The two built-in lights are positioned: one in the upper left corner of the scene in the front and the other in the back in the lower right corner. You can change the default lighting settings using the Views → Viewport Configuration menu command. A window with tabs will open, 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 one. These sources do not form shadows from objects, and rendering with them does not look natural, but they allow you to see the location of objects in the scene. In the previous chapter, there were exercises in which the rendering was done using only the default lighting. If at least one light source is installed in the scene, the lighting is automatically turned off by default and then the illumination is determined only by the presence and power of the installed fixtures.

Rice. 5.15. Scene lighting by default with one source


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

In addition, the illumination of the scene also depends on the ambient illumination, which does not have a source and is controlled by changing the overall illumination level in three color parameters. The setting is carried out using the menu command Rendering → Environment (Rendering → 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 the ambient backlight 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 refuse to use a high level of general illumination (Ambient) in the scene, and it should be increased 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 fixtures

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

Rice. 5.17. 3ds Max 2009 Standard Lights


Now about each source in more detail.

The Sunlight source is used 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 using it, a directional light source is created that illuminates the scene at an angle of imitation of the sun's rays falling on the surface of the Earth at a given geographic coordinates ah and at a given time. It is a legacy of older versions of the program and remained in 3ds Max 2009 mainly for project compatibility. Starting with the fifth version, it is replaced by the improved Daylight system.

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

Rice. 5.18. Standard Omni (Omni-Directional) Illuminator Parameters


Target Direct and Free Direct are located on the same command bar tab as the omnidirectional source. These objects emit a beam of light, parallel to each other, with variable dimensions of a circular or square cross section. The free source is directed along the axis of the light beam emitted by it, and allows changing direction by rotating this axis. A aimed source has a target to which it is directed and which is controlled independently of the light source, while it, in turn, remains constantly aimed at it. Directional sources have similar parameters to an omnidirectional source, except that they have a setting for the size of the continuous light region relative to the attenuation region (Figure 5.19).

Rice. 5.19. Direct Source Beam Settings


Target Spot and Free spot - In the editor, these fixtures are on the Standard Lights tab. The beams of the searchlight, in contrast to directional sources (Direct), are not oriented parallel, but diverge in a cone from one point at which the light source is located. An example of such a source is spotlights or a flashlight. Targeted sources have the same properties as described above. As with a directional illuminator, a spotlight can vary the region of continuous light relative to the region of attenuation.

The SkyLight source located on the same tab with standard sources, unlike other standard sources, is, strictly speaking, not such: its imaginary light rays do not come from one point. In addition, this fixture 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 rays of light. This source is a component of the DayLight system, which will be discussed later. In addition, it is this very source that allows the use of an HDRI (High Dynamic Range Image) map to illuminate the scene.

Photometric light sources

In this version of 3ds max 2009, the number of photometric sources has been reduced to three. However, despite the fact that there were eight of them in the previous version, the new sources can easily reproduce any of the eight fixtures of the previous version (Fig. 5.20). If earlier each type of photometric source had a strictly defined shape (point, area, etc.), now the shape can be selected from the list in the settings of the illuminator itself. Their illumination parameters are indicated in lumens, candelas, lux, that is, as with 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, as is usually observed in real life when light hits objects.

Rice. 5.20. Photometric sources 3ds Max 9


Photometric sources are classified as follows.

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 area. It can be used both to simulate a conventional incandescent light bulb and to simulate floodlights by changing the type of the source using the Light Distribution (Type) list (Figure 5.21). If Photometric Web is assigned, it allows you to control the distribution of light using special * .IES files, in which the shape and intensity of the light flux are recorded in a special way, which creates realistic reflections on the objects in the scene.

Rice. 5.21. Selecting the type of photometric source


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

Sources Daylight - this object appeared starting with the 5th version of 3ds Max. This system makes it possible to take into account the reflection of light by the surface of objects and its scattering in the atmosphere. By means of this source, two connected photometric illuminators are created - a simulator of solar illumination (taking into account the geographical coordinates, time of year and day) of the scene and a simulator of the diffused light of the sky.

The photometric sources included in the scene make it possible to relatively accurately simulate the illumination, color and luminous intensity distribution in space inherent in real sources. Light emitted by photometric illuminators is attenuated in inverse proportion to the square of the distance to the illuminated surface. The characteristics of light from photometric sources, as mentioned above, are set in the program by existing physical units - candelas (cd), lumens (lm), lux (lx). Photometric sources are most accurate when using the Radiosity global illumination algorithm. If you use this type of light source in a scene without calculating the global illumination, then most likely the light from them will not be enough and you will not feel their advantages.

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

Because external module Mental Ray rendering is included in the standard delivery of 3ds Max, I need to say a few words about its light sources, which by default are located on the command bar tab along with the standard ones. In principle, Mental Ray can work correctly with both standard and photometric sources of 3ds Max 2009, but if you use it as a rendering system, of course, it is better to use the fixtures of this particular plug-in. They resemble standard Spot and Omni lighting objects in appearance (see Figure 5.17). In terms of 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 light sources for the Mental Ray module. Two of them: mr Area Omni (Omni-directional area) and Mr Area Spot (Spotlight area) have settings and parameters similar to the settings of standard sources 3ds Max 2009, but differ in one item - Area Light Parameters (Parameters of the area of ​​light) (Fig.5.22 ), which allows you to control the size of the area from which the light comes out, as well as its shape. In addition, when using shadows such as Ray Traced Shadows, these sources, after a certain adjustment, give soft realistic shadows.

Rice. 5.22. Light Area Settings for Mental Ray Fixtures

Fixture settings

To select a light source object, click on the Lights button on the Create tab of the command bar, select the Standard or Photometric source group from the list, and click the required type of source button. At the bottom of the command panel, lists of parameters will appear, the composition of which depends on the type of fixture. The first in the list of parameters is the Object Type rollout. Next comes the Name and Color rollout with the source parameters that determine how it will look in projections (only the light emitted by the source is displayed during rendering). Below is the General Parameters rollout with the On checkbox (selected by default when the source is selected) and the “distance” to the target if the source is directional. Below is the checkbox for enabling Shadows (Shadows) and a drop-down list of the types of shadows used in the construction of scenes. Here it is also possible to exclude scene objects from lighting by clicking the Exclude button, and then selecting the required ones from the list that appears and moving them to the right side of the list. Next is the Intensity / Color / Attenuation rollout. In it, you can adjust the color of the rays of the selected source (white by default) and intensity (by default - one, or in units of luminous flux if the source is photometric). Here you can also adjust 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 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 in the form of a circle or rectangle.

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

Below is a rollout with the parameters of the type of shadows that will be selected by the user for the source. It contains the settings for the size and quality of the 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 renderer, they can be used to control the diffuse lighting generated by the source; Mental ray Light Shader - Lets you assign a light shader and a photon emission shader to the source.

Rice. 5.23. Ambient lighting options for a mental ray source


Note

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

Setting up lights in the scene

After roughly adjusting the parameters of the illuminator to include them in the scene, move the cursor (which will take the form of a cross) to the desired point on one of the projections of the scene and click the left mouse button (moreover, 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 that, if necessary, it is worth correcting the coordinates of the source and target with the Select and Move tool. To fine-tune the source parameters and then adjust them, select the source in the scene and go to the Modify tab of the command panel, where you can see the same parameters as before when creating the fixture.

Scenes differ in the types of lighting, and for each scene it is worthwhile to individually approach the settings for the sources separately and for the entire 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 from the space landscape, since the propagation of light in a vacuum differs from its distribution in the atmosphere.

I want to start a series of tutorials on lighting in mental ray. This tutorial is about Final Gather, indirect lighting settings, lights, glowing materials, and HDRI maps. The purpose of the lesson is not to create a specific scene, but to consider general provisions and secondary lighting settings, all scenes used are test in nature and have the task of emphasizing a certain effect, usually to the detriment of outward appearance... The lesson is designed for max 2008 and higher and has examples of scenes for download.

Introduction

At the beginning, some necessary information

In mental ray, lighting, according to the algorithm, the calculation can be divided into 4 parts:
1.direct tracing (scanline + ray trace).
2. Indirect lighting based on photons (GI + Caustics)
3. Simplified indirect lighting (Final Gather)
4. Lighting in volumes (ray marching).

Note: I do not claim the correctness of the Russian-language interpretation of the terms, since there are many options for translating help and lessons and I did not intend to take them as a basis. Often GI and caustics are separated, since they use different photon maps, and lighting in volumes is included in the GI, due to the fact that they also use photon maps, not taking into account that a completely different engine starts working and not everything is done there by photons. (2 levels of calculations are used, while the second, simplified one does not use photons)

About direct lighting:

Direct illumination means the illumination from the emitter of the light source to the object's surface, after meeting the object's surface, based on the Surface shaders and Shadow shaders, the irradiance map and the object's shadow map are calculated. In addition, shaders from the Extended Shaders group (surface displacement, environment) are taken into account. In this case, part of the rays is absorbed, and part (if the object is \ semi \ transparent, reflective), is rendered to the next object in the scene. The rays do not penetrate into the volume of the object, the glow effect (illumination, glow) is taken into account only for the diffuse properties of the object and does not apply to other objects. GI, Caustic and Volume Photon are not generated.

Now let's see the render settings that affect the quality of the rendering in general. These settings are relevant regardless of the enabled GI and FG

Sampling Quality: the parameters of this group allow you to adjust supersampling, designed to eliminate the effect of broken lines, stepped gradients and all artifacts arising from the aliasing effect.

In parameters Samples per Pixel - minimum and maximum sets the number of rays per pixel for adaptive supersampling to work, I will not go into the principle of operation of this algorithm (if you wish, it is easy to find theoretical information on the network).

In practice, the larger the value, the better, but the rendering time increases almost proportionally to the increase in values, so for previewing the scene it is advisable to set low values ​​(but the maximum value should be at least 2), and to increase for the final calculation.

Parameter group Contrast , adjusts the algorithm for deciding whether to use the minimum or maximum value of Samples per Pixel for calculating, the values ​​are set from 0.004 (1/256) to 1 and in increments of 0.004 - the less, the better, but also affects the rendering speed.

Filter - the simplest and fastest filter is box, and the best and slowest mitchel.

Below parameters Rendering Algorithms - of which the most useful are the routing depth Trace Depth

Reflection- the maximum number of reflections of a photon, after which it disappears

Regraction- the same for transparency and the value of the maximum sum of effects - max. depth.

Simply put, if you put two mirrors on the stage, "facing" each other and a camera looking between the mirrors, you will get the depth of "infinity" of re-reflections according to the set parameters.

The main practical sense of these settings - during the creation of the scene, set the underestimated parameters for fast rendering, and at the final stage increase to an acceptable size.

Sources of light:

In mental ray, lights are categorized into:
- standard the intensity of light from which decreases in direct proportion to distance and is not physically accurate
- improved standard (postscript mr), from which shadows are calculated, according to an improved algorithm and it is softer.
- photometric the intensity of the light is given in physical terms and the attenuation of the light is also considered physically correct. The use of photometrics is relevant if the scene scales are met with metric values.

Part one Final Gather

Final gather - a simplified algorithm for calculating indirect illumination, is that from each point of collision of a photon with a surface, rays are randomly emitted, which intersect with neighboring objects in the scene (but only once). As a result, FG gives a simplified view of indirect illumination, due to a single reflection of light, but passes much faster than a full-fledged GI, and gives a very real picture. With GI (FG + GI) enabled, the calculation algorithm changes and the calculation is performed as fully as possible in mental ray, but naturally, time ...

So let's see what you can achieve with FG:

First, enable the FG algorithm - Rendering> Render ... (F10)> Indirect Illumination> check the Enable FG checkbox

The main settings for setting the FG quality are the step with which the control points are placed for calculating the secondary illumination - the Initial FG Point Density parameter - the smaller the step, the better the picture, and the Rays per FG Point parameter is the number of rays emitted from one point than the more the better.

MR developers have made several ready-made profiles that can be selected from the "Preset" drop-down list, you can choose from Draft (low quality, fast render), for viewing scenes in the process of creation, and up to veri high - for final miscalculations.

Let's start testing FG with an interior scene.

I made the simplest scene, which depicts a room with a window and several lamps. The colors of the walls, ceiling and floor, especially gray - it turned out gloomy, but this way the lighting effects will be better visible

This is what a room looks like without FG turned on, with a temporary light source (after turning on FG, it will be removed)

On the left there are two lamps that are not full-fledged light sources, but their material is represented by the mental ray material, the surface of which is the Glow (lume) shader:

the color of the glow (Glow) and diffuse (diffuse) - pale yellow, the surface material is represented by the glass shader (Glass (lume)) whose settings are left at the default. The brightness of the glow (Brightness) is also left at the default = 3.

These luminaires will play the role of a dim, filling room backlight.

On the right are two recessed mr Area Spot lights. - the default settings, that is, not changed, they will illuminate the glass and metal balls.

All materials of the scene (except for the described left lamps) are of the Arch & Design type, by selecting which, you can quickly get settings for a specific surface from the list of predefined ones:

Rough Concrete walls, polished concrete ceiling, Glossy Plastic flooring, Glass window (Thin Geom), overlaid with a Transparency Checker card.

As a result, we should get a gloomy room, night outside the window, weak general illumination, and separately highlighted balls.

Click render:

the result is clearly unsatisfactory - too low lighting. You can increase the value of Multiplier, lights and Glow for the left luminaires, but if an increase in the intensity of the light sources is still acceptable, then an increase in the Glow value will lead to "skewed" lighting - the areas around the lights will be very bright, and the floor will remain black.

Exit in exposure setting

Go to the environment settings - Rendering - Environment (button 8) - the Exposure Control section and select the type of exposure, I left the logarithmic type. But the developers of Mental ray recommend using a photographic exposure controller, especially when working with photometric light sources.

now render again:

already better, but the noise in the illuminated areas from the left lamps became more clearly visible - this is exactly the effect of setting the FG too low (the "Low" profile is set). The question is how to calculate the middle ground between rendering speed and quality. Naturally putting Veri High, we will get a good image, but the result will be waiting for a very long time. The render itself can help us with this, ask it to display the FG anchor points to us:

go to the Processing tab (Rendering - Render ...)

section "Diagnostics", put a checkbox on Enable and indicate what we want to look at FG:

render again:

distance, between green dots in illuminated areas, should be minimal, this is achieved by decreasing the step of the control points, ideally, the filling should be continuous, after which further decreasing the step will only lead to an increase in the rendering time, with a minimal increase in quality. Sometimes noise may occur on surfaces far from the light source, an increase in the emitted rays will help here, without decreasing the step. And do not forget about the sampling settings, which I wrote about at the very beginning.

Let's continue building the scene:

Very often there is a need to depict some objects emitting light, with complex geometry - showcases, aquariums, TV screens, which also illuminate the scene, but the task of detailed elaboration of the object is not worth it, but simply its imitation with textures. At the same time, problems arise with their lighting characteristics - with a strong brightness, dark objects also begin to glow, and by decreasing the brightness, light areas do not sufficiently illuminate the surrounding objects. Such an unfairness arises due to the fact that a 24-bit image is not able to store information about the true intensity of the luminescence of each pixel. The situation will be corrected by using as textures HDRI maps.

How to visualize the value of HDRI maps? - Imagine that you have taken a photo of a sea white-sandy beach against the sun. Load the photo into Photoshop and use an eyedropper to look at the colors of the pixels on the sun disk and white sand, the colors of the pixels on the sun disk will usually be #FFFFFF and the color of the pixels on the white sand will either be the same or slightly darker. Now let's lower the brightness of the entire image, for example, by 50% - the sand will become darker, which is, in principle, correct, but the fact that the solar disk will dim is not an order, our Sun is very bright. But if the picture is taken with a special camera that can save pictures in HDRI images, this will not work, the sun disk will remain bright, as if we had simply lowered the camera's sensitivity.

Let's try using an HDRI map in our scene. I did not find a ready-made map that would depict some kind of glowing object, so to test the effect, I just made an hdr file in Photoshop with a gradient fill - in the middle there is a bright blue line that loses brightness to the edges. (You can make your own hdr by choosing a 32-bit image mode in Photoshop).

Open the resulting map in Max as a normal Bitmap, an image conversion dialog appears:

the main attention should be paid to the conversion option in the "Internal Storage" section, by default Max suggests discarding the brightness information and just marking bright and dark places with certain colors - 16 bit / chan mode, this will not suit us, so set the Real Pixels mode and click OK ...

I used the selected map for a material similar to the material of the fixtures, set to the glow parameter, and applied it to the box on the far wall.

For comparison, two renders:

the first is a card in 16 bit mode:

By replacing bright areas with white, bright areas are illuminated with almost white light

the second is real:

there is clearly a difference.

Using Photoshop, you can make an approximate analogue of hdr images from ordinary photos, for this you need to translate the work into 32-bit color, make a copy of the image, increase the brightness on the copy using the histogram (you cannot change the brightness as such) and superimpose both images with the Multiplication parameter (multiplier).

Here is a scene where the TV picture was obtained in this way:

In this scene, there are three photometric light sources that simulate a 60 watt incandescent lamp.

Let's dwell on them in more detail.

Photometric light sources are needed to simulate real light sources according to their physical parameters, but some conditions are necessary

Use metric units when creating a scene

Observe the real dimensions of objects in the scene

Indirect lighting algorithm FG or GI must be enabled, or better both

The main characteristics of photometric sources are the emitter temperature, which gives the color of the light flux, and the power of the light source.

Since we are used to measuring power in watts, and we have only a superficial idea of ​​the temperature of the source, I will give a table of the most common household bulbs

Power

Temperature in K

12 volt - showcase lighting, less often table lamps

Household incandescent lamps 220 volts

Fluorescent lamps

As such, they do not have a temperature, and are divided according to the color of the limunifor:

Cold white 4500k,

Day white 6500k,

Warm white 3000k

Arc mercury / sodium

The temperature is 6500 - 11000K, but as a rule it is necessary to apply a filter, for example, sodium ions color the light red, and the inert gases present add a blue-green spectrum.

Now let's talk about sunlight.

The mental developers divided the sunlight in a straight line from the solar disk - bright with strongly pronounced shadows - mr Sun and filling from the cloud cover and atmosphere with strongly blurred shadows - mr Sky.

When adding a light source mr Sky to the scene, you will be automatically prompted to add the shader mr Physical Sky to the environment, with which it is desirable to agree.

in the settings you must specify the color of the sky at night "Night Color", at low brightness values ​​- multiplier the color of the sky will tend to this color.

Adjust the height of the horizon and the color of the earth's surface, add haze and the parameters of the ratio of red and blue in the sky (evening / day) in the Non - Physical Tuning section:

tinctures of mr San also have parameters for adjusting the horizon, brightness and color, haze, as well as an option for adjusting the shadows - Softness - the softness of the shadow and the quality at the borders of the soft shadow: Softness Samples.

examples of test room scenes

with the sun outside the window

and in cloudy weather

I forcibly increased the intensity of the light so that I can see the light filling the room and the shadows on the floor. In the first case, the rays are straight and almost parallel - the spot on the floor is illuminated and, for the second time, from the floor by reflection, the spot in the window area is illuminated. And in the second case, almost the entire room is illuminated. When rendering both scenes, the FG was adjusted to the Low profile, which caused a lot of noise in the illuminated areas.

Often when depicting rooms where light is coming from a window, preferably to enhance the effect of bright rays or the dusty atmosphere of the room, add the Volume Light effect to the light sources. On the light source mr Sun, this effect is not applied correctly, probably due to a different principle for calculating shadows, it simply fills the illuminated volume, without taking into account the shaded areas. Therefore, for such an effect, you will have to use standard sources:

Let's finish with the rooms and move on to simulating external lighting

If we have an hdr map that simulates the sky, then we can easily apply it to our scene. This is done by applying the map to the Skylight light source. The light source itself can be positioned anywhere in the scene - it doesn't matter, the main thing is that FG is turned on, otherwise it won't work.

Click on the button labeled None (there is no default card) and select our hdr image (as I described above), or specify the slot from the material editor, where such a card is already open.

Here is an example of a scene showing a small building around a moonlit night. The environment map is applied not only to the light source but also to the Enviroment map slot.

we see soft lighting from the skies of the entire scene, as well as pronounced shadows from the moon.

And now a fly in the ointment:

For the above picture, I specifically used a dark map with a bright spot of the moon, which I additionally processed in Photoshop to increase the brightness of the moon and darken the sky, otherwise the effect of the map would not be noticeable. In fact, in MR, in my opinion, the algorithm for taking into account the brightness components of the map for the Skylight source does not work quite correctly.

I will give examples of scene comparison for MR and V-Ray.

in both cases, multiplier = 3, I did not change the rest of the map parameters, I tried to use the materials with similar properties.

As you can see, in the second case, the picture is "tastier". The only thing I want to notice about Vy_ray is that it must be remembered that the same map for lighting and reflection cannot be used. Look carefully at the picture - where is the moon according to the reflection and where the shadow is directed from it - the difference is 180 o. There is a parameter in the settings for map rotation, but you need to remember this!

True, I took the most difficult map - the moon is not bright and small, the differences are almost invisible on good maps, but the fact of different calculations is obvious. Let everyone make their own conclusions.

It seems that this is all that I wanted to show in the framework of this lesson. In the end, I will dwell on some small features that, in my opinion, are worthy of attention.

- Material Glow... V previous versions illumined himself incorrectly. If not the entire surface of the material is illuminated, but only some separate areas (a map is applied) or the material is part of the Blend of the material, then the glowing area will illuminate adjacent objects with a different material, but objects with the same material will not illuminate themselves. There is no such problem in Max 2008. Here's an example scene:

the whole structure is made up of one Blend-based material. As you can see, the material itself illuminates beautifully (there are no light sources on the scene).

- except using .hdr maps, you can also use .exr maps, which are less common but also carry information about light intensity. The window for converting the exr format file, when assigning a card:

- While creating animations where there are bright light sources or textures on the scene based on hdri images, the Motion Blur effect in all versions of Max up to 2008 inclusive does not work correctly, since the device of our vision (and camera matrices) is such that the brighter the spot, the more bright "smear path" it will leave. Happy owners of Max 2009 the bundle includes an HDR Image Motion Blur (mi) shader, which is placed in the “Output” slot of the camera effects, which are available in the “Renderer” render settings:

This shader allows you to blur the image not only of objects in the scene, but also of the background of the scene, on which the map with the image is applied.

For comparison

Smudge on luminous objects in the scene

and for the background on the same map with the moon

on this I will end the first part of the lesson. In the next part I will touch upon the problems of GI and light in volumes.