Models by MaNGusT (AR)

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

Re: Models by MaNGusT (AR)

Post by MaNGusT »

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:11One 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: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Models by MaNGusT (AR)

Post by MaNGusT »

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: 318
Joined: 30 Nov 2008, 00:42
Location: In the middle of nowhere

Re: Models by MaNGusT (AR)

Post by i-NoD »

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: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Models by MaNGusT (AR)

Post by MaNGusT »

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: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Models by MaNGusT (AR)

Post by MaNGusT »

This shows what Jorzi was talking about. Artifacts happen when baking and rendering algorithms aren't synchronized.
dFdx dFdy method
dFdx dFdy method
12 (1).jpg (46.44 KiB) Viewed 321100 times
mikktspace
mikktspace
21 (1).jpg (44.71 KiB) Viewed 321100 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: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Models by MaNGusT (AR)

Post by MaNGusT »

A little portion of custom shaders :lol2:
preview.png
Image
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Models by MaNGusT (AR)

Post by Jorzi »

Nice :) Also, I see you got fog to work again :bow2:
ImageImage
-insert deep philosophical statement here-
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Models by MaNGusT (AR)

Post by MaNGusT »

Jorzi wrote: 07 May 2019, 16:48Nice :) 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: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Models by MaNGusT (AR)

Post by MaNGusT »

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 320996 times
12.jpg
Image
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Models by MaNGusT (AR)

Post by NoQ »

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: 298
Joined: 07 Dec 2016, 22:23

Re: Models by MaNGusT (AR)

Post by Forgon »

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: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Models by MaNGusT (AR)

Post by NoQ »

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: 938
Joined: 26 Sep 2016, 19:56

Re: Models by MaNGusT (AR)

Post by Berserk Cyborg »

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: 318
Joined: 30 Nov 2008, 00:42
Location: In the middle of nowhere

Re: Models by MaNGusT (AR)

Post by i-NoD »

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 320915 times
i-NoD
Code contributor
Code contributor
Posts: 318
Joined: 30 Nov 2008, 00:42
Location: In the middle of nowhere

Re: Models by MaNGusT (AR)

Post by i-NoD »

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