# Help, need help with RAYTRACER, please someone HELP

[blue]
I wanted to make a 3D game but I don't know how to make the engine, and I don't want to use Direct3D or OpenGL, I just want to use MS-DOS. I got some theoryes about mathematical projections with vectors and everything, but I don't understand anything. Can someone explain to me mot-a-mot, step-by-step, and like I wouldn't know nothing about mathematics (which is [green]NOT ENTIRELY[/green] true) .
Please I really want to make this game and to be a freeware program.
[/blue]
[red]
P L E A S E
[/red]

• : [blue]
: I wanted to make a 3D game but I don't know how to make the engine, and I don't want to use Direct3D or OpenGL, I just want to use MS-DOS. I got some theoryes about mathematical projections with vectors and everything, but I don't understand anything. Can someone explain to me mot-a-mot, step-by-step, and like I wouldn't know nothing about mathematics (which is [green]NOT ENTIRELY[/green] true) .
: Please I really want to make this game and to be a freeware program.
: [/blue]
: [red]
: P L E A S E
: [/red]
:
:
:
:
:
:
:
Did you know that making a fast engine is a really hard thing?
I could make a slow one, but if you'll need planes and textures, it's
almost impossible (for me anyway).

Then the thing your asking is that someone should teach you how to do
such thing. If your lucky someone will, but I think most people have
other things to do.

[b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]

• : : [blue]
: : I wanted to make a 3D game but I don't know how to make the engine, and I don't want to use Direct3D or OpenGL, I just want to use MS-DOS. I got some theoryes about mathematical projections with vectors and everything, but I don't understand anything. Can someone explain to me mot-a-mot, step-by-step, and like I wouldn't know nothing about mathematics (which is [green]NOT ENTIRELY[/green] true) .
: : Please I really want to make this game and to be a freeware program.
: : [/blue]
: : [red]
: : P L E A S E
: : [/red]
: :
: :
: :
: :
: :
: :
: :
: Did you know that making a fast engine is a really hard thing?
: I could make a slow one, but if you'll need planes and textures, it's
: almost impossible (for me anyway).
:
: Then the thing your asking is that someone should teach you how to do
: such thing. If your lucky someone will, but I think most people have
: other things to do.
:
: [b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]
:
:

[blue]
Thank you [b]IDK[/b], for your direct approach, but all I want to know is how do I apply Mathematics in such a program to check if a ray hits a triangle, and return a certain color, I'm not asking for textures or shading or transparency. And I know that it is very hard to create a raytracer (an engine) because it is to do with hard algorithms and determinants and other things, but I just wondered if someone would help me.

If you could help me I'd appreciate it, if not there's not such a big deal (I can live with it) [b]:)[/b]
[/blue]

• I got some math's on how to view some 3D.

It's in basic though...
It shouldn't be to hard to understand...
[code]
DEFINT A 'makes all var's that begins with A an INT
DEFSNG B-Z 'the same but B-Z are single precision
TYPE threeDdot
x AS SINGLE
y AS SINGLE
z AS SINGLE
c AS INTEGER
Bx AS SINGLE
By AS SINGLE
dx AS SINGLE
dy AS SINGLE
dz AS SINGLE
mas AS SINGLE
END TYPE
di = 100 'distance
num = 3 'number of particles
ss = .1 'start stepsize
SCREEN 13
'palette
OUT &H3C8, 0
FOR a = 0 TO 63
OUT &H3C9, a
OUT &H3C9, a
OUT &H3C9, a
NEXT
FOR a = 0 TO 63
OUT &H3C9, a
OUT &H3C9, 0
OUT &H3C9, 0
NEXT
FOR a = 0 TO 63
OUT &H3C9, 0
OUT &H3C9, 0
OUT &H3C9, a
NEXT
FOR a = 0 TO 63
OUT &H3C9, a
OUT &H3C9, a
OUT &H3C9, 0
NEXT

'declare and init matrix
DIM d(num) AS threeDdot
d(1).x = 0
d(1).y = 0
d(1).z = 0
d(1).dx = 0
d(1).dy = .09
d(1).c = 1
d(1).mas = .5
d(2).x = 10
d(2).y = 0
d(2).z = 0
d(2).dx = 0
d(2).dy = -.09
d(2).c = 2
d(2).mas = .5
d(3).x = 5
d(3).y = 0
d(3).z = 0
d(3).dx = 0
d(3).dy = -.4
d(3).c = 3
d(3).mas = .1

'main loop
DO
'keys
a\$ = UCASE\$(INKEY\$)
IF a\$ = "A" THEN xa = xa + ss
IF a\$ = "D" THEN xa = xa - ss
IF a\$ = "W" THEN ya = ya + ss
IF a\$ = "S" THEN ya = ya - ss
IF a\$ = "Q" THEN za = za + ss
IF a\$ = "E" THEN za = za - ss
IF a\$ = "M" THEN am = am + 1
IF am > 5 THEN am = 0
IF a\$ = "+" THEN di = di + ss * 10
IF a\$ = "-" THEN di = di - ss * 10
IF a\$ = "," THEN ss = ss + .01
IF a\$ = "." THEN ss = ss - .01
IF a\$ = "I" THEN ap = 1: 'get info of particles
IF a\$ = " " THEN CLS
IF a\$ = CHR\$(27) THEN END
'calc fps and print approximately info on screen every second
fps = fps + 1
IF TIMER - t > 1 THEN t = TIMER: COLOR 63: LOCATE 1, 1: PRINT fps; CINT(ss * 100) / 100; CINT(di); CINT(xa * 100) / 100; CINT(ya * 100) / 100; CINT(za * 100) / 100; am: fps = 0

'particle loop
FOR a = 1 TO num
'universe calculations
'move particle
d(a).x = d(a).x + d(a).dx
d(a).y = d(a).y + d(a).dy
d(a).z = d(a).z + d(a).dz
'calc gravity force for each particle on each particle
FOR b = 1 TO num
IF NOT (b = a) THEN
r = (d(a).x - d(b).x) ^ 2 + (d(a).y - d(b).y) ^ 2 + (d(a).z - d(b).z) ^ 2
d(b).dx = d(b).dx + (d(a).x - d(b).x) / r * (d(a).mas / d(b).mas) / 100
d(b).dy = d(b).dy + (d(a).y - d(b).y) / r * (d(a).mas / d(b).mas) / 100
d(b).dz = d(b).dz + (d(a).z - d(b).z) / r * (d(a).mas / d(b).mas) / 100
'melt
IF INT(d(a).x) = INT(d(b).x) AND INT(d(a).y) = INT(d(b).y) AND INT(d(a).z) = INT(d(b).z) THEN
d(a).dx = d(a).dx * d(a).mas + d(b).dx * d(b).mas
d(a).dy = d(a).dy * d(a).mas + d(b).dy * d(b).mas
d(a).dz = d(a).dz * d(a).mas + d(b).dz * d(b).mas
d(a).mas = d(a).mas + d(b).mas
d(a).c = d(a).c * (d(a).mas > d(b).mas) + d(b).c * d(a).c * (d(a).mas <= d(b).mas)
num = num - 1
PSET (d(b).Bx, d(b).By), 0
FOR c = b TO num
d(c) = d(c + 1)
NEXT
PRINT num: BEEP: SLEEP
EXIT FOR
END IF
END IF 'star(a).mas * star(b).mas / r
NEXT

'calc coordinates
Ty = ((d(a).y * COS(xa)) - (d(a).z * SIN(xa)))
Tz = ((d(a).y * SIN(xa)) + (d(a).z * COS(xa)))
Tx = ((d(a).x * COS(ya)) - (Tz * SIN(ya)))
Tz = ((d(a).x * SIN(ya)) + (Tz * COS(ya)))
Ox = Tx
Tx = ((Tx * COS(za)) - (Ty * SIN(za)))
Ty = ((Ox * SIN(za)) + (Ty * COS(za)))
Nx = INT(128 * (Tx) / (di - (Tz))) + 160
Ny = INT(100 - (128 * Ty) / (di - (Tz)))

'calc color
ac = a + 1
cc = ABS(FIX((Tz + 128) / 4)) + d(a).c * 64

'move particle
SELECT CASE am
CASE 0'palette color
PSET (d(a).Bx, d(a).By), 0
d(a).Bx = Nx
d(a).By = Ny
PSET (Nx, Ny), cc
CASE 1'palette color with flash
PSET (Nx, Ny), cc
PSET (d(a).Bx, d(a).By), 0
d(a).Bx = Nx
d(a).By = Ny
CASE 2'smoke (need to be at least a million i think)
PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) + (POINT(d(a).Bx, d(a).By) > 0)
d(a).Bx = Nx
d(a).By = Ny
PSET (Nx, Ny), POINT(Nx, Ny) + 1
CASE 3'smoke with flash
PSET (Nx, Ny), POINT(Nx, Ny) + 1
PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) + (POINT(d(a).Bx, d(a).By) > 0)
d(a).Bx = Nx
d(a).By = Ny
CASE 4'smoke trail (use space to clear)
PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) - (POINT(d(a).Bx, d(a).By) = 0)
d(a).Bx = Nx
d(a).By = Ny
PSET (Nx, Ny), POINT(Nx, Ny) + 1
CASE 5'smoke trail with flash
PSET (Nx, Ny), POINT(Nx, Ny) + 1
PSET (d(a).Bx, d(a).By), POINT(d(a).Bx, d(a).By) - (POINT(d(a).Bx, d(a).By) = 0)
d(a).Bx = Nx
d(a).By = Ny
END SELECT

IF ap THEN COLOR 63: PRINT Nx; Ny; Tz; cc
NEXT
ap = 0
FOR zzz = 0 TO 10000: NEXT
'SLEEP
LOOP[/code]

[b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]

• : : : [blue]
: : : I wanted to make a 3D game but I don't know how to make the engine, and I don't want to use Direct3D or OpenGL, I just want to use MS-DOS. I got some theoryes about mathematical projections with vectors and everything, but I don't understand anything. Can someone explain to me mot-a-mot, step-by-step, and like I wouldn't know nothing about mathematics (which is [green]NOT ENTIRELY[/green] true) .
: : : Please I really want to make this game and to be a freeware program.
: : : [/blue]
: : : [red]
: : : P L E A S E
: : : [/red]
: : :
: : :
: : :
: : :
: : :
: : :
: : :
: : Did you know that making a fast engine is a really hard thing?
: : I could make a slow one, but if you'll need planes and textures, it's
: : almost impossible (for me anyway).
: :
: : Then the thing your asking is that someone should teach you how to do
: : such thing. If your lucky someone will, but I think most people have
: : other things to do.
: :
: : [b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]
: :
: :
:
: [blue]
: Thank you [b]IDK[/b], for your direct approach, but all I want to know is how do I apply Mathematics in such a program to check if a ray hits a triangle, and return a certain color, I'm not asking for textures or shading or transparency. And I know that it is very hard to create a raytracer (an engine) because it is to do with hard algorithms and determinants and other things, but I just wondered if someone would help me.
:
: If you could help me I'd appreciate it, if not there's not such a big deal (I can live with it) [b]:)[/b]
: [/blue]

I've been playing around with 3D for a couple years on and off. Right now I'm trying to implement Texture Mapping. Anyways, haven't touched raytracing much at all, but there are some really good tutorials (pascal coding) here and information about 3D stuff & more:

http://www.qzx.com/pc-gpe/

Phat Nat
• : : : : [blue]
: : : : I wanted to make a 3D game but I don't know how to make the engine, and I don't want to use Direct3D or OpenGL, I just want to use MS-DOS. I got some theoryes about mathematical projections with vectors and everything, but I don't understand anything. Can someone explain to me mot-a-mot, step-by-step, and like I wouldn't know nothing about mathematics (which is [green]NOT ENTIRELY[/green] true) .
: : : : Please I really want to make this game and to be a freeware program.
: : : : [/blue]
: : : : [red]
: : : : P L E A S E
: : : : [/red]
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : Did you know that making a fast engine is a really hard thing?
: : : I could make a slow one, but if you'll need planes and textures, it's
: : : almost impossible (for me anyway).
: : :
: : : Then the thing your asking is that someone should teach you how to do
: : : such thing. If your lucky someone will, but I think most people have
: : : other things to do.
: : :
: : : [b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]
: : :
: : :
: :
: : [blue]
: : Thank you [b]IDK[/b], for your direct approach, but all I want to know is how do I apply Mathematics in such a program to check if a ray hits a triangle, and return a certain color, I'm not asking for textures or shading or transparency. And I know that it is very hard to create a raytracer (an engine) because it is to do with hard algorithms and determinants and other things, but I just wondered if someone would help me.
: :
: : If you could help me I'd appreciate it, if not there's not such a big deal (I can live with it) [b]:)[/b]
: : By for now AddyK.
: : [/blue]
:
: I've been playing around with 3D for a couple years on and off. Right now I'm trying to implement Texture Mapping. Anyways, haven't touched raytracing much at all, but there are some really good tutorials (pascal coding) here and information about 3D stuff & more:
:
: http://www.qzx.com/pc-gpe/
:
: Phat Nat
:
[blue]
Thanks everybody.
[/blue]