New Terrain Blending test

Friendly conversations, and everything that doesn't fit into the other forums.
9 posts Page 1 of 1
LukasPJ
Site Admin
Posts: 358
Joined: Tue Feb 03, 2015 7:25 pm
 
by LukasPJ » Wed Jul 12, 2017 1:57 pm
Hi guys, I have a RC for the new terrain blending algorithm.

You can find it here:
https://1drv.ms/u/s!AtrTgygwv8wijutDuctc4erqhoSIdQ

And here's a video showing it in action:


What is it?
If you're not up-to-speed on the work I've been doing, my changes revolve around two major topics. First of all, I've implemented the height-based blending algorithm as described by Andrey Mishkinis, in this article: http://www.gamasutra.com/blogs/AndreyMi ... atting.php
I have implemented that blending technique, using the height information available in the alpha channel of the normal-map. I only need to add it to macro textures as well.

Furthermore, I've implemented the changes explained by @
User avatar
JeffR
here: viewtopic.php?f=2&t=1032&start=20#p8280
Well, except for the composite map, as PBR is not in yet. But the changes to how detail textures and the base texture works are implemented. You can now set the base texture, to be used by the whole terrain, on the terrain object as shown here:
Image

The diffuse texture still exists, but it is only used to generate the base-texture if you don't specify a base texture directly.

I would like feedback on:
  • Bugs, any bugs or things looking weird is always important to know about
  • Performance, how does this build perform in your various scenes/tests?
  • What do you think of this way of using the detail texture? I.e. as a up-close diffuse texture rather than a gray-scale detail texture?
Duion
Posts: 845
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Wed Jul 12, 2017 2:55 pm
The basetex is always used by the whole terrain, the base textures of individual terrain materials are just used to generate the basetex which is then always used by the whole terrain.
When I'm done with my level I edit the final basetex by hand, adding final touches and giving it a better look and then save it and it will be used by the whole terrain and to prevent overwriting I created a switch in the terrain block that is called "updateBasetex" which is deactivate when I'm done and make my final basetex.
LukasPJ
Site Admin
Posts: 358
Joined: Tue Feb 03, 2015 7:25 pm
 
by LukasPJ » Wed Jul 12, 2017 3:13 pm
Duion wrote:The basetex is always used by the whole terrain, the base textures of individual terrain materials are just used to generate the basetex which is then always used by the whole terrain.
When I'm done with my level I edit the final basetex by hand, adding final touches and giving it a better look and then save it and it will be used by the whole terrain and to prevent overwriting I created a switch in the terrain block that is called "updateBasetex" which is deactivate when I'm done and make my final basetex.


"updateBaseTex" updates the cache, this change will allow you to provide an image to the editor instead of having to deactivate the "updateBaseTex" method. So when you are done, you set your cache to be of type "png", take the resulting image copy it to a separate file, edit it however you please, and then set it as the baseTexture. Setting it as the baseTexture, will prevent the terrain from generating new baseTexture-caches, and just use the one that has been set.

Edit:
Note that it still generates a cache; generating the cache even though the baseTexture is set allows the terrain to enforce a specific format (e.g. DXT or PNG).
Duion
Posts: 845
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Wed Jul 12, 2017 3:20 pm
So you have two basetex files instead of one and it still regenerates the original one every time?
LukasPJ
Site Admin
Posts: 358
Joined: Tue Feb 03, 2015 7:25 pm
 
by LukasPJ » Thu Jul 13, 2017 1:22 am
Here's a small example of the detail-diffuse texture thingy.

By default, the detail-diffuse texture will completely overwrite the baseTex color up-close. However, if you tweak the alpha channel of the texture, you can allow the baseTex color to bleed through where it is wanted.
An example can be seen here:
Image

The cracks in the ground are used very much like the stock detail-textures currently works, simply applying detail to the underlying base color, however the straws of grass are allowed to retain their look.

Here's a more extreme example, to exaggerate the effect:
Image

I took a seamless texture off the web and applied an alpha-channel to it. It did take a bit of work to get the alpha-channel levels I wanted, in order to let the grass keep its color, but I'm fairly satisfied with the results.

I'm not arguing that this way of handling detail-textures are necessarily "better" as such, however I, personally, find it a lot more intuitive. I don't see how we lose a lot of quality in the final product, but I'd love to be enlightened if this is the case.

I've made a few bug-fixes to how the baseTex blends with the detail-diffuse. You can download a new version with these changes here: https://1drv.ms/u/s!AtrTgygwv8wijutDuctc4erqhoSIdQ
Duion
Posts: 845
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Thu Jul 13, 2017 11:40 am
The detail diffuse color will not be "completely overwritten" by the base texture.
The color of the detail texture remains, it just gets blended into the base texture.
Your example is probably perfectly possible in stock Torque3D, as the grass blades are just a small portion of the detail texture, so you can leave them full folor and they will keep their color ingame.
The only case where the basetexture color will overwrite the detail texture color is, if the base texture color is a significantly different and stronger color, which almost never is the case. Yes the color will change, but it is far from being overwritten.

Btw I made a screen using the regular texture in stock Torque3D and it looks much better, especially as the detail texture is not deleted through an alpha channel:
http://duion.com/files/temp/bugs/justthenormalgrass.png
Azaezel
Posts: 385
Joined: Tue Feb 03, 2015 9:50 pm
 
by Azaezel » Thu Jul 13, 2017 6:51 pm
Right so. The differences in general design for an end user according to the specs discussed thusfar would be shifting the 'this does not effect the base color result' from a 128 greyscale middle to a 0 alpha.

This has two effects:
1) Removes the 'capacity' to darken a given basetex via subtracting a negative-color.
2) Shifts The math used from half the available color range for darkening, half for brightening to the full range for blending.

Either one is capable of producing either result in theory (within reason), given enough familiarity.
LukasPJ
Site Admin
Posts: 358
Joined: Tue Feb 03, 2015 7:25 pm
 
by LukasPJ » Fri Jul 14, 2017 1:24 am
Last update for a while:

Repo with changes:
https://github.com/lukaspj/Torque3D/tre ... Blending-2
Edit: The code is unpolished so don't judge me.

Latest build (now supports macro textures):
https://1drv.ms/u/s!AtrTgygwv8wijutDuctc4erqhoSIdQ
Duion
Posts: 845
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Fri Jul 14, 2017 1:52 am
You should learn how to do scientific comparison tests.
The scene the textures etc everything has to be identical as well as position of camera etc then you make a screenshot in stock and one with your changes. So that the only difference between screenshots is your changes, then you can objectively see which is better.
9 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest