Realtime raytracing in GM? [demo]

Posted by Gordy on Dec. 28, 2011, 5:29 p.m.

well, no; more like, realtime lightmapping.

so, last night i was playing around with a lighting engine i made, and decided to bring it into gm3d. at first i was using the trangle fan, raytrace method, or whatever, but, that's slow as shit.

so, instead i came up with something else and holy hell, it's awesome.

also, the game engine is mine, but teknogame's Action Fists is my source of sprites and inspiration.

so, lookey!

all the lights are realtime, the only drawback is that adding motion to them slows the system down; but they're free to flicker, fade in and out, and change color all in realtime.

hmm, nothing much else to say, just wanted to show you guys.

edit:

though i'd upload a quick demo to show you guys!

(there are a few bugs with the game and i'm aware off nearly all of them, but if you find any, please post!)

download here!

w,a,s,d to move. move mouse to adjust view.

space to jump.

f1 to toggle debug data, esc to view menu.

z to interact with things (you'll see a word appear)

so, collect the keys, grab gems, and get the big diamond!

(be sure to grab a blue magnesium thing from the lamps! (press z when "extinguish" appears))

also, mobs will only chase you if you're in the dark.

Comments

sirxemic 12 years, 11 months ago

Looks good :)

Quote:
the only drawback is that adding motion to them slows the system down
So basically it's realtime in the way that it's possible to recompute parts of the lightmap each frame, but you would not prefer that because it's slow?

Gordy 12 years, 11 months ago

yeah, i can have about 150 "static" lights before i drop below 100 fps; with moving lights, that's limited to about 20.

although, having 5 or so dynamic lights with 100 static lights works fine.

i'll try to think of a better way compute lights that move.

JuurianChi 12 years, 11 months ago

Sonofva.

Moikle 12 years, 11 months ago

does making just one or two lights move slow things down?

if not, then limit the amount of moving lights

Ferret 12 years, 11 months ago

Holy balls that looks great.

Anyway you can have the lights only be calculated while they are in motion and thus have the non-moving ones save calc time?

Gordy 12 years, 11 months ago

well, the lights only calculate once they've moved, so the static ones, don't have to update near at all.

the ones that do move have to recalculate every step or so, so they're a bit slower.

but, in the room seen above there are 70 static lights, and 11 moving ones, and i'm getting about 100fps.

in most cases though, there will be very few lights that need to move.

Moikle 12 years, 11 months ago

100 fps is amazing for something like this.

most people can only see a difference up to about 40-50 fps

svf 12 years, 11 months ago

gzgzgzgzgzgzgz

Alert Games 12 years, 11 months ago

looks awesome :) i hope it gets to become quite useful!

Rob 12 years, 11 months ago

Damn, when I read "Realtime raytracing in GM" I thought you were completely joking…