Lighting

Improving the artwork in Warzone2100 - not for mod discussions
Safety0ff
Trained
Trained
Posts: 397
Joined: 18 Jul 2009, 23:23

Re: Lighting

Post by Safety0ff »

Jorzi wrote:Since the left and right propulsions use separate models, this means that, unless I make a separate normal map for the right and the left side, one side will have a flipped x-axis. Now this could be solved in three ways:
How about this as a solution:
Using tangent space normal maps and reusing the models by flipping the axis and reversing the windings.

For now you could just do the tangent space change until there's code support for reusing left and right propulsion models.
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

That would still require vertex normal interpolation, which I don't know how to do...
The coordinate transformation will also be more complicated but I can probably figure that out by looking at examples...

EDIT: Another solution to the problem would be simply ignoring it, since the shading error isn't really noticeable by mere mortals anyway.
EDIT2: Added screenshot, the new transport model is shaded only by the normal map ;)
Attachments
wz2100-20110528_082538-SUB_1_1S.jpg
ImageImage
-insert deep philosophical statement here-
User avatar
Rman Virgil
Professional
Professional
Posts: 3812
Joined: 25 Sep 2006, 01:06
Location: USA

Re: Lighting

Post by Rman Virgil »

.

Jorzi did you remove the MG by text editing ?

I was able to open your .pie in PieSlicer & see the connector. I'm not sure though if I removed it, re-did it below the cockpit & re-saved if it would turn-out correct. :3 I had to make changes to the .pie header to be able to open it in PieSlicer & I'm not sure that after the save and reverting the header back there wouldn't be some unforeseen effect.
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

The connector should probably be at (0,0,0) right now, which is at landing gear level. I tried to put it at the correct coordinates I read from blender, but it resulted in the mg floating above the transport...

EDIT: from trial and error I came to the conclusion that 0.0000 -108.0000 18.0000 are the correct values for the connector. Now we just need to know how to specify that the turret should be upside down...
ImageImage
-insert deep philosophical statement here-
User avatar
Rman Virgil
Professional
Professional
Posts: 3812
Joined: 25 Sep 2006, 01:06
Location: USA

Re: Lighting

Post by Rman Virgil »

.

Connector in PieSlicer.... O_o
Attachments
New Transport in PieSlicer.jpg
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

umm, the C1-cross? did you try manually changing it to 0.0000 -108.0000 18.0000?
Does pieslicer support pie 3? because apparently the program can read the file despite the vertices being floating-point.
What confuses me is, while the vertices are all in a y-up coordinate system, I had to specify the connector with z up and y-axis flipped :S
ImageImage
-insert deep philosophical statement here-
User avatar
Rman Virgil
Professional
Professional
Posts: 3812
Joined: 25 Sep 2006, 01:06
Location: USA

Re: Lighting

Post by Rman Virgil »

Jorzi wrote:umm, the C1-cross? did you try manually changing it to 0.0000 -108.0000 18.0000?
Yes... & no.
Does pieslicer support pie 3? because apparently the program can read the file despite the vertices being floating-point.
I changed the header. PieSlicer was coded for the original retail .pies
What confuses me is, while the vertices are all in a y-up coordinate system, I had to specify the connector with z up and y-axis flipped :S


:roll:

For comparison - the CAM Transport.

(Have to get ready for work so must put off further investigation for now. Tomorrow I'll play around with it some more & see if I can get a connector change in-game.)
.
Attachments
CAM Transport in PieSlicer001.jpg
CAM Transport in PieSlicer002.jpg
Safety0ff
Trained
Trained
Posts: 397
Joined: 18 Jul 2009, 23:23

Re: Lighting

Post by Safety0ff »

Jorzi wrote:I had to specify the connector with z up and y-axis flipped :S
http://developer.wz2100.net/wiki/PIE_format
stiv
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 876
Joined: 18 Jul 2008, 04:41
Location: 45N 86W

Re: Lighting

Post by stiv »

from trial and error I came to the conclusion that 0.0000 -108.0000 18.0000 are the correct values for the connector.
There was some discussion earlier about the connector coordinates being truncated (not rounded) to integers due to the requirements of the new networking code.
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

Ok, well artistically, that isn't such a problem. The floating point coordinates are most important for things like circles being circular etc...
ImageImage
-insert deep philosophical statement here-
Safety0ff
Trained
Trained
Posts: 397
Joined: 18 Jul 2009, 23:23

Re: Lighting

Post by Safety0ff »

Safety0ff wrote:...and reusing the models by flipping the axis and reversing the windings.
Note: This part is only for convenience to the artist / not creating/loading 2 model files.
Jorzi wrote:Ok, well artistically, that isn't such a problem. The floating point coordinates are most important for things like circles being circular etc...
And polies lining up such that there aren't visible seams... (This is an issue seen in the current models).

Anyways, we plan on fixing this (for graphics purposes, the simulation will still use the truncated connectors).
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

I've been looking into implementing tangent space normal mapping, and have come to the conclusion that the tangent needs to be pre-calculated and stored for each vertex so that it can be accessed in the vertex shader (just like the normal).
The tangent vector should be orthogonal to the normal and parallell with the u-axis of the uv-map.

How hard is it to implement this?
Also, why are the normals flat and not gouraud-or phong-interpolated and can I change this in the vertex/fragment shader?
ImageImage
-insert deep philosophical statement here-
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Lighting

Post by Per »

The normals are calculated in a very naive manner. This should be improved one day. I think the right place to do this is in the C++ code.

You want a tangent vector to be pre-calculated and available as a vertex attribute? I guess that should not be too hard. But this should also be possible to calculate in the shader, though? Just calculate from the cross product of the vertex normal? Or am I missing something?
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

The problem is, the normal defines a tangent plane, which means an infinite number of tangents. I need exactly the one that follows the direction of the texture's u-axis. This way, the normal defines the z-axis of the tangent space, the tangent defines the x-axis, and I can calculate the y-axis using the cross product.
ImageImage
-insert deep philosophical statement here-
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Lighting

Post by MaNGusT »

Jorzi wrote:Also, why are the normals flat and not gouraud-or phong-interpolated?
If you will look into the original source code, you'll see that there was gouraud shading and also was the special flag for a polygons +0x1000 Gouraud Shading but someone had cut it. :(

Gouraud shading is the base for the smooth groups but we need only a 1 smooth group for a mesh like it's done to a map normals in the current master builds(it's very noticeable if you don't specify the terrain textures, you see the white shaded terrain).
Image
Post Reply