Articles, Blog

Terrain Editor | Auto LOD System | Paint Tool

February 18, 2020

Hello. We continue to improve the landscape editor. In this video, I’ll show you two new tools Automatic LOD System and Paint Tool Here we already have a small workpiece. Concerning the automatic generation of LOD. Here we have added a new control to select LOD The higher the LOD value, the lower the resolution of the model. The creaseAngle parameter specifies the smoothing between the faces of the model. If you remove smoothing, you can clearly see the faces of the model. About the algorithm for creating the LOD, I will describe it in more detail in a separate video. But if it’s brief, then the point is this We have an array of vertices of maximum resolution. We consider all LODs from the original vertices. Depending on the value of the LOD, a sample is selected after a certain number of vertices. That is, the more LOD, the greater the sampling step, the more positions are skipped. This method is good because it works pretty fast (unless, of course, the resolution of the model is not too high) And it becomes possible to generate LOD on the fly. The algorithm of course can and pre-calculate all LOD instances. And that you do not doubt my sincerity about what I just said I will demonstrate how it works in real time. To do this, first make changes in the landscape. And as you can see, our LODs have also changed. Because, as already mentioned, they are based on the vertex buffer of high-resolution models, a change in which we have just made. You do not need to pre-calculate LOD – the algorithm will do it automatically in real time. Your task is to edit the original high-resolution model. We made new changes to the grid LODs was automatically updated. The only thing is that during the landscape editing, the parameter LOD must be 0. Otherwise, the terrain will not be displayed correctly. But there will not be a critical error – it’s enough to turn on LOD=0. With this sorted out. Go ahead. An interesting bug – after changing the graphics from the wireframe to the smooth mode model continues to be displayed in the previous mode. Now about paint editor which will allow us to paint our landscape in different types of surfaces. How do we organize the shading. To start editing the coloring, you must select the appropriate mode here. I did not make separate controls for shape and color editors – they are the same for both modes. Too many different buttons just make confusion. Just as before, we select the brush, size, pressure, and so on, using the same controllers. It remains only to choose the channel (layer) in which we will draw. Who worked at the Battlefield2 Editor most likely learned the principle. Help for those who do not know. Game studio Dice after the release of the Battlefield2 to support the game community put in the public access map editor with the help of which everyone could make new locations for the game. And I once studied this editor. And I really liked the landscape shading system in this game. It was taken as the basis for shading in my editor. Core of the system – layers There are two textures that contain masks, which define the location of certain surfaces. Each texture has 3 channels (RGB) – a total of 6 layers. Thus, in one model we can mix up to 6 different surfaces. To organize the coloring, you need to be able to edit these two textures. In vrml there is a class – a pixeltexture, in which we can draw in real time. And here in the top left corner I turned on the display of these textures. Select the red channel of the first texture And start painting And see how changes appear in the texture. There is a texture of the mountain, grass, soil, asphalt, gravel, sand And in the shader these textures are multiplied each by one of 6 masks and are added together. So far, I’ve fixed these textures on certain layers At the moment, there is no way to assign any texture to any of the channels. To provide such an opportunity is not a problem. The matter is that while I was not completely determined with the landscape shading system Here I need to conduct many tests of different approaches тo find a compromise between beauty and performance. At the moment, the model is drawn with a simple shader without normal mapping. Now I will select a shader with normal mapping, and the appearance of the model will become more realistic. However, for the beauty you need to pay performance. It is not surprising, because the normalmapping shader reads 2 times more textures than simple. But there are several more shader options that allow to preserve high quality of model display by reducing the number of instructions (it is especially important to reduce the number of textures) I’m already thinking about this issue, and in the near future I will try to improve the shading. In the meantime, there is something that is. Let’s try the other layers. Soil surface. So I assigned the material to the model that displays the first layer texture. Depending on the selected channel, drawn in red, green or blue channel of layer texture. Here it is necessary to make an important observation. When one channel is enlarged, other channels are subtracted. If I draw red over green, the channels do not add up giving a yellow color. Red replaces values from other channels. This is important, because otherwise there would be an effect of a sharp increase in brightness in the place where the values from several channels were summed. The value of one channel, displaces values from the others. And if I draw in the channel of second texture , then their values displace the values from the first texture. We return the standard material Pebbles surface Sand Of course with normalmapping the picture is more attractive. Without the normal mapping, it’s too poor, I want a “next gen” graphic. And this is albedo. The shader only returns the pure color of the textures without taking into account the light. Well, let’s add the sand. I tell Russian humorous proverb, which ridicules the wrong accent in some words, including the word beach. The struggle with tiling textures of course is always very sharp. Far Cry=) And here we will make asphalt – there will be a helipad. This way Promised bonus. Draw the water Flood the islands Reflections and refractions are not yet visible. Now we will correct this. Choose the resolution of the texture. The water will have to be darkened, too light. Thank you for attention. Until the next video.

1 Comment

  • Reply andy sky April 14, 2017 at 4:20 am

    Arent't you excited about Dirt 4? they will have infinite rally stage route generator called YOUR STAGE. Online and share with friend with your custom tracks so thats big plus. They said driving physic going to be much improve from Dirt Rally especailly tarmac. I got to say bye bye to Richard Burns Rally. Hopefully VR support through patch. They did it with Dirt Rally vr patch so its possible. I rid of my triple screens after try vr at my friend's house. Sense the realy size of driving road and also depth perception really gives driving sensation just like real life driving.

  • Leave a Reply