Contents - Index - Previous - Next

Textures and Parameters




The textures allow you to make your scenes more realistic. However, remember that it is an artificial technique that has some generic constraints. A texture is as realistic as a picture of a fireplace on the wallpapers on a wall in a room. When you stand in front of the picture, it looks rather realistic. When you change your position, you see that it is only a plane image. Nevertheless, textures allow to achieve very impressive results that is difficult to achieve by other means. Therefore, textures is a very useful addendum to the 3D modeling. They are especially effective in the representation of almost plane structures like materials (wood, marble, etc), ornaments or bricks of a wall, or grass, snow, and sand, or even waves on a water surface, and rocks (when you observe them from a far position).   


With our products, you can either load textures from files (we consider all of them as one type "File"), or generate them using several types of numerical algorithms (these are the parametric textures).


Where to find texture files


With our products, you can load textures from any picture files of formats BMP, GIF, JPEG, and ICO.


All our products have the same set of "standard" textures that you can find in the folder "Textures" inside the installation folder. The standard set contains almost two hundreds files. It is enough for the beginning.


You can find many websites with textures in Internet. Go to "Google" and type in the key-word "texture", and you will get hundreds of addresses.


For example, visit the website "Absolute Background Texture Archive" at, where you can even generate new textures changing colors and brightness of the numerous sample textures.


If you need highly professional textures for the presentation of your solar project developed with Shadow Analyzer, or for your 3D illustrations created with 3D Draw Shadows, visit the website "Sub Dimension Studios" at, where you can find hundreds of seamless textures of the highest resolution and the best quality.


When to use the parametric textures


Working with objects, you need sometimes only to denote the nature of their surfaces by a rather simple images like bricks or gradient color bands, or to use something like the level lines and grids applied to a curved surface. Such images can be generated by numerical algorithms of the parametric textures very fast and without any files.


Numerical algorithms allow to change the texture contours continually (using the Spin controls), what is difficult or impossible to do with files. What a huge collection of files would be needed for these purposes?. Also, it is rather easy to change colors of the parametric textures.


Therefore, before to search for an appropriate texture file, verify whether the problem could be solved by a parametric texture.


Why so many parameters?


All the texture types have the same set of general parameters that determine how the textures are applied to the object surfaces. In addition, each texture type has a set of specific parameters that determine how the texture is generated (or loaded).


In our products, you can use textures in a very simple way: merely, select an object, choose a texture and apply it to the object surface -- you can do it with a few mouse clicks. In many cases, it is all what you need to improve substantially the appearance of your scenes. At the beginning, no need to take care about the numerous texture parameters, because their default settings are adjusted to the most common situations.


Later, learning by experience, you might want to do something more interesting with textures. To know what particular you can do with textures, read this chapter "Textures" further. However, firstly read and implement Step_4 of the topic A Typical Session to get a minimal preliminary experience with the texture interface. Also, see the point "Use the toolbar Texture" in the section "Use toolbars" of the topic A Typical Session.


Pixels and texels


Irrelevant to its origination, a texture, in essence, is a 2D rectangular picture that consists of pixels. Usually, the pixels of a texture are called "texels" to distinguish them from their representation on your screen after the texture is applied to the surface of an object in your scene. If the initial texture has a low resolution (its size in texels is small), and the object, to which it is applied, occupies a big area on your screen, then one texel can be represented by many pixels. And vice versa, if the object is small and the texture has a high resolution, then one pixel on your screen can represent a group of texels of the initial texture. Also, the projection of a texel can be greater than the scree pixel in one direction, and less than the screen pixel in another direction (for example, when you are looking on a far fragment of a horizontal surface).


The resolution of the texture is managed by parameters NPixX (width) and NPixY (height). It is just numbers of texels -- the pixels of the texture, but not the pixels of its image on your screen. Their values are always a power of 2 (for example 32, 64, 128 etc.) within range 4 to 1024. The default values are equal to 64, when the texture is newly created -- loaded or generated. For the textures from files, the upper value is also limited by the size of a picture. However, the original dimensions of a loaded picture are not limited, and should not be exactly equal to a power of 2. Do not set these parameters to too high values (remember that a texture of 1024*1024 texels occupies 4 MB memory). 


The parameter Linear switches the filter that linearizes the transition between displayed texels when they occupy many pixels.


The parameter Repeat allows to repeat the texture image periodically when the image size is less than the surface size.


Interaction between the surface colors and textures


The textures are processed by a graphics card after the colored surfaces of objects are already rendered. A texture does not depend on the light conditions -- it meets the surface pixels "as is" and add something to them. To achieve a realistic result, the graphics card mixes together the surface pixels and the texture pixels. It processes separately red, green, and blue color components of each pixel pair mixing them in a certain proportion.


There are two different modes of the interaction between the surface colors and textures: MODULATE (1) and DECAL (2). The parameter EMode is the switch between these modes.


In the mode MODULATE, the texture plays a role of a filter, through which we are watching on the object surface. Each color component of the surface pixel is multiplied by the corresponding color component of the texture pixel. Note that the white color on your screen consists of 100% intensity of red, green, and blue components. Therefore, if the surface color is white, and the surface is brightly lit, then the resulting image looks like the initial texture picture. If the texture is white, the resulting image will get the color of the surface (as it looks without the texture).


More complex cases are regulated by the color "arithmetic". For example, the yellow color consists of 100% red intensity and 100% green intensity. Therefore, if the texture pixel is yellow, then the red surface pixel will remain red, while the blue surface pixel will become black. In the mode MODULATE, the resulting image looks usually darker than both the surface and the texture picture.


In the mode DECAL, the proportion between the surface colors and textures is regulated by the parameter Alpha. The texture is completely transparent at Alpha = 0; and completely opaque at Alpha = 1. Note that opaque textures overpaint the shadow effects. To achieve realistic results, keep the Alpha value near to 0.7 - 0.8. However, remember that the texture can make the surface brighter at the sunset. If the surface is not lit, the texture looks like a neon ad.


The texture mapping


When we apply a texture to a surface we establish a correspondence between its texels and points on the surface. This process is called "texture mapping". In 3D graphics, each surface is represented by a set of triangles. Therefore, the texture mapping comes to a correspondence between texels and vertices of the triangles. 


This correspondence passes without changing trough all the 3D transformations of vertices up to the final phase when the image of the object appears on your screen. Therefore, we can define the texture mapping independently from the 3D transformations, and consider it as an attribute of the object (of its surface, or of its color zone). We can define several basic algorithms of the texture mapping for each object type, and manipulate them as we do with other object parameters. These basic algorithms of the texture mapping in our products are controlled by the parameters PrType, PrCS, and Scale.


The parameter PrType determines the type of the used projection (it is just the core of the texture mapping). The "generic" projection means that the mapping algorithm is developed according to the geometrical nature and the functionality of the particular object type. Instead to learn them theoretically, try them practically -- we provide only general comments but not all the mathematical details, because all in all you will decide, which the projection to use, by the appearance of the textures on your screen, but not by the mathematical formulas. The "generic" projection is the default setting, and usually it is enough for simple cases. It put the center of the texture image to the central point on the front side of the object, adjusts the image size to the largest dimension of the object, and set the scaling coefficients of the image width and height so that the image will be displayed without (or possibly with minimal) distortion.


The projections of types "along X/Y/Z-axis", "cube", "cylinder", and "sphere" are common for all the object types. They do not take into account the specific geometry of the object. You can do it by yourselves selecting different projections for different color zones of the object. With these projections, you can use the parameters PrCS and Scale to select, which the coordinate system and which the scale should be used for the projection. The values of these selections are: 0 -- scene, 1 -- root parent, 2 -- (immediate) parent, 3 -- object. 


The sense of these parameters can be illustrated by the following example. Say, you would like to apply an ornament to the steps of the podium in the Step_4 of the topic A Typical Session. You found an appropriate texture, but the platforms of the podium are of different sizes. Therefore, with the "generic" projection, the elements of the ornament on different steps are of different sizes too. To fix the problem, you can set (for all three boxes) the projection type to "cube", and the parameters PrCS and Scale to 1 (root parent). Then, the ornament on all three boxes will become the same as on the box 1, because the box 1 is just the root parent object of the podium. However, in the Step_6, you put the temple on an island, and the size of the ornament will be automatically adjusted to the scale and the coordinate system of the new root parent. To separate the podium from the island, set the parameters PrCS and Scale of the box 1 to 3 (object).


The "face" projection maps a texture individually on each face of the object using the local coordinate system of the face. It can be useful for some irregular textures like random dots. The parameter PrCS is ignored by this projection. However, you still can use the parameter Scale to unify the scaling coefficients of the textures that are applied to different objects of a compound body.


After the basic rules of the texture mapping are defined, we can introduce some additional 2D transformations of the texture as such. The most evident transformations are resizing, rotating, and moving of the textures along the object surface. It looks as if you take a sheet of an elastic wallpaper, stretch or shrink it changing its width and height, rotate it in its plane, move it also in its plane, and then attach it to a curved surface according to the selected basic algorithm of the texture mapping. It is just what you did in the  Step_4 of the topic A Typical Session. These 2D transformations are determined by the parameters MagnX, MagnY, Rot_A, MoveX, MoveY.


You can use these 2D transformations for many purposes, for example, to locate a flag or an emblem in a certain place on the surface, or to adjust the size of a texture to the dimensions of the object. Also, these options allow you to reuse the same texture in different ways, as if you apply many varied textures to different objects. The following two pictures illustrate this case.


On the first picture, you see the colonnade that you constructed in the  Step_5 of the topic A Typical Session. All the columns look identically like new coins. It is not so realistic as you might want. What to do? Create many texture files, one per a column? No need to do it. Merely, rotate the same texture by different angles (change the texture parameter Rot_A for each next object). Then you will get the version of the colonnade that is shown on the second picture. You can also find it in the scene file "et030_TS_Step_7.sa1" in the folder "Examples".




Reuse textures within the same object


Textures intensively use the system memory. When textures are applied to the surface of an object, each color zone create its own texture object in the memory. The texture objects provide the very fast texture rendering when you change the viewpoint, or the light direction, or use the zoom option. This process takes less time than the shadow calculations -- therefore, in most cases the textures do not slow down the scene rendering.


Individual texture objects (one per a color zone) allow you to use different textures for different zones, or change the resolution and other parameters of the same texture individually for each zone. However, sometimes you do not need such different settings. Moreover, sometimes you need just opposite -- you need to apply the same texture with the same settings to several zones, and would be glad to manage them from one control point.


One way to do it is to apply the texture to the "surface" item of the combo box COLOR. In this case, the application creates several texture objects (one per a zone) from the same texture source. And you can manage parameters either for all zones simultaneously or for each one individually (switching between "surface" and "zone N" in the combo box COLOR). In general, this option works if all zones are filled by textures of the same type, even if you use the type "File" loading textures from different files. However, once you change the texture type of one zone or delete it (choosing the line "none" in the combo box TEX), you cannot manage all zones by the item "surface", because different texture types have different sets of specific parameters.


Another way is to use the parameter "mapT" that you can find in the combo box PAR of some object types. The values (and the interpretations) of this parameter are different for different types (and some object types do not have such a parameter at all). 


Let us consider this parameter in the case of the type 3D_Box. You will see the following description in the Status bar:  


mapT -- map zones to share textures:

0 -- do not share; 

1 -- 1[1] 2[2,3,4,5] 3[6];

2 -- 1 for all.


If you choose "0", the option is switched off. 


If you choose "1", then the texture object of the zone 1 will be used as usual, while the texture object that is created for the zone 2 will be applied (with all its settings, but without the creation of additional texture objects) to zones 2, 3, 4, and 5. Note that in this case the texture objects created for zones 4 and 5 will be ignored (thus there is no sense to create them), and the texture object created for the zone 3 will be applied to the zone 6. The texture object created for the zone 6 will be also ignored.


If you choose "2", then the texture object that is created for the zone 1 will be applied to all zones. All other texture objects will be ignored (thus again, there is no sense to create them).


This option allows you to use less memory, and manage different combinations of color zones.


Note also that this option does not concern the color management: you still are able to set colors of the color zones individually as usual.