3 ms·
Fish eye is a feature! ;) https://strlen.com/gfxengine/fisheyequake/ https://strlen.com/gfxengine/fisheyequake/ I noticed it in the examples too, I’m speculati
by dahart 5y ago
Fish eye is a feature! ;) https://strlen.com/gfxengine/fisheyequake/ https://strlen.com/gfxengine/fisheyequake/
I noticed it in the examples too, I’m speculating wildly that the ray cast is even angular steps rather than pinhole projection. Totally reasonable to not correct it, IMO, I’ve long thought we should have more non-linear cameras in games.
- a_e_k 5y agoThat's exactly what it's doing: let rayAngle = player.angle - player.fieldOfView / 2; for(let rayCount = 0; rayCount < screen.width; rayCount++) { // ... SNIP ... // the ray moves at constant increments let rayCos = Math.cos(degreeToRadians(rayAngle)) / precision; let raySin = Math.sin(degreeToRadians(rayAngle)) / precision; // ... SNIP ... // increment the angle for the next ray rayAngle += incrementAngle; } It's also using Euclidean distance rather than planar distance for the apparent wall height calculation.