Just got done coding a small raycaster like the old Castle Wolfenstein - well, not the oldest Castle Wolfenstein. First one was in text mode and use the ASCII table for graphics and the PC speaker for digital sound- anyone remember this great game - best game I had on my PCjr. Well, nuff nostalgia.
I'm wondering how to raycast windows and doors with windows on one pass. I know how to floor map so can I use the same function to determine what y coord I'm on in my raycaster?
Riight now it only casts rays at one level, but I don't need it to be a voxel-type caster I just need an algorithm that will tell me what y texel I'm on. If the texel is transparent, continue casting the ray, if not - stop since we've hit a wall.
For voxels I use a 2D caster with heightmaps:
Code:int v1=HeightMap[dry>>8+drx]; int v2=HeightMap[dry>>8+(drx+1)]; int v3=HeightMap[(dry+1)>>8+drx]; int v4=HeightMap[(dry+1)>>8+(drx+1)]; //Bilinear filter the heights based on distance in cell on x and z int y=BI(v1,v2,v3,v4,fx,fz); int ViewHeight=-y+ManHeight; //ManHeight is height of viewer int screeny=((y+ViewHeight)*PerspScale)/dist+halfscreenheight;
But I don't really need wall heights in my code since it is not a DOOM style caster. And I don't want to cast in 3 dimensions either (dry=-tan(VFOV/2); if (dry<VoxelHeight) ...) cuz it's too slow.
Anyone have any suggestions?



LinkBack URL
About LinkBacks


