Page 51 of 53

Re: Models by MaNGusT (AR)

Posted: 31 Mar 2019, 21:11
by MaNGusT
Well, I could until my English level allows. Just materials is no longer working and missing some info about pie flags for gfx effect that Cyp did for me

Code: Select all

Change new PIE modes to use flags:
-Premultiplied uses TYPE xx4 
-Additive uses TYPE xx1/xx2 to dis/enable

-TYPE x0x (to not face the camera)
-Roll to camera uses TYPE x1x (to rotate to the camera like a cylinder)
-Pitch to camera uses TYPE x2x (to rotate like a sphere)
You can see use of it with ARmod when buildings destroyed and when minipod fires.
EDIT: What would be the best way to re-implement support for shininess in the pie files for your purposes?
As far as I understand after reading of comments in commit, the only way to re-implement it is to put it into special grayscale texture or unused alpha channel and use via shader. :hmm:

Re: Models by MaNGusT (AR)

Posted: 31 Mar 2019, 22:48
by MaNGusT
well, I still can control shininess as global parameter via shader. It's enough for current use.

Re: Models by MaNGusT (AR)

Posted: 03 Apr 2019, 22:10
by Forgon
MaNGusT wrote:
31 Mar 2019, 21:11
Well, I could until my English level allows. Just materials is no longer working and missing some info about pie flags for gfx effect that Cyp did for me

Code: Select all

Change new PIE modes to use flags:
-Premultiplied uses TYPE xx4 
-Additive uses TYPE xx1/xx2 to dis/enable

-TYPE x0x (to not face the camera)
-Roll to camera uses TYPE x1x (to rotate to the camera like a cylinder)
-Pitch to camera uses TYPE x2x (to rotate like a sphere)
You can see use of it with ARmod when buildings destroyed and when minipod fires.
[...]
Thank you. Could you check the pull request I created based on your comment,
PR 295?

Re: Models by MaNGusT (AR)

Posted: 03 Apr 2019, 22:37
by MaNGusT
Forgon wrote:
03 Apr 2019, 22:10
Thank you. Could you check the pull request I created based on your comment PR 295?
Seems that now everything is right. Note, to use premultiplied mode when making explosions an artist should place fire effect to rgb channels and smoke to alpha channel. Cyp had created an easy commandline tool for this called premult, but it also can be done by gimp. We use the same technique with normal maps and specular maps. :)

Re: Models by MaNGusT (AR)

Posted: 04 Apr 2019, 22:07
by Jorzi
I think having global shininess etc parameters are perfectly fine. If we need support for a model with exceptional parameters beyond what the textures can a chieve, we can simply define a new custom shader.

Re: Models by MaNGusT (AR)

Posted: 04 Apr 2019, 22:33
by MaNGusT
Jorzi wrote:
04 Apr 2019, 22:07
I think having global shininess etc parameters are perfectly fine. If we need support for a model with exceptional parameters beyond what the textures can a chieve, we can simply define a new custom shader.
Maybe one day we will create shaders for different material types. :-)

Re: Models by MaNGusT (AR)

Posted: 16 Apr 2019, 15:44
by MaNGusT
I've got an idea how to finally introduce tangent-space normal maps into wz engine without changing model format.
Few years ago Vexed showed me that wz's renderer already supported smooth shading technique. This feature is enabled only for terrain because its mesh has enough polygons to look good when shaded. Units have very lowpoly meshes( just cubes) and shading causes lighting artifacts on them, so it's disabled.
Currently wz without textures looks like this.
12 (1).jpg
The idea is to add a new pie3 type flag that will enable shading on a model. If shading is enabled new models will look so, like all triangles are placed into one smooth group in 3d editor and don't have hard edges.
21 (1).jpg
21 (1).jpg (20.05 KiB) Viewed 1969 times
11.jpg
11.jpg (24.96 KiB) Viewed 1968 times
This shading technique will allow us to precalculate vertex normals to smooth co-joined triangles and could be used in shader calculations for tangent-space normal mapping(and many other good stuff).
cons:
-Artists will be limited a bit when creating models - can't use 90* angles.
-New models will "eat" a bit more triangles to avoid 90* angles.
-Increased loading time into a map.
pros:
-Will be significantly increased modelling and texturing time.
-New models will be much more detailed via normal map.
-Tangent-space normal maps are easily editable in 2d editors like gimp, photoshop, xnormal and others.
-No need in swap to a completely new model format.
-Fits wz's step-by-step development flow.

I want to know what do current coders think about this idea? Should we prepare a patch for the master branch? Is anybody interested in such update? I don't ask you to make this, just some searching.:)

Re: Models by MaNGusT (AR)

Posted: 22 Apr 2019, 02:58
by MaNGusT
11.jpg
Artifact

Re: Models by MaNGusT (AR)

Posted: 23 Apr 2019, 01:47
by Slye_Fox
Awesome.

Re: Models by MaNGusT (AR)

Posted: 01 May 2019, 00:19
by MaNGusT
I'm writing a shader that could replace current tcmask shader in master. It will improve specular reflections of light and also return back support for specular maps and normal maps. Normal maps will be in tangent-space as standard, so optional per-vertex normals directive is needed. Old models will look same as before.
All these changes will make life of wz's artists easier, so all that a new artist will need - make a model, adjust it in WMIT and place to the game. No need of special knowledge and skills about shaders or texture's limitations, just learn some lessons on the internet about standard low-poly modelling and texturing technique.
Spoiler:

Re: Models by MaNGusT (AR)

Posted: 01 May 2019, 15:52
by Jorzi
Good stuff man :)

Re: Models by MaNGusT (AR)

Posted: 02 May 2019, 03:12
by MaNGusT
Rewrited all light models to work in tangent space and now difference is clearly visible.
12 (1).jpg
Phong
12.jpg
Blinn
21 (1).jpg
Gauss
Blinn's light is ideal for rough surfaces while Gaussian light is good for metal surfaces. Phong's light works good with plastic surfaces and show highlights approximately between Gauss and Blinn but too untruly at some view angles, only front-facing specular reflections look good.

Re: Models by MaNGusT (AR)

Posted: 02 May 2019, 13:11
by Jorzi
Hi
I remember we did some tangent space stuff successfully in the wzm branch. 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?

Re: Models by MaNGusT (AR)

Posted: 02 May 2019, 14:39
by Forgon
@Jorzi @MaNGusT:
Could you review i-NoD's proposed extension to the PIE format (PR 338)?

Re: Models by MaNGusT (AR)

Posted: 02 May 2019, 15:49
by Jorzi
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.