Textures - Hirato/lamiae GitHub Wiki
Table of Contents
Material Slots
There are 3 types of materials that accept textures, water, lava and glass. There can be up to 4 varieties of each, to assign these textures you simply use the material suffixed with a numbr from 1 to 4. eg water1
, water2
, water3
, and water4
would let you set textures for the water types.
Water
texture water "Diffuse"
texture 1 "normals"
texture 1 "waterfall"
texture 1 "waterfall normals"
The normals are used for refractions and for generating additional wave distortions on the water alongside vertex animation.
Lava
texture lava "Diffuse"
texture 1 "normals"
texture 1 "waterfall"
texture 1 "waterfall normals"
Glass
texture glass "normal"
Texture Slots
Texture Types
- 0 - Creates a new texture slot
- 1 - Adds undefined extra textures
- n - The normal map.
- z - Heightmap (grayscale) - Denotes outset and inset strength (Optional)
- g - glow texture.
- e - Optional; Used to explicitly set an envmap.
- s - specularity map (grayscale) - modulates shininess (Optional)
Note that the height map and the specularity map is optional, provided that an RGBA texture is provided for the normal map, or the diffuse, respectively. These two textures are used to specify the corresponding texture's alpha channel if absent.
The texture command takes the format texture type path [rotation] [x-offset] [y-offset] [scale]
, the additional properties default to 0 and can be individually set after the fact.
Also note that the environment map slot doesn't need to be specified. When omitted, the texture will instead reflect the skybox, or permitting, use a nearby envmap
entity as its source.
Shaders
When configuring textures, you can utilise assorted shaders with the setshader
command, and further configure it with shaderparam
commands. You could use this for example to alter pulse glow frequency.
Available Parameters
glowcolor
Defines a colour multiplier for glowmap textures, allowing for easy adjustment of the colour. The colour isn't clamped.
pulseglowcolor
For pulse shaders, defines the colour the glowmap will gradually shift to (and back). The colour isn't clamped.
pulseglowspeed
A value in hertz of how often pulseglow shaders will transition from the original colour to the pulsecolour and back. High values lead to flickering.
envscale
Modulates the colours of environment maps.
triplanarbias
Adjusts the blending factor of side faces against the top and bottom faces. Each value corresponds to its respective axis.
specscale
Modulates the shininess of the texture in correspondence to light sources. The value isn't clamped and is defined per colour.
parallaxscale
Adjusts the 3D effect of a texture with a valid heightmap. The first parameter defines how much the surface looks like it's coming out of the ground, and the second how deep it looks to go.
List of Shaders
stdworld
stdworld is the base shader for rendering textures onto geometry.
Textures
- 0 - Diffuse
Parameters
- None
specworld
Gives textures a constant specularity.
Textures
- 0 - Diffuse
Parameters
- specscale (1, 1, 1)
specmapworld
Gives textures a constant specularity, modulated by a specmap. Note that if an RGBA diffuse surface is specified, the alpha channel is used for specularity.
Textures
- 0 - Diffuse (RGB, or RGBA)
- s - Specularity map (Optional)
Parameters
- specscale (6, 6, 6)
glowworld
glowworld renders a simple diffuse texture with a glowmap.
Textures
- 0 - Diffuse
- g - Glowmap
Parameters
- glowcolor (1, 1, 1)
pulseglowworld
Renders a pulsing glowmap atop a diffuse texture.
Textures
- 0 - Diffuse
- g - Glowmap
Parameters
- glowcolor (1, 1, 1)
- pulseglowspeed (1)
- pulseglowcolor (0, 0, 0)
envworld
Used for drawing reflections on a simple diffuse texture.
Textures
- 0 - Diffuse
- e - Environment Map (Optional)
Parameters
- envscale (.2, .2, .2)
envspecworld
Textures
- 0 - Diffuse
- e - Environment Map (Optional)
Parameters
- envscale (.2, .2, .2)
- specscale (1, 1, 1)
envspecmapworld
env + specmap shader in which the specularity map modulates the strength of the environment map as well.
Textures
- 0 - Diffuse
- e - Environment Map (Optional)
- s - Specularity map (Optional)
Parameters
- envscale (1, 1, 1)
- specscale (6, 6, 6)
envglowworld
Textures
- 0 - Diffuse
- g - glowmap
- e - Environment Map (Optional)
Parameters
- envscale (.2, .2, .2)
- glowcolor (1, 1, 1)
envpulseglowworld
Textures
- 0 - Diffuse
- g - glowmap
- e - Environment Map (Optional)
Parameters
- envscale (.2, .2, .2)
- glowcolor (1, 1, 1)
- pulseglowspeed (1)
- pulseglowcolor (0, 0, 0)
triplanarworld
Blends the top and bottom surfaces of a cube with the sides. The effect is more pronounced with curved geometry. triplanarbias
influences the amount of blending done on each axis.
Textures
- None
Parameters
- triplanarbias (0.3, 0.3, 0.3)
triplanardecalworld
Like triplanarworld, except the top and bottom surfaces are replaced with the decal texture.
Textures
- decal overlay - set via texdecal or vdecal
Parameters
- triplanarbias (0.3, 0.3, 0.3)
bumpvariant shaders
The bumpmap enabled shaders have many variants, The variants can be summarised via the pattern, in which each []
pair is treated as an optional component.
[triplanar[decal]]bump[env][spec[map]][parallax[[pulse]glow]world
// a few valid examples
bumpparallaxworld
triplanardecalbumpenvworld
bumpenvspecmappulseglowworld
The bumpvariant shaders also introduce 3 new mutations.
First up is spec
and specmap
. These two give textures specularity, the difference is that specmap
uses a specularity map to define the shininess, whilst spec
is of constant shininess. specmap
also modulates the strength of envmap reflection based on the specularity map. This means spec
variants are cheaper to use.
Secondly is parallax
which enables parallax mapping. It's an effect which uses a grayscale texture to distort the result, so that some parts seem further or closer than they actually are.
Triplanar Textures
- None
Triplanar Parameters
- triplanarbias (0.3, 0.3, 0.3)
Triplanardecal Textures
- Decal Overlay - set via
texdecal
orvdecal
.
Triplanardecal Parameters
- triplanarbias (0.3, 0.3, 0.3)
Bump Textures
- n - RGB normalmap
Bump Parameters
- None
Env Textures
- e - Environment map (Optional)
Env Paramaters
- envscale (.2, .2, .2) - (1, 1, 1) if it's a specmap variant
Spec Textures
- None
Spec Paramaters
- specscale (1, 1, 1)
Specmap Textures
- 0 - RGBA Diffuse (uses alpha channel); or
- s - Specularity Map
Specmap Paramaters
- specscale (6, 6, 6)
Parallax Textures
- n - RGBA normal map; or
- z - grayscale heightmap to replace normal map's alpha channel.
Parallax Paramaters
- parallaxscale (0.06, -0.03)
Glow Textures
- g - glowmap
Glow Paramaters
- glowcolor (1, 1, 1)
Pulseglow Textures
- g - glowmap
Pulseglow Parameters
- glowcolor (1, 1, 1)
- pulseglowspeed (1)
- pulseglowcolor (0, 0, 0)
Properties
grass
Set via texgrass
, you give a path to a grass texture, which is ideally approximately 512x64
at most, and only tiles horizontally (if at all). This texture is used to render grass upon the surface when grass rendering is enabled.
scroll
Set via texscroll
, you give it two coordinates, which define how fast the texture scrolls in horizontal and vertical directions. The given values define how many times the texture will wrap in each direction per second; This means bigger texture scroll faster and smaller ones slower.
offset
Set via texoffset
, takes an X, Y pair. These values define the exact amount of pixels to shift the texture.
rotation
Set via texrotate
, let's you specify from a list of 6 transforms, as follows.
0 - Normal
1 - 90-deg clockwise
2 - 180-deg clockwise
3 - 270-deg clockwise
4 - horizontal flip
5 - vertical flip
scale
Set via texscale
, you can shrink or enlarge the texture. There is no minimum size, but it cannot be less than or equal to 0.
layer
Set via texlayer
, defines a texture slot to render atop the texture, if the the user paints a suitable blendmap upon affected geometry.
decal
set via texdecal
, defines a texture slot to render atop the texture.
This requires a triplanardecal to be active for any observable effect.
alpha
texalpha
takes two arguments, corresponding to front-face and back-face alpha.
Do note that depth peeling is not provided and that therefore transparent geometry does not appear behind other transparent geometry.
Also note that in the event of RGBA textures, the alpha channel is ignored for rendering; which is to say transparent geometry doesn't enable alpha blending.
Also keep in mind that this has no visible effect if the geometry is NOT within an alpha material volume.
color
texcolor
takes 3 arguments, defining RGB multipliers for the texture's colour channels in a range of 0 to 1.
refraction
texrefract
takes 4 arguments, in order, the first is a coefficient to define refraction strength, followed by 3 arguments to adjust the colour of refracted content.
smoothgroups
Set via texsmooth
, the command takes two parameters, the first defines the smooth group this texture is to be a part of, the second defines the smoothing angle.
The given angle overrides the lerpangle
for the texture for the purposes of generating normals; Low values correspond with sharper/coarser shading whilst high values to smoother shading.
A value of less than 0 will use ther current value of the smoothgroup. smoothangle
can also be used with the same syntax to explicitly set the smoothgroup's smoothing angle; this will not associate it with any textures though.
Do note that smoothing is not applied on smoothgroup boundaries. This could for example be used to give a wall a high smoothing value, whilst still maintaining harsh boundaries against the floor and ceiling.
Virtual Slots
Virtual slots are variants created dynamically during editmode as the user invokes assorted vcommands. These are garbage collected and saved with the map, and are therefore not transferable.
Note that all these commands behave differently when vdelta is in effect. You can use vdelta by nesting the commands inside a vdelta block, eg vdelta [vcolor .5 1 1]
.
You can also reset a texture to its vanilla state with vreset
Properties
rotation
vrotate
, functions like texrotate
.
With vdelta
it adds the given number onto the current rotation.
offset
voffset
, functions like texoffset
.
With vdelta
it adds the given numbers onto the current offset.
scroll
vscroll
, functions like texscroll
.
With vdelta
it adds the given scroll strength onto the current scroll strength.
scale
vscale
, functions like texscale
.
With vdelta
it multiples the current scale with the given scale.
Also note that unlike texscale
, the result is clamped between an 8th of the original size to 8 times the original size.
layer
vlayer
, functions like texlayer
.
vdelta
is ignored
decal
vdecal
, functions like texdecal
.
vdelta
is ignored
alpha
valpha
, functions like texalpha
.
vdelta
is ignored
color
vcolor
, functions like texcolor
.
With vdelta
the individual RGB components are multiplied by the given RGB components.
refraction
vrefract
, functions like texrefract
.
With vdelta
, the refract scale and the refraction colour are multiplied with the given values.
Shader parameters
For a general guide on what shader parameters are available and what the do, see the Shaders section up above.
vshaderparam
lets you override a single shader parameters for a texture, for example you could adjust the glowcolor of a suitable texture like so vshaderparam glowcolor 1 0 0
. When combined with vdelta
, vshaderparam
can override multiple shader attributes. eg vdelta [vshaderparam glowcolor 1 0 0; vshaderparam pulseglowcolor 0 1 0]
.