Hi, I have one problem and maybe one of You can help me...
Here it is:
I have long ago written quite good raytracer (in 3D space), I/m rewriting it im my spare time into 4D
What have been rewriten:
triangle (ABC) became simplex4D (ABCD)
Localise tree (octtree became sixteen-tree with recursive voxel processing and minimalisation)
Normal compute (cross product of three simplex "edge-vectors" spanned from A)
All rendering stuff, 3D-retina, lod scene, save scene, 6 rotations (XY, XZ, XV, YZ, YV, ZV), all preprocessing
Now wandering how to coompute intersection (ray, simplex)
on 3D it was just ray (x0,y0,z0, dx,dy,dz) intersection with triangle surface ABCD and then checking if intersection was inside triangle - thats all
In 4D looks much more complex.
First try is to get hyper-surface containing simplex (ABCDE), (A,B,C,D are from normal vector, E is distance to (0,0,0,0) as in 3D)
then intersect this surface with ray (x0,y0,z0,v0,dx,dy,dz,dv) - this can be computed I thing (solve linear system)
But how to check if intersection point is within simpex4D?
Second problem.
In 3D my triagle has 3 normals on each vertex (pseud-curvilinear triangel), when intersection was computed, then I had to interpolate normal from NA, NB, NC
This was:
Intersection point is P
Fire line from A to P, it will intersect BC in point D
Interpolate normal from NB and NC using linear interpolation between B and C on point P, then normalize result and call it ND
Then interpolate normal from A and D on point P, normalize it and then I have smooth triangle Phong interpolation...
Think in 4D....
Guessing?
Hav intersection point with simplex: P
Fire from A onto 2D-surface BCD, compute (how) intersection -> becomes Q
With BCD and Q we have already algorithm (as in 3D) using B firing onto CD and having point S
Now C-----S--D interpolation (linear) gives NS, normalize
Now B--Q----S -> gives NQ, normalize
Now A---P---Q -> gives P, then normalize, thus having 3-linear (smooth?) interpolations:
Problems:
1. How to compute P? (ray-simplex intersection)
2. How to determine P is within simplex ABCD
3. How to compute first stage of 3-linear interpolation. fire A-->P -->Q (how to compute Q)?
Thanks