All about splatting specular SMF - SSMF tutorial

All about splatting specular SMF - SSMF tutorial

Tutorials & Resources For Mappers

Moderator: Moderators

User avatar
Beherith
Moderator
Posts: 4932
Joined: 26 Oct 2007, 16:21

All about splatting specular SMF - SSMF tutorial

Post by Beherith » 05 Aug 2010, 17:34

New .82 spring is bringing some amazingly powerful tools for mappers.
All of this is made possible with Kloot's amazing SSMF shader.

The first is Specular mapping.
Specular mapping specifies the shininess of the whole map. The image specified will be streched over the whole map.

The specular map image is an RGBA image (sizes should be power of two) that gets streched over the whole map.

The color component in the RGBA image will specify the color of the specular reflections. Since the specular color gets added to the original map texture color, so you should make it fully black where you dont want specular, and some very dark color where you do want it.

The alpha channel specifies the exponent of the specular reflection. This means 'shininess'. A value of 0 means the exponent is 1, a value of 255 means 16, which is a more polished, smooth surface.

Splat mapping:
This is an evolution of the detail texture. Basically, you have 4 detail textures, and you choose where to apply each one with the distribution map.

How do you do this? The complexity of this method arises from performance reasons. All 4 detail textures reside in 1 image, and all 4 distribution maps lie in another.

The detail textures: These must be 8 bit greyscale (sorry, no color :( ), and you have to place each in a different channel of an RGBA image. The first greyscale detail texture goes into the red channel, the second into green, the third into blue and the fourth into alpha.

The same applies to the distribution maps, all 4 go into one RGBA image, as described above.

Where the corresponding channel of the detail texture map is 255 (full color or alpha) the detail texture will be painted on in full. Where it is 0, that detail texture wont be visible.

SMD parameters:

Code: Select all

[MAP]
{
	Description=Moor_v2 by [teh]Beherith, for up to 16 players. mysterme@gmail.com;
	TidalStrength=21;
	Gravity=115;
	MaxMetal=1;
	ExtractorRadius=90;
	MapHardness=185;
	AutoShowMetal=1;
	Detailtex=detailtex.bmp;
	SpecularTex=specularmap.bmp;
	SplatDistrTex=splatdistribution.tga;
	splatDetailTex=splattex.tga;


	
 [SPLATS] {
    SplatTexScales =0.006 .006 0.006 0.006;
    SplatTexMults = 0.3 .3 0.2 0.5;
  }
}
Detailtex
The old detail texture, will be used to fall back on in case SSMF isnt available or disabled in your current rendering mode. (SSMF needs shadows on). If unspecified, will use spring default detail texture.

SpecularTex
This is your specular texture. An RGBA image with power of two (128, 512, 1024, ...) dimensions. If unspecified, SSMF will not be enabled. So if you want to use splatting but not specular, you still need an empty black image (preferably 1 by 1 pixel size).

SplatDistrTex
The detail distribution texture. A power of 2 sized RGBA image, with the areas where you want a specific detail texture applied marked with color for each channel.

SplatDetailTex
An RGBA power of 2 sized image where each channel is a greyscale detail texture, whose distribution over the map will be specified by SplatDistrTex

SplatTexScales

Specifies the resolution at which each detail tex will be tiled on. Defaults to 0.02 0.02 0.02 0.02. Lower values mean lower resolution.

SplatTexMults
Specifies the intensity a texture will be overlayed with. Values of 0 means that the corresponding textures wont be painted at all. Defaults to 1 1 1 1.

Example splatdetailtex:
Image
Note how the first is a snowy detail, the second is rocky, the third is like frozen ground. Then they get combined into the full splat detail texture.

Example Splatdistrtex:
Image
This is the distribution of my map Melt. It shows the snowy areas in red, the rocky bits in green and the frozen ground in blue.

Things possible with this are, but not limited to:
Image

Image

Image
0 x

Kloot
Spring Developer
Posts: 1856
Joined: 08 Oct 2006, 16:58

Re: All about splatting specular SMF - SSMF tutorial

Post by Kloot » 05 Aug 2010, 17:54

Addendum: SSMF maps can also reflect the sky above them.

Code: Select all

[MAP] {
    ...
    skyReflectModTex=skyReflectModTex.png;
}
This texture must be the same size as specularTex. If it is defined, then the diffuse color of the map is linearly mixed per-channel with the color of the sky, with skyReflectModTex providing the RGB mixing factors.
0 x

User avatar
KaiserJ
Community Representative
Posts: 3113
Joined: 08 Sep 2008, 22:59

Re: All about splatting specular SMF - SSMF tutorial

Post by KaiserJ » 05 Aug 2010, 18:58

Image
0 x

User avatar
Beherith
Moderator
Posts: 4932
Joined: 26 Oct 2007, 16:21

Re: All about splatting specular SMF - SSMF tutorial

Post by Beherith » 06 Aug 2010, 14:57

Comparison shots by smoth:
Without SSMF:
Image

With SSMF:
Image

Uploaded with ImageShack.us
0 x

User avatar
fc14159
Posts: 153
Joined: 06 Jul 2007, 17:27

Re: All about splatting specular SMF - SSMF tutorial

Post by fc14159 » 17 Aug 2010, 17:05

The splat distribution image can't be larger than the height map of the map, or else the detail textures outside of the northwest corner get jumbled up. It's not a huge problem, but I'm just putting it out there for everyone's knowledge.

The thing that really irks me is that fact that shadows have to be enabled for SSMF to be enabled. Why does it have to be that way? That just completely crushed my hopes of ever actually seeing this work. And I'm pretty sure I'm not the only one who is not willing to sacrifice performance for graphics.
0 x

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14474
Joined: 17 Nov 2005, 02:43

Re: All about splatting specular SMF - SSMF tutorial

Post by Forboding Angel » 17 Aug 2010, 17:33

I haven't played without shadows for years. Disabling shadows completely changes how the map is rendered visually.

Also, if you can't run shadows, you seriously need to upgrade.
0 x

User avatar
fc14159
Posts: 153
Joined: 06 Jul 2007, 17:27

Re: All about splatting specular SMF - SSMF tutorial

Post by fc14159 » 17 Aug 2010, 18:13

I can run with shadows, but it takes 1/4 of my fps away. And I love my fps very dearly.

Edit: Running with shadows actually isn't that bad, especially with lazy shadows. 8)
Last edited by fc14159 on 17 Aug 2010, 20:56, edited 1 time in total.
0 x

User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: All about splatting specular SMF - SSMF tutorial

Post by jK » 17 Aug 2010, 19:35

there is a lazy shadows mode (/shadows 2)
0 x

User avatar
JohannesH
Posts: 1793
Joined: 07 Apr 2009, 12:43

Re: All about splatting specular SMF - SSMF tutorial

Post by JohannesH » 17 Aug 2010, 19:48

also, LOS :(
0 x

User avatar
fc14159
Posts: 153
Joined: 06 Jul 2007, 17:27

Re: All about splatting specular SMF - SSMF tutorial

Post by fc14159 » 17 Aug 2010, 21:25

Using a specular texture of complete black will cause ugly black "shadows." Example of the problem:
Image
When I set the specular texture to one with values of 2, the shadows disappeared, while the map remained pleasantly unshiny.
0 x

Saktoth
Zero-K Developer
Posts: 2665
Joined: 28 Nov 2006, 13:22

Re: All about splatting specular SMF - SSMF tutorial

Post by Saktoth » 25 Aug 2010, 00:12

The fact that LoS mode disables this sort of sucks, when LoS view is present in every single modern RTS and is really rather essential data.

I guess its time for LoS mode to make the transition over to lua?
0 x

User avatar
JohannesH
Posts: 1793
Joined: 07 Apr 2009, 12:43

Re: All about splatting specular SMF - SSMF tutorial

Post by JohannesH » 25 Aug 2010, 00:24

Saktoth wrote:I guess its time for LoS mode to make the transition over to lua?
Or just make possible to have engine los with shadows on... Whichever method would be faster preferably.
0 x

Saktoth
Zero-K Developer
Posts: 2665
Joined: 28 Nov 2006, 13:22

Re: All about splatting specular SMF - SSMF tutorial

Post by Saktoth » 25 Aug 2010, 14:57

Mmm, though there have been a lot of attempts to get LoS mode 'right' and yet still most mods dont use it for some objection or another: Too dark, too blue, too green, too this or that.

Presumably speed is the most important factor here though, which is why i raise the prospect to consider the plausibility, though perhaps it may be better posing the question in another venue.
0 x

User avatar
Beherith
Moderator
Posts: 4932
Joined: 26 Oct 2007, 16:21

Re: All about splatting specular SMF - SSMF tutorial

Post by Beherith » 25 Aug 2010, 18:01

Im working on SSMF having out of LOS areas in black and white.
0 x

User avatar
KaiserJ
Community Representative
Posts: 3113
Joined: 08 Sep 2008, 22:59

Re: All about splatting specular SMF - SSMF tutorial

Post by KaiserJ » 25 Aug 2010, 19:21

how exactly are you constructing that detail splat image?

i mean i understand that you have a different greyscale image in each channel

but how do you actually GET those images into the channels? im having some issues with it (trying to use GIMP)
0 x

User avatar
fc14159
Posts: 153
Joined: 06 Jul 2007, 17:27

Re: All about splatting specular SMF - SSMF tutorial

Post by fc14159 » 25 Aug 2010, 19:31

KaiserJ wrote:how exactly are you constructing that detail splat image?

i mean i understand that you have a different greyscale image in each channel

but how do you actually GET those images into the channels? im having some issues with it (trying to use GIMP)
You go to the channels tab and select one channel and do whatever you want with it. That will be your first channel.
0 x

User avatar
KaiserJ
Community Representative
Posts: 3113
Joined: 08 Sep 2008, 22:59

Re: All about splatting specular SMF - SSMF tutorial

Post by KaiserJ » 25 Aug 2010, 19:41

thanks, i'll try that shortly. too used to doing everything with fireworks

Code: Select all

    SplatTexScales =0.006 .006 0.006 0.006;
    SplatTexMults = 0.3 .3 0.2 0.5;
also in the above code segment... i'm aware that the first three digits represent each individual channels scale/multiplier, but what does the fourth do? sort of an "overall multiplier" ?

also : i have got it to work, just in an ugly way, but i can see the possibilities and i think SSMF is pretty awesome

edit : oh right... might want to add that the SSMF stuff goes in the /maps/ folder, i discovered it thankfully by trial and error :>
0 x

User avatar
Beherith
Moderator
Posts: 4932
Joined: 26 Oct 2007, 16:21

Re: All about splatting specular SMF - SSMF tutorial

Post by Beherith » 25 Aug 2010, 20:26

The fourth param is for the 4th splat texture and splat distribution that you can place into the alpha channel.
0 x

User avatar
KaiserJ
Community Representative
Posts: 3113
Joined: 08 Sep 2008, 22:59

Re: All about splatting specular SMF - SSMF tutorial

Post by KaiserJ » 25 Aug 2010, 22:35

Beherith wrote:The fourth param is for the 4th splat texture and splat distribution that you can place into the alpha channel.
lol. that explains a lot :D
0 x

User avatar
Beherith
Moderator
Posts: 4932
Joined: 26 Oct 2007, 16:21

Re: All about splatting specular SMF - SSMF tutorial

Post by Beherith » 26 Aug 2010, 09:55

Small tip: If your splat texture seems to have a lighting direction, make sure to line it up with your spring lighting direction for coherent visuals.
0 x

Post Reply

Return to “Map Tutorials & Resources”