Mapdev:diffuse: Difference between revisions

From Spring
Jump to navigationJump to search
m added images.
Gajop (talk | contribs)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Diffuse =
= Diffuse =
The colour of the terrain. The diffuse image texture is compiled with mapconv into the SMT/SMF files. In game, the color is then modified with the lighting values in mapinfo.lua
The colour of the terrain, then modified with the lighting values in mapinfo.lua
<center>
<center>
{| class="wikitable"
{| class="wikitable"
|+ Example
|+ Example
| [[File:Mapdev-diffuse.png]] || [[File:Mapdev-diffuse-example.png]]
| [[File:Mapdev-diffuse.jpg]] || [[File:Mapdev-diffuse-example.png]]
|-
|-
! Example Diffuse Map !! Ingame Result
! Example Diffuse Map !! Ingame Result
Line 13: Line 13:
The relevant sections of the mapinfo.lua file that effect the colour of the ground are in the [[Map_Making:mapinfo.lua#Lighting|Lighting subtable]]
The relevant sections of the mapinfo.lua file that effect the colour of the ground are in the [[Map_Making:mapinfo.lua#Lighting|Lighting subtable]]


<code><pre>
<pre>
local mapinfo = {
local mapinfo = {
   ...
   ...
Line 27: Line 27:
   ...
   ...
}
}
</pre></code>
</pre>


== Image File ==
== Image File ==
* 8 bpp RGB
{| class="wikitable" width="100%"
! width="15%" | File Location
| The diffuse texture is chopped into 32x32 pixel tiles compressed using DXT1 and compiled into the smt using [[MapConv]] or [[MapConvNG]].
|-
! File Format
| Any that Mapconv programs support
|-
! Colour Depth
| 8bpp
|-
! Channels
| RGBA
|-
! Resolution
| <center>
{| class="wikitable" style="text-align: center;"
{| class="wikitable" style="text-align: center;"
!Spring Map Size<sup>*</sup>
!Spring Map Size<sup>*</sup>
Line 50: Line 64:
| 16 384
| 16 384
|-
|-
| style="text-align: left;font-style:italic" colspan=2 | &#42; must be multiples of 2
| style="text-align: left;font-style:italic" colspan=2 | * must be multiples of 2
|}</center>
|}
|}


== Compression ==
== Compression ==
It's possible to reduce the size of the final map by using a repeating pattern in your texture image. mapconv auto detects that pattern and saves each unique tile that you've used as DDS inside the mapfile.
The DXT1 compression is lossy, but in a consistent manner. all 32x32 tiles will have exactly the same size. To reduce the number of tiles saved in tile file(SMT) you can align graphical elements to a 32x32 pixel grid. MapConv can detect that a tile is repeated and reference it only once. This means that any repetition of the diffuse image, so long as it is aligned to a 32x32 pixel grid will result in a reduction in size.
 
* Use tiled textures that are multiples of 32x32 in dimensions.
* Place features like geovents and metal spots on a 32x32 grid.
* Repeat as much as possible on a 32x32 pixel grid.


[[Category:Mapdev]]
[[Category:Map Dev]]
[[Category:Development]]

Latest revision as of 16:37, 18 December 2018

Diffuse

The colour of the terrain, then modified with the lighting values in mapinfo.lua

Example
Example Diffuse Map Ingame Result

Specification

mapinfo.lua

The relevant sections of the mapinfo.lua file that effect the colour of the ground are in the Lighting subtable

local mapinfo = {
   ...
   lighting = {
      ...
      --// ground lighting
      groundAmbientColor  = {0.5, 0.5, 0.5},
      groundDiffuseColor  = {0.5, 0.5, 0.5},
      groundSpecularColor = {0.1, 0.1, 0.1},
      groundShadowDensity = 0.8,
      ...
   },
   ...
}

Image File

File Location The diffuse texture is chopped into 32x32 pixel tiles compressed using DXT1 and compiled into the smt using MapConv or MapConvNG.
File Format Any that Mapconv programs support
Colour Depth 8bpp
Channels RGBA
Resolution
Spring Map Size* pixels = Spring Map Size * 512
2 1024
4 2048
6 3072
... ...
32 16 384
* must be multiples of 2

Compression

The DXT1 compression is lossy, but in a consistent manner. all 32x32 tiles will have exactly the same size. To reduce the number of tiles saved in tile file(SMT) you can align graphical elements to a 32x32 pixel grid. MapConv can detect that a tile is repeated and reference it only once. This means that any repetition of the diffuse image, so long as it is aligned to a 32x32 pixel grid will result in a reduction in size.

  • Use tiled textures that are multiples of 32x32 in dimensions.
  • Place features like geovents and metal spots on a 32x32 grid.
  • Repeat as much as possible on a 32x32 pixel grid.