Page 52 of 59

Re: Models by MaNGusT (AR)

Posted: 02 May 2019, 17:43
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.

Re: Models by MaNGusT (AR)

Posted: 06 May 2019, 04:09
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.

Re: Models by MaNGusT (AR)

Posted: 06 May 2019, 09:00
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.

Re: Models by MaNGusT (AR)

Posted: 06 May 2019, 10:25
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

Re: Models by MaNGusT (AR)

Posted: 07 May 2019, 03:23
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 363575 times
mikktspace
mikktspace
21 (1).jpg (44.71 KiB) Viewed 363575 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.

Re: Models by MaNGusT (AR)

Posted: 07 May 2019, 06:10
by MaNGusT
A little portion of custom shaders :lol2:
preview.png

Re: Models by MaNGusT (AR)

Posted: 07 May 2019, 16:48
by Jorzi
Nice :) Also, I see you got fog to work again :bow2:

Re: Models by MaNGusT (AR)

Posted: 07 May 2019, 17:26
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! :-)

Re: Models by MaNGusT (AR)

Posted: 10 May 2019, 12:45
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 363471 times
12.jpg

Re: Models by MaNGusT (AR)

Posted: 10 May 2019, 19:18
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 ^.^

Re: Models by MaNGusT (AR)

Posted: 10 May 2019, 19:59
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.

Re: Models by MaNGusT (AR)

Posted: 12 May 2019, 01:43
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.

Re: Models by MaNGusT (AR)

Posted: 12 May 2019, 06:27
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

Re: Models by MaNGusT (AR)

Posted: 12 May 2019, 07:41
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 363390 times

Re: Models by MaNGusT (AR)

Posted: 12 May 2019, 07:53
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..