[Mapping/ Texuring; Config] Texture Scrolling, Rotation, and Scale.

Started by Apollo, July 21, 2009, 04:35:00 AM

Previous topic - Next topic

Apollo

Just decided to make a "short and to the point" ( haha, riiiight )   guide on texture commands.
This stuff is whats in the Editing Reference, but Hopefully more understandable, and put all in one place.
Hopefully these all work. =D

The layout of a texture enty is
Quotetexture TYPE FILENAME ROT X Y SCALE


////////////////TYPE & FILENAME/////////////////////

To start I'll show TYPE and FILENAME

Quotetexture 0 trak5/comp1a.jpg

The 0 in that line is the TYPE, and means it is a primmary diffuse texture, basicly its the color image.
The filename to follow is as said, the file name, which comes after a directory starting WITHIN the packages folder. The file extention MUST BE CORRECT for it to work, So if your texture is a .png and you have .jpg or nothing at all, it will not work.
Quotetexture 0 trak5/comp1a.jpg


The 0 ( TYPE ) can be interchanged with c, u, d, n, g, s, z, or e
Quote
( From Editing Ref )
# "c" or "0" for primary diffuse texture (RGB)
# "u" or "1" for generic secondary texture
# "d" for decals (RGBA), blended into the diffuse texture if running in fixed-function mode. To disable this combining, specify secondary textures as generic with 1 or "u"
# "n" for normal maps (XYZ)
# "g" for glow maps (RGB), blended into the diffuse texture if running in fixed-function mode. To disable this combining, specify secondary textures as generic with 1 or "u"
# "s" for specularity maps (grey-scale), put in alpha channel of diffuse ("c")
# "z" for depth maps (Z), put in alpha channel of normal ("n") maps
# "e" for environment maps (skybox), uses the same syntax as "loadsky", and set a custom environment map (overriding the "envmap" entities) to use in environment-mapped shaders ("bumpenv*world")

The most common combination of these options is Diffuse, Normal, Spec, Glow, for regular textures, though it can vary
ex.
Quote

texture 0 trak5/comp1a.jpg 0 0 0 0.5  ( diffuse, also makes this as a new entry )
texture n trak5/comp1_n.png ( Normal map ( makes a texture look 3D ))
texture s trak5/comp1_s.jpg ( Specular map ( shinnyness ))
texture g trak5/comp1a_g.jpg ( Glow map ( self explanitory )



I addition to these types, you need the corrisponding shader params to suit your selections.

Quote
( From Editing Ref )
Shader    *Shader params    (Texture slots)   


stdworld    (c)    The default lightmapped world shader.



decalworld    (c, d)    Like stdworld, except alpha blends decal texture on diffuse texture.



glowworld    
      * glowcolor: Rk, Gk, Bk - multiplies the glow map color by the factors Rk, Gk, Bk
   (c, g)    Like stdworld, except adds light from glow map.
    *bumpworld       (c, n)    Normal-mapped shader without specularity (diffuse lighting only).
 



bumpglowworld    
    * glowcolor: Rk, Gk, Bk - multiplies the glow map color by the factors Rk, Gk, Bk
   (c, n, g)    Normal-mapped shader with glow map and without specularity.




bumpspecworld    
    * specscale: Rk, Gk, Bk - multiplies the specular light color by the factors Rk, Gk, Bk
   (c, n)    Normal-mapped shader with constant specularity factor.




bumpspecmapworld    same as above    (c, n, s)    Normal-mapped shader with specularity map.




bumpspecglowworld    
    * glowcolor: Rk, Gk, Bk - multiplies the glow map color by the factors Rk, Gk, Bk
    * specscale: Rk, Gk, Bk - multiplies the specular light color by the factors Rk, Gk, Bk
   (c, n, g)    Normal-mapped shader with constant specularity factor and glow map.



bumpspecmapglowworld    same as above    (c, n, s, g)    Normal-mapped shader with specularity map and glow map.



bumpparallaxworld    
    * parallaxscale: Scale, Bias - Scales the heightmap offset
   (c, n, z)    Normal-mapped shader with height map and without specularity.



bumpspecparallaxworld    
    * specscale: Rk, Gk, Bk - multiplies the specular light color by the factors Rk, Gk, Bk
    * parallaxscale: Scale, Bias - Scales the heightmap offset
   (c, n, z)    Normal-mapped shader with constant specularity factor and height map.



bumpspecmapparallaxworld    same as above    (c, n, s, z)    Normal-mapped shader with specularity map and height map.



bumpparallaxglowworld    
    * glowcolor: Rk, Gk, Bk - multiplies the glow map color by the factors Rk, Gk, Bk   
    * parallaxscale: Scale, Bias - Scales the heightmap offset
   (c, n, z, g)    Normal-mapped shader with height and glow maps, and without specularity.



bumpspecparallaxglowworld    
    * glowcolor: Rk, Gk, Bk - multiplies the glow map color by the factors Rk, Gk, Bk   
    * specscale: Rk, Gk, Bk - multiplies the specular light color by the factors Rk, Gk, Bk   
    * parallaxscale: Scale, Bias - Scales the heightmap offset
   (c, n, z, g)    Normal-mapped shader with constant specularity factor, and height and glow maps.
bumpspecmapparallaxglowworld    same as above    (c, n, s, z, g)    Normal-mapped shader with specularity, height, and glow maps.
bumpenv*    
    * envscale: Rk, Gk, Bk - multiplies the environment map color by the factors Rk, Gk, Bk

      Any of the above bump* shader permutations may replace "bump" with "bumpenv" (i.e. bumpenvspecmapworld), and will then reflect the closest envmap entity (or the skybox if necessary). They support all their usual texture slots and pixel params, in addition to the envmap multiplier pixel param. If a specmap is present in the given shader, the raw specmap value will be scaled by the envmap multipliers (instead of the specmap ones), to determine how much of the envmap to reflect. A calclight (if it has not been done before) or recalc (thereafter) is also needed by this shader to properly setup its engine state.
You may need to experiment with shader params to get the right.


\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
For the options listed below, there are two ways to do some of them.



/////////////ROTATION///////////////

The next part of the texture's line is ROTATION
Quotetexture TYPE FILENAME ROT X Y SCALE
Labeled "ROT" in the line.

This value can be replaced with a number from 0 to 5
These numbers mean:
Quote
# 0 = none 
# 1 = 90 CW    ( 90 Degrees Counter Clockwize  )
# 2 = 180      ( 180 Degrees   ( flipped over ))
# 3 = 270 CW   ( 270 Degrees Counter Clockwize )
# 4 = X flip   ( Mirrored Horizontally    <--> )
# 5 = Y flip   ( Mirrored Vertically       ^ v )





/////////////OFFSET///////////////
Offset is the X and Y of the texture line.
Quotetexture TYPE FILENAME ROT X Y SCALE

X and Y refer to "Texels" which are imaginary values dreamed up by people that can see invisible pink unicorns that are riding dragons whilst throwing wolves at maggots. ( If they're invisible, how can they be pink?!)
Or they are quite possibly 1 pixel.
You can usually offset a texture by half with ah 256 value assuming the texture is 512x512, which most are.

EXAMPLE:
Quotetexture 0 trak5/base1a.jpg 0 256 256 0
In that example, 512x512 texture would be shifted 256 pixels on the X axis, and 256 pixels on the Y axis.

\\\\\\\\TEXTURE SLOT OFFSET\\\\\\\\\\
texoffset X Y
Offsets the current texture slot by X and Y texels along the X and Y axes of the texture respectively.

EXAMPLE:
Quote
texoffset 0 256
texture 0 trak5/base1a.jpg 0 0 0 0
Offsets texture 256 "Texels" on the Y axis


/////////////SCALE///////////////
Scale is the final value in the texture line.
Quotetexture TYPE FILENAME ROT X Y SCALE
SCALE can be replaced with most any value.
The value used will multiply the scale of the texture as it appears on world geometry.

EXAMPLE:
Quotetexture 0 trak5/base1a.jpg 0 0 0 0.5
In this example the texture would be One Half its original size.

Quotetexture 0 trak5/base1a.jpg 0 0 0 2
In this example the texture would be Twice its original size.

\\\\\\\\\\\TEXTURE SLOT SCALE\\\\\\\\\\\\
texscale N
Scales the current texture slot such that it is N times its normal size.

EXAMPLE:
Quote
texscale 2
texture 0 trak5/base1a.jpg 0 0 0 0
In this example the texture would be double its original size.

/////////////SCROLLING///////////////

This is done by placing  texscroll X Y  on the line before your texture.
Quotetexscroll X Y
X refers to scrolling on the X axis ( Horizontal )
Y refers to scrolling on the Y axis (  Vertical or horizontal with a 90 degree difference in angle from X  )
Simply replace the X or Y with a value, 0 being no movement.

EXAMPLE:
Quote
texscroll 0 1
texture 0 trak5/base1a.jpg 0 0 0 0
In this example, the texture would scroll at an unknown rate on the Y axis.
You will need to play with the values as they are in unknown units.


/////////////TEXTURE SLOT ROTATION///////////////

Quotetexrotate N

Rotates the current texture slot by N*90 degrees. N=0..3. N=4 flips along the X axis, and N=5 flips along the Y ax
1 = 90
2 = 180
3 = 270
4 = Flip X axis ( This is because 360 brings you back to your start, so it mirrors instead )
5 = Flip Y axis

EXAMPLE:
Quotetexrotate 1
texture 0 trak5/base1a.jpg 0 0 0 0
( rotates slot 90 degrees )


texrotate 2
texture 0 trak5/base1a.jpg 0 0 0 0
( rotates slot 180 degrees and is loaded as a separate slot than the previous )


texrotate 3
texture 0 trak5/base1a.jpg 0 0 0 0
( rotates slot 270 degrees and is loaded as a separate slot than the previous )


texrotate 4
texture 0 trak5/base1a.jpg 0 0 0 0
( Mirrors slot on X axis and is loaded as a seperate slot than the previous )


texrotate 5
texture 0 trak5/base1a.jpg 0 0 0 0
( Mirrors slot on Y axis and is loaded as a separate slot than the previous )
In that example, the texture is rotated 5 times and each rotation is in a different slot, so the texture is there 5 times but turned in each.
In addition, you can specify all TYPES ( c, u, d, n, g, s, z, or e ) of textures, they simply need to ( or should ) come AFTER the Diffuse ( 0 or C ) in the list

EXAMPLE:

Quote
texrotate 4
texture 0 trak5/comp1a.jpg 0 0 0 0.5  ( diffuse, also makes this as a new entry )
texture n trak5/comp1_n.png ( Normal map ( makes a texture look 3D ))
texture s trak5/comp1_s.jpg ( Specular map ( shininess ))
texture g trak5/comp1a_g.jpg ( Glow map ( self explanatory )

//////////////////////////AUTOGRASS////////////////
autograss FILENAME
Automatically generates grass for the current texture slot on any upward facing surface. The grass texture FILENAME is used to to texture the grass blades.
Grass can be found in the sauerbraten\packages\textures folder.

Ive not tested, but Im guessing its used like so...
Quote
autograss textures/grass_aard.png
texture 0 trak5/comp1a.jpg
^^ That way you should have a computer texture with grass growing out of it. O.o


Quote
I hope this was helpful. Ill read it over later and tune it.

If you see something wrong or missing, tell me and I'll fix it.




If I could rearrange the alphabet, I'd put your sister and I side by side.

Heav’n hath no rage like love to hatred turn’d, Nor Hell a fury, like a woman scorn’d.

AirplaneFood

-Slash (Now AirplaneFood)

Apollo

Yeppers, I hope it helps.

I learned a thing or two whilst typing all 310 lines.

If I could rearrange the alphabet, I'd put your sister and I side by side.

Heav’n hath no rage like love to hatred turn’d, Nor Hell a fury, like a woman scorn’d.