[bb] 3d Parralaxing by Fuller [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:40

Previous topic - Next topic

BlitzBot

Title : 3d Parralaxing
Author : Fuller
Posted : 1+ years ago

Description : 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):


Code :
Code (blitzbasic) Select
Function Make_Parallaxing_Stars_and_Sky()

plane=CreatePlane()
MoveEntity plane,0,-1,0

p_tex=LoadTexture("mediastars.bmp",2)
ScaleTexture p_tex,20,20
EntityTexture plane,p_tex  

plane2=CreatePlane()
MoveEntity plane2,0,-10,0


p_tex2=LoadTexture("mediastars.bmp",2)
ScaleTexture p_tex2,50,50
EntityTexture plane2,p_tex2  

plane3=CreatePlane()
MoveEntity plane3,0,-20,0

p_tex3=LoadTexture("mediastars.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("mediastars.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("mediastars.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("mediastars.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...