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 »

My suggestion for a material system that should cover everything including glow effects.
The material would of course be included in the .pie file, while the light is set up for the map/tileset/game
You do not have the required permissions to view the files attached to this post.
ImageImage
-insert deep philosophical statement here-
User avatar
MaNGusT
Art contributor
Posts: 1154
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Lighting

Post by MaNGusT »

Jorzi wrote:My suggestion for a material system that should cover everything including glow effects.
The material would of course be included in the .pie file, while the light is set up for the map/tileset/game
are you going to use specular textures?
I use them and also think about specular color textures because painted parts of an object shines with mix of dye color.
Image
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

I've been thinking about it, although for most models, simply using the diifuse texture for specularity works surprisingly well, resulting in a typically metallic look. Structures, however, seem to need more advanced spec maps, since they're made up of multiple materials (metals, concrete, paint, glass etc..).

Making specular maps isn't too hard though, since you can essentially just start from your base color texture, change some colors and brightnesses around a bit, increase contrast, and multiply the ao pass over the result...
ImageImage
-insert deep philosophical statement here-
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

After fiddling around in SafetyOff's new export tool WMIT, I took a look at the shaders used both in WMIT and warzone trunk. I then rewrote the tcmask blending so that it better preserves the brightness variations of the base texture, resulting in a more natural look imo.
Here's the changed line of code:

Code: Select all

gl_FragColor = ((1.0 - mask.a) * colour + (teamcolour * colour * 2.1) * mask.a) * gl_Color;
Looking at the code, I think I might just have the knowledge necessary to add normal map support.
However, I have a few questions:
-I can see that the Shader has two textures, Texture0 is color and Texture1 is tcmask. How hard is it to add more textures to the shader and where do they need to be specified?
-Is it possible to get the object(droid/building/feature) orientation vector into the fragment shader?
You do not have the required permissions to view the files attached to this post.
ImageImage
-insert deep philosophical statement here-
User avatar
MaNGusT
Art contributor
Posts: 1154
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Lighting

Post by MaNGusT »

Jorzi wrote:Image
for what terrain type can be used the purple camo? XD
Image
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

You want me to make a tileset? :twisted:

Anyway is it possible to change the teamcolor in WMIT or is it hardcoded?
ImageImage
-insert deep philosophical statement here-
User avatar
MaNGusT
Art contributor
Posts: 1154
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Lighting

Post by MaNGusT »

Jorzi wrote:Anyway is it possible to change the teamcolor in WMIT or is it hardcoded?
in the end of the post
You want me to make a tileset?
I don't think that it's the good idea. :D The only thing I can imagine as a new tileset is jungles or forest but I have a great plans on expanding the existed tilesets. also, FlaME doesn't support the new terrain textures, so plans are still only plans.
Last edited by MaNGusT on 12 May 2011, 18:01, edited 2 times in total.
Image
User avatar
Goth Zagog-Thou
Regular
Regular
Posts: 1582
Joined: 06 Jan 2007, 08:08
Location: Delta Base

Re: Lighting

Post by Goth Zagog-Thou »

You guys continue to rock. Well done! Looks great!
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Lighting

Post by Jorzi »

A small optimization (if it even matters on modern hardware) using the built-in function mix:

Code: Select all

gl_FragColor = mix(colour ,(teamcolour * colour * 2.1), mask.a) * gl_Color;
ImageImage
-insert deep philosophical statement here-
User avatar
MaNGusT
Art contributor
Posts: 1154
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Lighting

Post by MaNGusT »

Jorzi wrote:A small optimization (if it even matters on modern hardware) using the built-in function mix:

Code: Select all

gl_FragColor = mix(colour ,(teamcolour * colour * 2.1), mask.a) * gl_Color;
better post in this thread -> viewtopic.php?f=33&t=4951&hilit=TCMask :wink:
Jorzi wrote:-I can see that the Shader has two textures, Texture0 is color and Texture1 is tcmask. How hard is it to add more textures to the shader and where do they need to be specified?
viewtopic.php?f=33&t=7048&hilit=TCMask
Image
cybersphinx
Inactive
Inactive
Posts: 1695
Joined: 01 Sep 2006, 19:17

Re: Lighting

Post by cybersphinx »

If it's about something in our code, best make a ticket.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Lighting

Post by Per »

Jorzi wrote:After fiddling around in SafetyOff's new export tool WMIT, I took a look at the shaders used both in WMIT and warzone trunk. I then rewrote the tcmask blending so that it better preserves the brightness variations of the base texture, resulting in a more natural look imo.
Cool. I will commit your new version, then.
Jorzi wrote:Looking at the code, I think I might just have the knowledge necessary to add normal map support.
However, I have a few questions:
-I can see that the Shader has two textures, Texture0 is color and Texture1 is tcmask. How hard is it to add more textures to the shader and where do they need to be specified?
Let me have a look.
Jorzi wrote:-Is it possible to get the object(droid/building/feature) orientation vector into the fragment shader?
Something like the attached patch should give you access to this information.
You do not have the required permissions to view the files attached to this post.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Lighting

Post by Per »

Attached patch should also give you access to an additional texture to be used for normal maps. It adds support for an additional, optional directive in the PIE file called NORMALMAP which can be added after the TEXTURE directive, like this:
PIE 2
TYPE 10200
TEXTURE 0 page-12-player-buildings.png 256 256
NORMALMAP 0 page-12-player-buildings-normal.png
LEVELS 1
LEVEL 1
POINTS 69
(The zero parameter is just a hack to make it easier to parse...)

Not much time right now, so I have not tested the patch other than check that it compiles and runs... Hope this helps.
You do not have the required permissions to view the files attached to this post.
Safety0ff
Trained
Trained
Posts: 397
Joined: 18 Jul 2009, 23:23

Re: Lighting

Post by Safety0ff »

Jorzi wrote:You want me to make a tileset? :twisted:

Anyway is it possible to change the teamcolor in WMIT or is it hardcoded?
It is hardcoded at the moment, but you can workaround it by hard coding a different color into the shader.
Safety0ff
Trained
Trained
Posts: 397
Joined: 18 Jul 2009, 23:23

Re: Lighting

Post by Safety0ff »

Per wrote:Cool. I will commit your new version, then.
Before this is done, I think we should compare the differences on a cube, whose diffuse texture is a gradient from white to black in the horizontal direction and tcmask texture is a gradient of alpha values in the vertical direction.
EDIT: These are the results I am getting here (border is selected tcmask color):
snapshotof.png
snapshotns.png
snapshotn2.png
You do not have the required permissions to view the files attached to this post.