War Thunder gaming - leden RSS

neděle 16. července 2017

Thermal stream solution

Introduction

Instead of creating and placing arrows to describe thermal stream as suggested in general suggestion about Winds and Thermal flow I suggest new way - using thermal planes. To place arrows would be too hard and slow



In the text bellow I suggest to create work space which would be box or cube. This work space would be a group of horizontal planes used to describe thermal stream. Last of all, there will be wind descriptors, which would be the vertical planes.



The horizontal planes would contain a hidden texture with a descriptive value of stream direction and power.
Boxes with thermal planes around mountains.


This suggestion describes the idea of thermal planes, wind planes and how to automate the job that it could be auto-created by program. Also I suggest to create edit tool, which would enable to made small modifications like rotation of the planes or change it's values.

Description of the generation of thermal planes

First of all a tool would be needed to calculate surfaces parallel to sea level.
To give you an idea, I have created mesh terrain in Sketchup. Then I have created 24x24m face/plane parallel to x/z axis. From the face I have created a cube (I just duplicated the top of the cube and move it down). The blue cube is space cca 24x24x25m (width x depth x height). This is space where I want to create faces which should be parallel to the map plane.



To give you idea I have added yak added into the cube.


What I need to do now is to hide or delete the faces, because this only limits the space for the job.

Now when we have the edges only (Perspective View):


I will draw small faces into the cube to give you idea what I am going to do.

I start drawing the face with 3m offset from left edge. The resulting face has 8x24m.


Now I need more faces like this. I duplicate the faces with 5m offset.


Now I need to duplicated the faces again, but in depth axis direction:


Almost done. Now I need to create Black and white texture (one byte channel). The texture will be defined by shadows direction and other factors which the creator of thermal streams should specify.

To give you idea, I set sun position to 7/18th 17:30 (UTC-7:00) and turn shadows on.




Now you see that the planes are covered with the shadows. The shadow must be projected to the plane to generate texture. The only problem is that every plane needs to have individual texture. You would be able to calculate the shadow and create a texture for the surface, but the creator of thermal streams can need to adjust the texture later.

The texture will accept these rules:

Value:
0-125 - air flows downwards (y-axis down)
126-127 - no stream up nor down
128-254 air flows upwards (y-axis up)

Note that the value does not mean temperature but a speed of the air stream.

Hence when you would create black or dark gray lines for shadows then this is right the air streams downwards because it is warm. When you would create white light gray lines for shadows then this is right the air flows upwards because it is hot

You could calculate how heavy or how warm the air is depending on air temperature and height of the terrain. There is more factors of the terrain what could have effect on the value of the shadow or light.

The size of the texture in this example is 8x24px where 1px is 1m in the 3D space.

Now I edited texture of terrain and textures of the two planes in the cube.


 So you see the texture which where the shadow of the mountain is projected. Once again, this should be made automatically by program. This was 1st plane from top.

Now the second plane from top:



Because when I turn off the textures and turn on the shadows you can see this:


Another planes (3th):


Notice that the borders of my texture are not perfect... There are mistakes but this doesn't mind.

Next plane all all back because they are completely in shadow. I would skip editing so far, but there could be gentle differences in the intensity of the shadow pixels.

When the program would generate these textures we have something like this:



Explanation

These values should indicate intensity of the air stream in the area.
Dark means the air goes down.
Light means the air goes up.

Further adjustments of the textures

Another adjustment and calculations are needed.


We need to find out how far is the side of the hill, by other words what is the distance between the horizontal plane and the mesh 1) in the same level 2) 2,5 above the plane 3) 2,5 bellow the plane. This will give us an idea about the direction of the thermal stream. This can be later used to rotate the plane.

Now we can apply this rule:

The air goes down slowly if it is close to the steep mesh terrain (mountain).
The air goes up faster if it is far away from the steep mesh terrain (mountain).

This will result in a gradient texture.


All these steps should be made by program will we get these textures which we can edit manually.


How the thermal stream would work



When the aircraft will fly through these planes which should be invisible, the wings will fly via the B/W pixels. In the place where the wing meets the pixel it works like indicator of current stream.


Intensity of the planes and resolution

In this example I used very dense planes. It is not needed to be so dense. In this particular case it would be enough if there would be only one plate in the top instead of two. The resolution here is 8x24, but I think smaller resolution like 3x8 could be enough.

There are spaces between the planes because it is not needed to collect the information "continuously". The gap between planes is 4m so the selected resolution could be 1px=4m.

These planes should be around the mountains and hills.

Vertical planes

Think about vertical planes to measure horizontal speed and direction of wind.




Manual editor of the textures

Manual editor to manipulate with the boxes or with the planes would be useful. The creator or the thermal stream should edit the textures if he needs to improve the stream to be more exact. Basic tools like rotate or move would be helpful. Also a possibility to select texture, scale it or position it would be useful. Also consider separate the thermal textures to neutral: average value 126-127, calm: average value 0-125 and warm: average value 128-254 to make simple orientation in the textures.

Every plane would have a texture. But if the textures are similar, no need to use unique texture. There are just gentle differences in the values.

Dynamical planes

It should be possible to adjust all the planes automatically to create suitable textures for every season or various extreme temperatures. The main organisation for thermal textures could be like this:

Hard Winter Textures: a) night b) morning c) noon d) afternoon e) evening
Ease Winter Textures: a) night b) morning c) noon d) afternoon e) evening
Spring Textures: a) night b) morning c) noon d) afternoon e) evening
Hard Summer Textures: a) night b) morning c) noon d) afternoon e) evening
Ease Summer Textures: a) night b) morning c) noon d) afternoon e) evening
Autumn Textures: a) night b) morning c) noon d) afternoon e) evening
* Easy / Hard - describes normal vs extreme conditions

When a map would load it would load the appropriate textures + modify them depending on current air temperature. I admit loading dynamical change of weather would be harder because at least 3 sets/scenarios of textures would be needed to be loaded into memory. For example when the sun rise up the air stream in mountains would change dramatically. Same with sunset.



Less resolution

8x24px  => 40x14,5m





Possible simplification 1kmx1km square

Another possibility would be to create very simple planes for whole map. I created 26 planes with a gap 2,5m. You can see the shadows. The animation shows them from bottom to top. The last one contains no shadows.


Size of the map: 1x1km => 414x414 px. Sufficient.

In next step I have blured the shadows (Gaussian Blur distance 4px):

It needs to correct levels yet.

Disadvantage of this method is that there are big white areas which are not used. However in next step we could use them too.

Hot flat surface

Another thing we could calculate with is flat surface which is hot from noon or afternoon sun. This could be affected by mesh (the areas which are flat and horizontal) or by the texture of terrain. Because the dry grass, desert or city would be hot areas so the color here should be brighter.

I use the light area of the terrain (the area at sea level where the shadows are not present). In the  mask I have dark water surface (not in a shadow), grass and towns.

Notice that water is cooler than the land surface.



I have desaturated the image (without shadows) and made balance of the lights.


Now I will add this texture to the base (1st plane) and I will project the shadows onto it. This is what I have:


So you see that the brighter areas are warm air which will flow upwards.

Wrong example

I believe the mask could affect all the planes. The shadows on the planes should be untouched but the white areas should be changed to reflect the mask. Yet I admit this mask is not perfect, because the road and city should be warmer (lighter) than the grass.

Corrected version:
Good example. You can adjust the brightness balance as needed.

So you can see this solution would be pretty simple. All you need to do is to consider the colors (or type) )of the terrain and add it to the original texture.

The next step is to affect the planes above by to hot air which is rising.

My idea is to use Gaussian Blur 4px and add it to the layer above. And repeat this for every plane (but I must increase the blur effect). It may not be that accurate as calculating more precisely but the idea is simple. Instead of Gaussian Blur you could use simple image resize to reduce resolution and convert it back to original resolution then.


The higher the plane is the blured the texture is.





Shadows of the Clouds


Now I have added clouds to my model. I have projected the clouds on the first plane. I will do this for every plane to get textures.


Note: These shadows are too light so I have to adjust them to be darker, hence there will be bigger contrast between light and shadow on my photos. If I would not do it, the air stream would not be downwards orientated.

I will add the textures to the textures which I already have, but instead darkening (adding) I will use multiply. This mean that the shadows of the clouds will make the calm/dark places darker. Whilst the non shadow areas will stay untouched.

Here is what I get: planes from 2,5m ASL to 65m ASL.




On a final I have decided to improve levels to the light gray areas, which are not bright enough.






Lacks of the approach

1) There is a problem with places which are in shadow but just few meters above terain. You can imagine that the aircraft flying in low altitude e.g 10m above water surface could experience drag down. In real the air would probably stay in the level it is. There could be some breeze over the water. This is described on Wikipedia in article Sea breeze.

https://upload.wikimedia.org/wikipedia/en/thumb/5/54/LAKE_BREEZE.gif/800px-LAKE_BREEZE.gif

I am not sure how to correct this problem. In a program you would probably need to establish the bottom texture on 126 px to prevent drag down. But you would need to build winds in that location where the shadows and dark areas should be present.


2) There is problem that during the bluring of the texture with shadows of terrain - the areas which are on planes higher than 10m AGL start to be too dark because of the brightness we averaged.

Solution for this would be to use different levels for different altitudes.

I tried to fixed these two problems slightly with manual edit. This is just approximation. It should be possible to get better results in program that would calculate with the AGL (altitude Above Ground Level).

Žádné komentáře:

Okomentovat