Jump to content
• Advertisement

#### Archived

This topic is now archived and is closed to further replies.

# Skybox in Quake3

This topic is 5545 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

In Quake3, the skybox''s texture is moving. Is there somebody so kind to tell me how to make that effect? Is changing Texture coordinate? Thank you!

#### Share this post

##### Share on other sites
Advertisement
I don''t think the sky box is moving, because that wouldn''t look nice at all, it might rotate, and that''s very simple, just with a rotation matrix, but if you want skies that really move, you have to do something else, by example a sky plane or sky dome.
I haven''t played quake3, but I have played return to castle wolfenstein, and the moving clouds they use look like a skyplane if I remember correctly. Such a sky plane is just a big plane above your scene with a sky texture on it, and moving texture coordinates.

but if you want to render really beatyful skies, and you don''t know this thread yet, go read it now

My Site

#### Share this post

##### Share on other sites
quasar3d: I think you missed the point

Will: It''s done by using an matrix, I wrote an little function to transform the texture matrix, you just have to convert it to C++:

Public Sub SetupTexMatrix2(matOut As D3DMATRIX, scaleX As Single, scaleY As Single, ofX As Single, ofY As Single, rotation As Single)
Dim rmat As D3DMATRIX
Dim tmat As D3DMATRIX
D3DXMatrixIdentity rmat

matOut.m11 = scaleX: matOut.m12 = 0: matOut.m13 = 0: matOut.m14 = 0
matOut.m21 = 0: matOut.m22 = scaleY: matOut.m23 = 0: matOut.m24 = 0
matOut.m31 = ofX: matOut.m32 = ofY: matOut.m33 = 1: matOut.m34 = 0
matOut.m41 = 0: matOut.m42 = 0: matOut.m43 = 0: matOut.m44 = 0

D3DXMatrixRotationZ rmat, rotation

tmat.m11 = 1: tmat.m12 = 0: tmat.m13 = 0: tmat.m14 = 0
tmat.m21 = 0: tmat.m22 = 1: tmat.m23 = 0: tmat.m24 = 0
tmat.m31 = 0.5: tmat.m32 = 0.5: tmat.m33 = 1: tmat.m34 = 0
tmat.m41 = 0: tmat.m42 = 0: tmat.m43 = 0: tmat.m44 = 0

D3DXMatrixMultiply matOut, matOut, tmat
D3DXMatrixMultiply matOut, rmat, matOut

tmat.m11 = 1: tmat.m12 = 0: tmat.m13 = 0: tmat.m14 = 0
tmat.m21 = 0: tmat.m22 = 1: tmat.m23 = 0: tmat.m24 = 0
tmat.m31 = -0.5: tmat.m32 = -0.5: tmat.m33 = 1: tmat.m34 = 0
tmat.m41 = 0: tmat.m42 = 0: tmat.m43 = 0: tmat.m44 = 0

D3DXMatrixMultiply matOut, tmat, matOut
End Sub

In order for the transformation to work you need to set this texture state:
d3ddevice.SetTextureStageState 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2

that''s all you need to change the texture coordinates without manipulating the vertices.

#### Share this post

##### Share on other sites
Thank you!!

To Lupin: I''m Zeb.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5
• Advertisement

• 11
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633722
• Total Posts
3013538
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!