Page 1 of 2

All about splatting specular SMF - SSMF tutorial

Posted: 05 Aug 2010, 17:34
by Beherith
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

Re: All about splatting specular SMF - SSMF tutorial

Posted: 05 Aug 2010, 17:54
by Kloot
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.

Re: All about splatting specular SMF - SSMF tutorial

Posted: 05 Aug 2010, 18:58
by KaiserJ
Image

Re: All about splatting specular SMF - SSMF tutorial

Posted: 06 Aug 2010, 14:57
by Beherith
Comparison shots by smoth:
Without SSMF:
Image

With SSMF:
Image

Uploaded with ImageShack.us

Re: All about splatting specular SMF - SSMF tutorial

Posted: 17 Aug 2010, 17:05
by fc14159
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.

Re: All about splatting specular SMF - SSMF tutorial

Posted: 17 Aug 2010, 17:33
by Forboding Angel
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.

Re: All about splatting specular SMF - SSMF tutorial

Posted: 17 Aug 2010, 18:13
by fc14159
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)

Re: All about splatting specular SMF - SSMF tutorial

Posted: 17 Aug 2010, 19:35
by jK
there is a lazy shadows mode (/shadows 2)

Re: All about splatting specular SMF - SSMF tutorial

Posted: 17 Aug 2010, 19:48
by JohannesH
also, LOS :(

Re: All about splatting specular SMF - SSMF tutorial

Posted: 17 Aug 2010, 21:25
by fc14159
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.

Re: All about splatting specular SMF - SSMF tutorial

Posted: 25 Aug 2010, 00:12
by Saktoth
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?

Re: All about splatting specular SMF - SSMF tutorial

Posted: 25 Aug 2010, 00:24
by JohannesH
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.

Re: All about splatting specular SMF - SSMF tutorial

Posted: 25 Aug 2010, 14:57
by Saktoth
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.

Re: All about splatting specular SMF - SSMF tutorial

Posted: 25 Aug 2010, 18:01
by Beherith
Im working on SSMF having out of LOS areas in black and white.

Re: All about splatting specular SMF - SSMF tutorial

Posted: 25 Aug 2010, 19:21
by KaiserJ
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)

Re: All about splatting specular SMF - SSMF tutorial

Posted: 25 Aug 2010, 19:31
by fc14159
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.

Re: All about splatting specular SMF - SSMF tutorial

Posted: 25 Aug 2010, 19:41
by KaiserJ
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 :>

Re: All about splatting specular SMF - SSMF tutorial

Posted: 25 Aug 2010, 20:26
by Beherith
The fourth param is for the 4th splat texture and splat distribution that you can place into the alpha channel.

Re: All about splatting specular SMF - SSMF tutorial

Posted: 25 Aug 2010, 22:35
by KaiserJ
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

Re: All about splatting specular SMF - SSMF tutorial

Posted: 26 Aug 2010, 09:55
by Beherith
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.