Automatic Greebler & True Normal Mapping

In here you can discuss what is going on in the project, offer help, praise or critique!

Automatic Greebler & True Normal Mapping

User avatar
blue_max
XWAU Member
Posts: 1857
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Sep 13, 2021 5:35 pm

I've been working on a new effect: the Automatic Greebler. In a few words, this shader will automatically add details to any surface as needed, depending on how close you are. The basic idea is that no matter how close you fly to an object, there will always be small details on its surface (the actual implementation has limitations, but that's the general idea). This shader works better for large objects where pixelation can be easy to notice. It's easier to see this with pictures.

Here's the first example. This is a big (10km wide) asteroid. It already has a 2k texture, but it looks like this ~2km away:

auto-greeble-1.jpg

This is what it looks like when the Auto Greebler is turned on:

auto-greeble-2.jpg

The greebles are generated by gradually blending the current OPT's texture with an external texture that provides the greebles, depending on how far is the surface from the camera. The same greeble texture can be shared among several OPTs, but we can also have custom greeble textures for specific OPTs. I've currently implemented Multiplication, Overlay, Screen, Replace and Normal Mapping blending modes. The images above are a combination of a Normal Map and an Overlay map.

Also, I finally implemented support for true Normal Mapping. It took me a while because I'm not using any tangent maps, as in other engines. So, the material system will soon support true Normal Mapping as well.
You do not have the required permissions to view the files attached to this post.

User avatar
blue_max
XWAU Member
Posts: 1857
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Sep 13, 2021 5:37 pm

More examples, of the same asteroid:
auto-greeble-3.jpg
auto-greeble-4.jpg
You do not have the required permissions to view the files attached to this post.

User avatar
blue_max
XWAU Member
Posts: 1857
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Sep 13, 2021 5:38 pm

auto-greeble-5.jpg
auto-greeble-6.jpg
You do not have the required permissions to view the files attached to this post.

User avatar
blue_max
XWAU Member
Posts: 1857
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Sep 13, 2021 5:40 pm

This is the SSD, here we have greebles generated with a normal map, and lightmap greebles, applied using the Screen blending mode:

auto-greeble-7.jpg
auto-greeble-8.jpg
You do not have the required permissions to view the files attached to this post.

User avatar
Vince T
Fleet Admiral (Administrator)
Posts: 13601
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Mon Sep 13, 2021 5:42 pm

Oh hell yeah!!!!!
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear

User avatar
blue_max
XWAU Member
Posts: 1857
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Sep 13, 2021 5:42 pm

The SSD again:

auto-greeble-9.jpg
auto-greeble-10.jpg
You do not have the required permissions to view the files attached to this post.

User avatar
Forceflow
Fleet Admiral (Administrator)
Posts: 6645
Joined: Wed Oct 20, 1999 11:01 pm
Contact:

Post by Forceflow » Mon Sep 13, 2021 5:42 pm

Brilliant work :thumbs:
Murphy was an optimist! I am a pessimist!
And always remember that a smile is cheaper than a bullet! (District 9)
Webmaster of the X-Wing Alliance Upgrade Project

User avatar
blue_max
XWAU Member
Posts: 1857
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Sep 13, 2021 5:45 pm

Thanks for your comments, guys! Here's a few more. I've exaggerated the effect a little bit, to make it noticeable, but it can be fine-tuned and we can even use texture masks to define areas where greebles are to be applied:

auto-greeble-11.jpg
auto-greeble-12.jpg
You do not have the required permissions to view the files attached to this post.

User avatar
the_stag
Cadet 2nd Class
Posts: 54
Joined: Sun Jun 14, 2020 3:47 pm

Post by the_stag » Mon Sep 13, 2021 7:48 pm

This is amazing. Simply amazing. I cannot wait to see these in action on my own PC. Now if the price of video cards would come down...

batuta
Cadet 2nd Class
Posts: 98
Joined: Tue Oct 13, 2020 1:34 pm

Post by batuta » Mon Sep 13, 2021 11:33 pm

uau i cant beleave it, incredible

Tuskin
Ensign
Posts: 438
Joined: Sat Aug 13, 2005 11:01 pm

Post by Tuskin » Tue Sep 14, 2021 12:07 am

Ah, detail textures, nice.

marcop000
Cadet 1st Class
Posts: 173
Joined: Fri Dec 27, 2019 7:08 pm

Post by marcop000 » Tue Sep 14, 2021 5:46 am

This is a massive step forward !!! Wating to see the final result.

User avatar
m0rgg
Cadet 2nd Class
Posts: 83
Joined: Wed Apr 01, 2020 10:33 pm

Post by m0rgg » Tue Sep 14, 2021 6:47 am

Impressive, quite impressive!

Bman
Lieutenant Commander
Posts: 1037
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Tue Sep 14, 2021 7:17 am

Superb job BlueMax. So the general idea is it would no longer be necessary to implement complex HD textures on the larger .opt models themselves, because they could be replaced dynamically with these external HD greeble textures. This could improve performance if the overhead is shifted from the .opt models to the shader effect. (?) Do external texture sizes have to match the original skins ?

This concept would be great too for the background .dat files (static and animated) .... approaching planets, orbital views of planets, stars/suns/galaxies, death star surface, and planet atmospheric mission level surfaces, deserts, forests, mountains, oceans, city landscapes, etc. :-) Probably a lot of different .dat files.
W-I-P: ISD-II, (Imp) Escort Carrier, NL-1 Platform, Misc, & TFTC.

User avatar
Forceflow
Fleet Admiral (Administrator)
Posts: 6645
Joined: Wed Oct 20, 1999 11:01 pm
Contact:

Post by Forceflow » Tue Sep 14, 2021 8:54 am

Bman wrote:
Tue Sep 14, 2021 7:17 am
Superb job BlueMax. So the general idea is it would no longer be necessary to implement complex HD textures on the larger .opt models themselves, because they could be replaced dynamically with these external HD greeble textures. This could improve performance if the overhead is shifted from the .opt models to the shader effect. (?) Do external texture sizes have to match the original skins ?

This concept would be great too for the background .dat files (static and animated) .... approaching planets, orbital views of planets, stars/suns/galaxies, death star surface, and planet atmospheric mission level surfaces, deserts, forests, mountains, oceans, city landscapes, etc. :-) Probably a lot of different .dat files.
No you still need HD textures for the ships, especially the large ones. It's just that for the really big ones those will add additional detail once you get closer to them. If you would scale the new ones up they would end up at something like 16k and more. (Looking at the asteroid possible a LOT more) That would make the OPT size ridiculous. The current HD textures don't really impact render performance, that's actually mostly done by the GPU. Issue still is the geometry of the OPTs. That's what's unfortunately being done in a single CPU thread.
So you wont get more performance out of this, just better looking details up close.
Murphy was an optimist! I am a pessimist!
And always remember that a smile is cheaper than a bullet! (District 9)
Webmaster of the X-Wing Alliance Upgrade Project

Drinkinmiester
Cadet 1st Class
Posts: 133
Joined: Sun Nov 09, 2008 9:37 pm

Post by Drinkinmiester » Tue Sep 14, 2021 5:22 pm

That is very impressive! But I gotta wonder what it does to performance? I'm not playing 20 year old games because i have the latest gaming PC, ya know?

User avatar
haui
Cadet 2nd Class
Posts: 85
Joined: Mon Apr 15, 2019 9:29 am
Contact:

Post by haui » Tue Sep 14, 2021 5:57 pm

That's a big step forward. The game looks now soooo good and that is the dot on the i :-)
It's better to burn out than to fade away .

User avatar
blue_max
XWAU Member
Posts: 1857
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Tue Sep 14, 2021 9:14 pm

Forceflow wrote:
Tue Sep 14, 2021 8:54 am
No you still need HD textures for the ships, especially the large ones. It's just that for the really big ones those will add additional detail once you get closer to them. If you would scale the new ones up they would end up at something like 16k and more. (Looking at the asteroid possible a LOT more) That would make the OPT size ridiculous. The current HD textures don't really impact render performance, that's actually mostly done by the GPU. Issue still is the geometry of the OPTs. That's what's unfortunately being done in a single CPU thread.
So you wont get more performance out of this, just better looking details up close.
100% correct.

For larger OPTs, it becomes really difficult to provide textures that have enough detail unless you increase the size of the texture to a ridiculous size, like 16K. This is a helper for those situations. The asteroid above is 10km wide and it's using 2K texture. Even flying at ~2km distance you can see the texture is badly pixelated. With the Auto Greebler, the details are "filled in" with another 2K texture as needed.

EDIT: Forgot to mention, the greeble textures are repeated over the UVs of the original texture, so it's better to use seamless textures for greebles. However, the repetition can be set to 1 and then the greeble texture is just blended with the original one time.

This does have some performance impact, I've noticed about 5-10% drop in FPS, so we can't go crazy with this shader either.

@Bman those are great ideas. In fact, at some point I'd like to be able to apply this effect to the Death Star itself.

On the other hand, as I mentioned earlier, I ended up implementing proper Normal Mapping for this effect. So we'll have that in our material system soon as well. This means that we can potentially bake the normals from OPTs with higher detail into OPTs with a lower polygon count (wherever it makes sense to do so) and then we can use the lower-poly version in-game. So we might be able to increase performance in that direction by saving some geometry.

And then, of course, there's this thing called Displacement Mapping, which might be possible in the future since DX11 supports both the Geometry Shader and the Tessellator...

Han Duo
Recruit
Posts: 5
Joined: Mon Jan 06, 2020 9:32 pm

Post by Han Duo » Wed Sep 15, 2021 7:29 pm

This is awesome! Is it possible to see a video of this in action?

User avatar
haui
Cadet 2nd Class
Posts: 85
Joined: Mon Apr 15, 2019 9:29 am
Contact:

Post by haui » Thu Sep 16, 2021 6:42 am

Displacement Mapping would be great. that will bring the game to a complete new Level.
The computers today should have enough power for this when you play in FULL-HD. OK i know the trend is playing in 4K but i think the guys who want to play in 4k will spend the money for the new hardware.
It's better to burn out than to fade away .

User avatar
blue_max
XWAU Member
Posts: 1857
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Thu Sep 16, 2021 5:22 pm

Han Duo wrote:
Wed Sep 15, 2021 7:29 pm
This is awesome! Is it possible to see a video of this in action?
Sure, I here's a quick preview:

https://www.youtube.com/watch?v=Aq17yASCbks

User avatar
Vince T
Fleet Admiral (Administrator)
Posts: 13601
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Thu Sep 16, 2021 7:16 pm

Amazing!!
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear

User avatar
rogue518
XWAU Member
Posts: 2508
Joined: Wed Jul 12, 2000 11:01 pm
Contact:

Post by rogue518 » Thu Sep 16, 2021 11:53 pm

I agree with Vince T, you can see the difference...... especially the side-by-side video portion.

Sincerely, Rogue518
'Stay in Attack formation!' Darth Vader aka: Anakin Skywalker During the 'Battle Of Yavin'

User avatar
theonegalen
Cadet 2nd Class
Posts: 52
Joined: Mon May 18, 2020 11:39 pm

Post by theonegalen » Fri Sep 17, 2021 1:05 am

Holy crap @blue_max !

You absolute wizard! Every time I think the XWA engine has been pushed to the bleeding edge and can't be pushed further, you come up with yet another giant leap forward.

User avatar
haui
Cadet 2nd Class
Posts: 85
Joined: Mon Apr 15, 2019 9:29 am
Contact:

Post by haui » Fri Sep 17, 2021 5:42 am

ok after the video i think thos is a MUST HAVE ;-)
It's better to burn out than to fade away .

Post Reply