Lighting

Improving the artwork in Warzone2100 - not for mod discussions
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

Yes, by specmap I meant specular color texture.

Also, where can I set the material and light constants like light position/direction, specular, diffuse and ambient?
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, where can I set the material and light constants like light position/direction, specular, diffuse and ambient?
viewtopic.php?f=33&t=7250#p75835
Image
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

@SafetyOff: I just realized that including normals, tangents and bitangents(aka binormals) into the file format turns out to be a bad idea after all. Warzone will need to be able to recalculate it anyway, because the main reason we need tangent space is for bone deformation of geometry when animating stuff like cyborgs. Since the code needs to get into warzone sooner or later, there is no longer any reason to store the data in the file format.
ImageImage
-insert deep philosophical statement here-
Safety0ff
Trained
Trained
Posts: 397
Joined: 18 Jul 2009, 23:23

Re: Lighting

Post by Safety0ff »

Jorzi wrote:@SafetyOff: I just realized that including normals, tangents and bitangents(aka binormals) into the file format turns out to be a bad idea after all.
Why? (You only need two of those, or a quaternion in the format).

I suppose once silhouette computation is added it can share some data.
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Lighting

Post by MaNGusT »

deleted
Last edited by MaNGusT on 06 Sep 2011, 00:44, edited 1 time in total.
Image
Safety0ff
Trained
Trained
Posts: 397
Joined: 18 Jul 2009, 23:23

Re: Lighting

Post by Safety0ff »

MaNGusT wrote:Safety0ff, are you talking with yourself? XD
Umm, no. O_o
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

The thing is, we want normalmaps to display correctly for mirrored uv:s. They should do this if the tangent always follows the u(horizontal on the texture) axis and the binormal always follows the v axis. However, if we calculate the binormal through the cross product, mirrorirng on the u-axis will flip both the tangent and binormal, while mirroring on the v-axis will flip neither. Therefore we need to calculate all three vectors separately, and as I said, if we are to have deformation at any point in the future, they will have to be calculated at rendertime (non-deforming objects can of course have them precalculated, but the code needs to be in warzone anyway).
ImageImage
-insert deep philosophical statement here-
Safety0ff
Trained
Trained
Posts: 397
Joined: 18 Jul 2009, 23:23

Re: Lighting

Post by Safety0ff »

Just to make sure that we are on the same page: we're not talking about mirroring models in warzone, we're only talking about the uv's being mirrored for symmetric parts of the model.

Anyways, the solution that seems to be used by others is an additional sign parameter on the tangent vector.

(sign stored in w component of tangent vector:) http://forum.unity3d.com/threads/65859- ... post420888

(section 1.4) http://wiki.blender.org/index.php/Dev:S ... ormal_Maps

Besides, if the calculated normals don't match up with the normals used by the renderer things could potentially look different.
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Lighting

Post by MaNGusT »

well, You've found the solution. Who will implement it? :-)
Image
User avatar
Buginator
Professional
Professional
Posts: 3285
Joined: 04 Nov 2007, 02:20

Re: Lighting

Post by Buginator »

Safety0ff wrote:
Per wrote: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.
I disagree, vertex normals should be incorporated into the model format, this way we can have the model editor do all the heavy lifting, and the same normals that are used in the editor are used in game (this matters for tangent space normal mapping).

Btw, gouraud shading is turned on, but like per said, the normals are specified in such a way that it is the same as if it used flat shading.
IMO, that is the only sane approach, by having it all in the model (texture)format. Open up some .dds files for some major games and look. :)
In fact, that is what most other game companies do with their games, so let's not reinvent the wheel with more home brewed code.

If need be, we can also have dudv maps, but, currently, I only plan that for water. :ninja:
and it ends here.
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Lighting

Post by MaNGusT »

Buginator wrote: Open up some .dds files for some major games and look. :)
In fact, that is what most other game companies do with their games, so let's not reinvent the wheel with more home brewed code
Can we use dds format for wz?
Image
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

Hmm, maybe they only transform the coordinate system according to the deformation instead of actually recalculating stuff? They seemed to do that in an article I read about using bone animation with object space(!) normal maps. Anyway, I can't really brag about having any experience (at all :/ ) about these things. In fact, anything I know about glsl shaders is merely what I learned while rewriting them for warzone :P
I'm also afraid that home brewed code might be one of my specialities, as well as reinventing the wheel :P
ImageImage
-insert deep philosophical statement here-
Safety0ff
Trained
Trained
Posts: 397
Joined: 18 Jul 2009, 23:23

Re: Lighting

Post by Safety0ff »

MaNGusT wrote:Can we use dds format for wz?
Short answer is: not as the primary texture format (i.e. not the default/packaged texture format).

To use (dxt compressed) dds textures as our primary format we would need to include a dxt decompressor to allow computers whose drivers and / or cards do not support dxt compression.

Since there are patent issues with dxt algorithms, we cannot include them.

The patent issue is also why some software (e.g. X11, open source drivers) do not enable the dxt algorithms by default (people have to enable it manually).

I think Spring TA requires people to enable these functions.
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

Can anyone tell me the default values of the MATERIALS diective in the .pies? The wiki says "MATERIALS 1.0 1.0 1.0 1.0 1.0 1.0 20", are these defaults or just random examples?
ImageImage
-insert deep philosophical statement here-
Safety0ff
Trained
Trained
Posts: 397
Joined: 18 Jul 2009, 23:23

Re: Lighting

Post by Safety0ff »

Jorzi wrote:Can anyone tell me the default values of the MATERIALS diective in the .pies? The wiki says "MATERIALS 1.0 1.0 1.0 1.0 1.0 1.0 20", are these defaults or just random examples?
Default values are 1.0 for the first 9 (ambient, diffuse, specular, respectively,) and 10 for the shininess.
Post Reply