View topic - All about splatting specular SMF - SSMF tutorial



All times are UTC + 1 hour


Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 30 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: 05 Aug 2010, 16:34 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
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:
[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


Top
 Offline Profile  
 
PostPosted: 05 Aug 2010, 16:54 
Spring Developer

Joined: 08 Oct 2006, 15:58
Addendum: SSMF maps can also reflect the sky above them.

Code:
[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.


Top
 Offline Profile  
 
PostPosted: 05 Aug 2010, 17:58 
Community Representative
User avatar

Joined: 08 Sep 2008, 21:59
Location: small cars
Image


Top
 Offline Profile  
 
PostPosted: 06 Aug 2010, 13:57 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
Comparison shots by smoth:
Without SSMF:
Image

With SSMF:
Image

Uploaded with ImageShack.us


Top
 Offline Profile  
 
PostPosted: 17 Aug 2010, 16:05 
User avatar

Joined: 06 Jul 2007, 16:27
Location: Delawhere?
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.


Top
 Offline Profile  
 
PostPosted: 17 Aug 2010, 16:33 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
Location: Raegquitting Spring on 04/24/12
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.


Top
 Offline Profile  
 
PostPosted: 17 Aug 2010, 17:13 
User avatar

Joined: 06 Jul 2007, 16:27
Location: Delawhere?
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, 19:56, edited 1 time in total.

Top
 Offline Profile  
 
PostPosted: 17 Aug 2010, 18:35 
Spring Developer
User avatar

Joined: 28 Jun 2007, 06:30
there is a lazy shadows mode (/shadows 2)


Top
 Offline Profile  
 
PostPosted: 17 Aug 2010, 18:48 
User avatar

Joined: 07 Apr 2009, 11:43
also, LOS :(


Top
 Offline Profile  
 
PostPosted: 17 Aug 2010, 20:25 
User avatar

Joined: 06 Jul 2007, 16:27
Location: Delawhere?
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.


Top
 Offline Profile  
 
PostPosted: 24 Aug 2010, 23:12 
Zero-K Developer

Joined: 28 Nov 2006, 13:22
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?


Top
 Offline Profile  
 
PostPosted: 24 Aug 2010, 23:24 
User avatar

Joined: 07 Apr 2009, 11:43
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.


Top
 Offline Profile  
 
PostPosted: 25 Aug 2010, 13:57 
Zero-K Developer

Joined: 28 Nov 2006, 13:22
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.


Top
 Offline Profile  
 
PostPosted: 25 Aug 2010, 17:01 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
Im working on SSMF having out of LOS areas in black and white.


Top
 Offline Profile  
 
PostPosted: 25 Aug 2010, 18:21 
Community Representative
User avatar

Joined: 08 Sep 2008, 21:59
Location: small cars
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)


Top
 Offline Profile  
 
PostPosted: 25 Aug 2010, 18:31 
User avatar

Joined: 06 Jul 2007, 16:27
Location: Delawhere?
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.


Top
 Offline Profile  
 
PostPosted: 25 Aug 2010, 18:41 
Community Representative
User avatar

Joined: 08 Sep 2008, 21:59
Location: small cars
thanks, i'll try that shortly. too used to doing everything with fireworks

Code:
    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 :>


Top
 Offline Profile  
 
PostPosted: 25 Aug 2010, 19:26 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
The fourth param is for the 4th splat texture and splat distribution that you can place into the alpha channel.


Top
 Offline Profile  
 
PostPosted: 25 Aug 2010, 21:35 
Community Representative
User avatar

Joined: 08 Sep 2008, 21:59
Location: small cars
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


Top
 Offline Profile  
 
PostPosted: 26 Aug 2010, 08:55 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
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.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 30 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.