• Welcome to Dark Bit Factory & Gravity.
 

3D Starfield

Started by bikemadness, May 06, 2026

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

bikemadness

Done to death, but this is my first.

I finally figuured something out.


star=200
dim r(star)
dim x(star)
dim y(star)
dim l(star)
dim d(star)
dim s(star)
dim m(star)

for a=1 to star
r(a)=int(ran(360))*(pi/180)
l(a)=int(ran(400))+160
d(a)=ran(1)-int(ran(2)) rem height
s(a)=ran(2)+2 rem couples with l(a) s(a)/l(a)
m(a)=.005
next a

x=320
y=256

open window 640,512
repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window

for a=1 to star
x(a)=cos(r(a))/(sin(r(a))+s(a))*l(a)+x
y(a)=d(a)/(sin(r(a))+s(a))*l(a)+y
next a

for a=1 to star
r(a)=r(a)+m(a)
if m(a)>360 m(a)=0
next a

for a=1 to star
dot x(a),y(a)
next a

until (1=0)
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.

Shockwave

Well done, that's great  :)

This is rotating around the Z axis, if you move dots whilst also rotating it gives a nice variation of the effect.
This one is doing a Y rotation whilst moving the plots around:

https://www.youtube.com/watch?v=onO0gKbtGuU


Shockwave ^ Codigos
Challenge Trophies Won:

bikemadness

Thanks. Its taken me years to get head around it.

The first one I saw was on the PS2 demo disc.

The code just blew me away.

I still have a number of those disks.
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.