Models by MaNGusT (AR)

Improving the artwork in Warzone2100 - not for mod discussions
User avatar
MaNGusT
Art contributor
Posts: 1039
Joined: 22 Sep 2006, 10:31
Location: Polar region, Russia

Re: Models by MaNGusT (AR)

Post by MaNGusT » 02 May 2019, 17:43

Well, new extension to PIE format just takes per-vertex normals (3 per triangle) that was generated by 3d tool and placed to OBJ, wmit saves it to pie with right xyz coords.
In wmit I calculate binormal as cross product. Need to test mirrored uv:s though if we really need this texturing technique(OS normal maps forced me to not use it and I used to :D). I have test build of pr 338.
Also, Interesting how wz calculates tangent? In the shader I re-orthogonalize tangent by normal I'm using, so it's always have right angle.
Jorzi wrote:
02 May 2019, 13:11
One problem is each program calculates smooth normals slightly differently, so this was solved by including vertex normals and bitangents in the vertex definition. Are you suggesting that this is included into the pie format?
different smooth normals only forces you to use the same tool to bake a tangent normals texture. So if you create a model using Blender, you should bake normal maps also in blender or recalculate normals for this model in another tool you use to bake textures, :-) If I understand all the stuff correctly. Anyway, all popular tools works with mikktspace code.
Forgon wrote:
02 May 2019, 14:39
@Jorzi @MaNGusT: Could you review i-NoD's proposed extension to the PIE format (PR 338)?
In a test phase. I want to incude shader that will support all the stuff.
Image

User avatar
MaNGusT
Art contributor
Posts: 1039
Joined: 22 Sep 2006, 10:31
Location: Polar region, Russia

Re: Models by MaNGusT (AR)

Post by MaNGusT » 06 May 2019, 04:09

Fixes to calculation of light are coming :ninja:
It took time to find and fix all the broken formulas in master.
12.jpg
diffuse texture is middle gray and now looks like gray not almost black as it was.
Image

i-NoD
Code contributor
Code contributor
Posts: 317
Joined: 30 Nov 2008, 00:42
Location: In the middle of nowhere

Re: Models by MaNGusT (AR)

Post by i-NoD » 06 May 2019, 09:00

Jorzi wrote:
02 May 2019, 15:49
Technical question: How will this info be passed into the shader code? In the shader, you will preferably need three vectors (normal, tangent, bitangent) to create the per-vertex normal matrix. If you have two you can of course generate the third one through the cross product, although this might cause problems with mirrored uv:s where some of the tangent spaces are left handed.
I think i-NoD already did this stuff correctly in WMIT (calculating the tangents with mikktspace?)when we were testing the wzm format, but I think the tangents were at that time also exported straight into warzone. However, if the pie format contains only normals, then that code should be included in warzone as well.
My MR is only for per-vertex normals, without tangent and bitangent. It's minimally invasive to wz code, compared to resounding success of WZM :lol2:

Anyway, it can be used to pass down normal's smoothing groups that MaNGusT is talking about since forever. Also, one can also use this for something like that: Normal Mapping Without Precomputed Tangents

Edit: Latest WMIT is capable of saving NORMALS directive in PIE format, and those pies can be tested against my MR.

User avatar
MaNGusT
Art contributor
Posts: 1039
Joined: 22 Sep 2006, 10:31
Location: Polar region, Russia

Re: Models by MaNGusT (AR)

Post by MaNGusT » 06 May 2019, 10:25

Yeah, there are 3 ways to implement tangent-space normal maps with PR338:

1) the easiest one. Calculate tangent and binormal in vertex shader.
-No need to rise up shader's version
-No mirrored uv;s allowed
-Tangent texture looks very approximately and has artifacts

2) Compute tangent and binormal in fragment shader via dFdx dFdy.
-OGL 3.2 required
-Mirrored uv;s allowed
-Texture looks good
-Has impact to gpu performance

3)Compute tangent and binormal in wz by MikkTSpace code.
-Requires update to PR338
-No need to rise up shader's version
-Mirrored uv;s allowed
-Texture looks good
Image

User avatar
MaNGusT
Art contributor
Posts: 1039
Joined: 22 Sep 2006, 10:31
Location: Polar region, Russia

Re: Models by MaNGusT (AR)

Post by MaNGusT » 07 May 2019, 03:23

This shows what Jorzi was talking about. Artifacts happen when baking and rendering algorithms aren't synchronized.
12 (1).jpg
dFdx dFdy method
12 (1).jpg (46.44 KiB) Viewed 1949 times
21 (1).jpg
mikktspace
21 (1).jpg (44.71 KiB) Viewed 1949 times
Artifacts are visible only when you zoom in the camera or object is just big.
So my vote goes to mikktspace algorithm just because it's universal and kinda works perfectly with most of tools that generate ts normal maps.
Last edited by MaNGusT on 07 May 2019, 17:28, edited 1 time in total.
Image

User avatar
MaNGusT
Art contributor
Posts: 1039
Joined: 22 Sep 2006, 10:31
Location: Polar region, Russia

Re: Models by MaNGusT (AR)

Post by MaNGusT » 07 May 2019, 06:10

A little portion of custom shaders :lol2:
preview.png
Image

Jorzi
Regular
Regular
Posts: 1987
Joined: 11 Apr 2010, 00:14

Re: Models by MaNGusT (AR)

Post by Jorzi » 07 May 2019, 16:48

Nice :) Also, I see you got fog to work again :bow2:
ImageImage
-insert deep philosophical statement here-

User avatar
MaNGusT
Art contributor
Posts: 1039
Joined: 22 Sep 2006, 10:31
Location: Polar region, Russia

Re: Models by MaNGusT (AR)

Post by MaNGusT » 07 May 2019, 17:26

Jorzi wrote:
07 May 2019, 16:48
Nice :) Also, I see you got fog to work again :bow2:
Sadly to say but not :cry:
It's just reshade tool. Works perfectly with wz btw but available only on windows. It has very nice shaders that could add more in-game "atmosphere" and exclude the feeling that game's effects, animation and overall graphic are very clumsy and outdated. Try it! :-)
Image

User avatar
MaNGusT
Art contributor
Posts: 1039
Joined: 22 Sep 2006, 10:31
Location: Polar region, Russia

Re: Models by MaNGusT (AR)

Post by MaNGusT » 10 May 2019, 12:45

First results with updated PR338 and tangent space normal maps. Works pretty well, need to fix some bugs though.
11.jpg
12 (1).jpg
12 (1).jpg (94.23 KiB) Viewed 1845 times
12.jpg
Image

User avatar
NoQ
Special
Special
Posts: 6225
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Models by MaNGusT (AR)

Post by NoQ » 10 May 2019, 19:18

Jorzi wrote:
07 May 2019, 16:48
Nice :) Also, I see you got fog to work again :bow2:
Just in case, there's my old patch in #4292, maybe somebody will eventually be able to make sense out of it. Fixing fog is much more important than secondary orders imo ^.^

Forgon
Code contributor
Code contributor
Posts: 289
Joined: 07 Dec 2016, 22:23

Re: Models by MaNGusT (AR)

Post by Forgon » 10 May 2019, 19:59

NoQ wrote:
10 May 2019, 19:18
[...]
Just in case, there's my old patch in #4292, maybe somebody will eventually be able to make sense out of it. Fixing fog is much more important than secondary orders imo ^.^
Fog was removed from this game in ticket #2920 in favor of tile lighting
indicating map exploration and visibility.
You should probably make sure to understand the history of this feature
before trying to reintroduce it.

User avatar
NoQ
Special
Special
Posts: 6225
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Models by MaNGusT (AR)

Post by NoQ » 12 May 2019, 01:43

This isn't about fog of war (i don't care about fog of war), it's about the purely visual color of the sky.

User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 817
Joined: 26 Sep 2016, 19:56

Re: Models by MaNGusT (AR)

Post by Berserk Cyborg » 12 May 2019, 06:27

NoQ wrote:
12 May 2019, 01:43
it's about the purely visual color of the sky.
The current result is far superior. It turns the whole desert into shiny gold dirt! With "fog" enabled it turns into a real blocky mess, but at least this looks cool.
Screenshot at 2019-05-11 19-35-38.png

i-NoD
Code contributor
Code contributor
Posts: 317
Joined: 30 Nov 2008, 00:42
Location: In the middle of nowhere

Re: Models by MaNGusT (AR)

Post by i-NoD » 12 May 2019, 07:41

Berserk Cyborg wrote:
12 May 2019, 06:27
The current result is far superior. It turns the whole desert into shiny gold dirt! With "fog" enabled it turns into a real blocky mess, but at least this looks cool.
That fog was totally golden! :)

Now check what WZ's random fog generator gives in my case:
fog.jpg
fog.jpg (44.1 KiB) Viewed 1764 times

i-NoD
Code contributor
Code contributor
Posts: 317
Joined: 30 Nov 2008, 00:42
Location: In the middle of nowhere

Re: Models by MaNGusT (AR)

Post by i-NoD » 12 May 2019, 07:53

Jorzi wrote:
02 May 2019, 15:49
Technical question: How will this info be passed into the shader code? In the shader, you will preferably need three vectors (normal, tangent, bitangent) to create the per-vertex normal matrix. If you have two you can of course generate the third one through the cross product, although this might cause problems with mirrored uv:s where some of the tangent spaces are left handed.
I think i-NoD already did this stuff correctly in WMIT (calculating the tangents with mikktspace?)when we were testing the wzm format, but I think the tangents were at that time also exported straight into warzone. However, if the pie format contains only normals, then that code should be included in warzone as well.
Code was ported from WMIT into PR, so one can now have access to custom per-vertex normals and tangent+handedness value as vec4. WMIT can save PIE with normals and there is a windows WZ test build available..
Last edited by i-NoD on 12 May 2019, 23:13, edited 1 time in total.

Post Reply