Code archives/3D Graphics - Effects/3d Parralaxing
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
| Parraling effect Step one: Create a couple planes [CreatePlane()] Remember to offset one on the Y axis Step two: Assign Alpha or masked textures to the planes The bottom plane should have a bigger texture (ScaleTexture()) Step three: That's it! Move the camera around the plane to see the effect! Hope this helps someone Example (not the cleanest though, you'll need some star image): | |||||
Function Make_Parallaxing_Stars_and_Sky()
plane=CreatePlane()
MoveEntity plane,0,-1,0
p_tex=LoadTexture("media\stars.bmp",2)
ScaleTexture p_tex,20,20
EntityTexture plane,p_tex
plane2=CreatePlane()
MoveEntity plane2,0,-10,0
p_tex2=LoadTexture("media\stars.bmp",2)
ScaleTexture p_tex2,50,50
EntityTexture plane2,p_tex2
plane3=CreatePlane()
MoveEntity plane3,0,-20,0
p_tex3=LoadTexture("media\stars.bmp")
ScaleTexture p_tex3,50,50
EntityTexture plane3,p_tex3
;top planes
plane1=CreatePlane()
MoveEntity plane1,0,20,0
TurnEntity plane1,180,0,0
p_tex1=LoadTexture("media\stars.bmp",2)
ScaleTexture p_tex1,20,20
EntityTexture plane1,p_tex1
plane21=CreatePlane()
MoveEntity plane21,0,30,0
TurnEntity plane21,180,0,0
p_tex21=LoadTexture("media\stars.bmp",2)
ScaleTexture p_tex21,50,50
EntityTexture plane21,p_tex21
plane31=CreatePlane()
MoveEntity plane31,0,40,0
TurnEntity plane31,180,0,0
p_tex31=LoadTexture("media\stars.bmp")
ScaleTexture p_tex31,50,50
EntityTexture plane31,p_tex31
;sky
sky=CreateSphere(30)
ScaleEntity sky,200,200,200
ScaleTexture p_tex31,.1,.1
EntityTexture sky,p_tex31
FlipMesh sky
end function |
Comments
None.
Code Archives Forum