Ooops
November 28, 2020, 11:15:55 AM

Author Topic: [bb] Spacesphere by Chroma [ 1+ years ago ]  (Read 571 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Spacesphere by Chroma [ 1+ years ago ]
« on: June 29, 2017, 12:28:39 AM »
Title : Spacesphere
Author : Chroma
Posted : 1+ years ago

Description : Play around with the sptex scale a bit to suit your tastes.

Code :
Code: BlitzBasic
  1. ;Spacesphere
  2.  
  3. ;Create the Texture
  4. sptex = CreateTexture(1024,1024,1+8)
  5. SetBuffer TextureBuffer(sptex)
  6. For a = 1 To 200
  7.         Plot Rand(0,1023),Rand(0,1023)
  8. Next
  9. SetBuffer BackBuffer()
  10. TextureBlend sptex,5
  11.  
  12. ;Create the Sphere
  13. spbox = CreateSphere(5)
  14. ScaleEntity spbox,10000,10000,10000
  15. EntityTexture spbox,sptex
  16. ScaleTexture sptex,.25,.5
  17. EntityFX spbox,1
  18. FlipMesh spbox
  19. EntityOrder spbox,99999


Comments :


markcw(Posted 1+ years ago)

 Here is a working example.
Code: [Select]
;Spacesphere
Graphics3D 640,480,0,2
camera=CreateCamera()
light=CreateLight()
RotateEntity light,45,45,0

;Create the Texture
width=1024
sptex = CreateTexture(width,width,1+8)
SetBuffer TextureBuffer(sptex)
For a = 1 To 200
Plot Rand(0,width-1),Rand(0,width-1)
Next
SetBuffer BackBuffer()
TextureBlend sptex,5

;Create the Sphere
spbox = CreateSphere(5)
ScaleEntity spbox,1000,1000,1000
EntityTexture spbox,sptex
ScaleTexture sptex,.25,.5
EntityFX spbox,1
FlipMesh spbox
EntityOrder spbox,99999

ball=CreateSphere(5)

While Not KeyHit(1)
 RenderWorld

 sincos#=sincos#+0.2
 PositionEntity ball,50*Sin(sincos#),25*Cos(sincos#),200*Cos(sincos#)

 If KeyDown(200) Then TurnEntity camera,-0.25,0,0 ;up key
 If KeyDown(208) Then TurnEntity camera,0.25,0,0 ;down key
 If KeyDown(203) Then TurnEntity camera,0,0.25,0 ;left key
 If KeyDown(205) Then TurnEntity camera,0,-0.25,0 ;right key
 If KeyHit(17) Then wf=Not wf : WireFrame wf ;W key
 Text 0,0,"Arrow keys=move camera, W=wireframe"

 Flip
Wend



Boiled Sweets(Posted 1+ years ago)

 Stars get dimmer when you move - shame.


Andres(Posted 1+ years ago)

 I see only one ball circling around me and a big white sphere around the camera.


Rook Zimbabwe(Posted 1+ years ago)

 ANDRES you probably have nVidia graphics card yes? Why does the LEFT arrow mess this (slightly more complicated) example up?
Code: [Select]
;Spacesphere
Graphics3D 640,480,0,2
camera=CreateCamera()
light=CreateLight()
RotateEntity light,45,45,0

;Create the Texture
width=1024
sptex = CreateTexture(width,width,1+8)
SetBuffer TextureBuffer(sptex)
For a = 1 To 200
Plot Rand(0,width-1),Rand(0,width-1)
Next
SetBuffer BackBuffer()
TextureBlend sptex,5

;Create the Sphere
spbox = CreateSphere(5)
ScaleEntity spbox,1000,1000,1000
EntityTexture spbox,sptex
ScaleTexture sptex,.25,.5
EntityFX spbox,1
FlipMesh spbox
EntityOrder spbox,99999

;Create the Sphere2
spbox2 = CreateSphere(5)
ScaleEntity spbox2,900,900,900
EntityTexture spbox2,sptex
ScaleTexture sptex,.35,.5
EntityAlpha spbox2,.5
FlipMesh spbox2
EntityOrder spbox2,999

ball=CreateSphere(5)

While Not KeyHit(1)
 

 sincos#=sincos#+0.2
 PositionEntity ball,50*Sin(sincos#),25*Cos(sincos#),200*Cos(sincos#)

 If KeyDown(200) Then
TurnEntity camera,-0.35,0,0 ;up key
TurnEntity spbox2,-0.30,0,0 ;up key
EndIf
 If KeyDown(208) Then
TurnEntity camera,0.35,0,0 ;down key
TurnEntity spbox2,0.30,0,0 ;down key
EndIf
 If KeyDown(203) Then
TurnEntity camera,0,0,35,0 ;left key
TurnEntity spbox2,0,0,30,0 ;left key
EndIf
 If KeyDown(205) Then
TurnEntity camera,0,-0.35,0 ;right key
TurnEntity spbox2,0,-0.30,0 ;right key
EndIf

 If KeyHit(17) Then wf=Not wf : WireFrame wf ;W key

RenderWorld

 Text 0,0,"Arrow keys=move camera, W=wireframe"

 Flip
Wend

I don't get it... trying to do the double starfield effect like on Trek... The LEFT ARROW seems to spin madly... all else works!


Stevie G(Posted 1+ years ago)

 Rook - you've left out the decimal points in the 35 & 30  ... there's an extra ", 0" there instead ;)


Rook Zimbabwe(Posted 1+ years ago)

 yipes!!! Thanks Stevie!


Andres(Posted 1+ years ago)

 Rook Zimbabwe: Nope, I have ATI Radeon 9600seTextureBlend sptex,5 ruined the texture, i can't use third (add)blend mode, but it works with second (multiply) [/i]

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal