Skybox in Quake3

Started by
2 comments, last by CoreWill 20 years, 6 months ago
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!
------------------------------The Great Nature!
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
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.
Thank you!!

To Lupin: I''m Zeb.
------------------------------The Great Nature!

This topic is closed to new replies.

Advertisement