GTAStunting
General => General Discussion => Expression Section => Topic started by: JayFoxRox on November 10, 2007, 01:36:22 PM
-
Howdie!
I just wrote some absolutly PWNGE skydome code, and it looks fucking realistic - even on the PSP (Just take a look at the screens and you'll see: this can keep up with most commercial software)!
I will definatly stick to this technique, however, I have problems with finding a good texture
.
Would be great if any of you do such things or know someone doing this. I wasn't sure where to post this, but I think this is some kind of expression and most artists will look here.
Oh yeh, if anyone wants to use my code for the skydome in vegas or w/e, heres the code to generate the buffer:
Types:
Private Type iVertex
X As Single
Y As Single
Z As Single
U As Single
V As Single
End Type
Dim vr_Sky() As iVertex
Generating:
sn_Radius = 100
in_Columns = 64
in_Rows = 10
ReDim vr_Sky(in_Rows * 2 * in_Columns * 3 - 1)
For in_Column = 0 To in_Columns - 1
For in_Row = 0 To in_Rows - 1
Dim in_Address As Integer
in_Address = 0 + in_Row * 2 * in_Columns * 3 'Go to row
in_Address = in_Address + in_Column * 2 * 3 'Go to object
vr_Sky(in_Address + 0).Y = Sin(RD(90 / in_Rows * (in_Row + 1))) * sn_Radius
vr_Sky(in_Address + 1).Y = Sin(RD(90 / in_Rows * (in_Row + 0))) * sn_Radius
vr_Sky(in_Address + 2).Y = Sin(RD(90 / in_Rows * (in_Row + 0))) * sn_Radius
vr_Sky(in_Address + 3).Y = Sin(RD(90 / in_Rows * (in_Row + 1))) * sn_Radius
vr_Sky(in_Address + 4).Y = Sin(RD(90 / in_Rows * (in_Row + 1))) * sn_Radius
vr_Sky(in_Address + 5).Y = Sin(RD(90 / in_Rows * (in_Row + 0))) * sn_Radius
vr_Sky(in_Address + 0).U = 1 / in_Columns * (in_Column + 0)
vr_Sky(in_Address + 0).V = 1 - (1 / in_Rows * (in_Row + 1))
vr_Sky(in_Address + 1).U = 1 / in_Columns * (in_Column + 0)
vr_Sky(in_Address + 1).V = 1 - (1 / in_Rows * (in_Row + 0))
vr_Sky(in_Address + 2).U = 1 / in_Columns * (in_Column + 1)
vr_Sky(in_Address + 2).V = 1 - (1 / in_Rows * (in_Row + 0))
vr_Sky(in_Address + 3).U = 1 / in_Columns * (in_Column + 0)
vr_Sky(in_Address + 3).V = 1 - (1 / in_Rows * (in_Row + 1))
vr_Sky(in_Address + 4).U = 1 / in_Columns * (in_Column + 1)
vr_Sky(in_Address + 4).V = 1 - (1 / in_Rows * (in_Row + 1))
vr_Sky(in_Address + 5).U = 1 / in_Columns * (in_Column + 1)
vr_Sky(in_Address + 5).V = 1 - (1 / in_Rows * (in_Row + 0))
vr_Sky(in_Address + 0).X = Sin(RD(360 / in_Columns * (in_Column + 0))) * sn_Radius / in_Rows * (in_Rows - in_Row - 1)
vr_Sky(in_Address + 0).Z = Cos(RD(360 / in_Columns * (in_Column + 0))) * sn_Radius / in_Rows * (in_Rows - in_Row - 1)
vr_Sky(in_Address + 1).X = Sin(RD(360 / in_Columns * (in_Column + 0))) * sn_Radius / in_Rows * (in_Rows - in_Row - 0)
vr_Sky(in_Address + 1).Z = Cos(RD(360 / in_Columns * (in_Column + 0))) * sn_Radius / in_Rows * (in_Rows - in_Row - 0)
vr_Sky(in_Address + 2).X = Sin(RD(360 / in_Columns * (in_Column + 1))) * sn_Radius / in_Rows * (in_Rows - in_Row - 0)
vr_Sky(in_Address + 2).Z = Cos(RD(360 / in_Columns * (in_Column + 1))) * sn_Radius / in_Rows * (in_Rows - in_Row - 0)
vr_Sky(in_Address + 3).X = Sin(RD(360 / in_Columns * (in_Column + 0))) * sn_Radius / in_Rows * (in_Rows - in_Row - 1)
vr_Sky(in_Address + 3).Z = Cos(RD(360 / in_Columns * (in_Column + 0))) * sn_Radius / in_Rows * (in_Rows - in_Row - 1)
vr_Sky(in_Address + 4).X = Sin(RD(360 / in_Columns * (in_Column + 1))) * sn_Radius / in_Rows * (in_Rows - in_Row - 1)
vr_Sky(in_Address + 4).Z = Cos(RD(360 / in_Columns * (in_Column + 1))) * sn_Radius / in_Rows * (in_Rows - in_Row - 1)
vr_Sky(in_Address + 5).X = Sin(RD(360 / in_Columns * (in_Column + 1))) * sn_Radius / in_Rows * (in_Rows - in_Row - 0)
vr_Sky(in_Address + 5).Z = Cos(RD(360 / in_Columns * (in_Column + 1))) * sn_Radius / in_Rows * (in_Rows - in_Row - 0)
Next in_Row
Next in_Column
Set dx_Sky = dx_Direct3DX.CreateTextureFromFile(dx_Device3D, "sky/day.bmp")
Rendering:
dx_Device3D.SetRenderState D3DRS_ZENABLE, 1
dx_Device3D.SetRenderState D3DRS_ZWRITEENABLE, 0
dx_Device3D.SetRenderState D3DRS_CULLMODE, D3DCULL_NONE
dx_Device3D.SetRenderState D3DRS_CLIPPING, 0
dx_Device3D.SetRenderState D3DRS_LIGHTING, 0
dx_Device3D.SetRenderState D3DRS_FILLMODE, D3DFILL_SOLID
dx_Device3D.SetTexture 0, dx_Sky
dx_Device3D.SetVertexShader D3DFVF_XYZ Or D3DFVF_TEX1
dx_Device3D.DrawPrimitiveUP D3DPT_TRIANGLELIST, (UBound(vr_Sky) + 1) / 3, vr_Sky(0), Len(vr_Sky(0))
dx_Device3D.SetRenderState D3DRS_ZWRITEENABLE, 1
dx_Device3D.SetTexture 0, Nothing
Other:
- dx_Device3D is the Direct3DDevice8
- dx_Direct3DX is the D3DX8
- RD makes a Radian from Degree (RD(x) = x * atn(1) * 4 / 180
- Sky might be mirrored on vertical axis
-
than those skys isnt real?
e.: i think my english suck a little bit
-
Could it be possible to have skies like that in VC/SA?
-
Could it be possible to have skies like that in VC/SA?
x2
-
Woahw awesome =)
-
yes it is possible to have such skies in VC and SA - modelingman has some of his work in his sig. You have to write a SCM which places an selfmade sphere around the cam, or even better, hook the direct3d call for rendering the sky (its the only one with zwriteenable = false, and inject your own code)
However, this was meant as a request... :'(
Anyways, I found some new one myself:
http://www.philohome.com/skycollec/skycollec.htm (http://www.philohome.com/skycollec/skycollec.htm) (A bit wrong colored and sun on the sky isn't too good)
http://blenderartists.org/forum/showthread.php?t=24038 (http://blenderartists.org/forum/showthread.php?t=24038) (No photos, good anyways)
http://www.marlinstudios.com/samples/samppano.htm (http://www.marlinstudios.com/samples/samppano.htm) (not free, but maybe I can get this one for christmas or something )
-
can you simplify things up
what should we add/replace/w/e in the vc files? the gta3.img?
-
Nah, its more complex, either make a dff from the dome and load it using object.dat and the SCM so its around the camera object all the time or create a loaded binary (*.dll, *.asi) which is injected into GTA's render engine (thats what I would do). Read Spookys Speedo tutorial/source and you'll get what I mean.
-
Nah, its more complex, either make a dff from the dome and load it using object.dat and the SCM so its around the camera object all the time or create a loaded binary (*.dll, *.asi) which is injected into GTA's render engine (thats what I would do). Read Spookys Speedo tutorial/source and you'll get what I mean.
i see... i think i get it somehow...
are u saying, the sky is only available inside the dome?
or ur saying, a dff file like a dome would be carried through out the game.. or is there?
well anyways, good luck... and share it to us once its done