I've had enough of straight lines.
Posted: Fri Mar 26, 2010 8:54 pm
I mean, seriously, why isn't more work done to get game engines to support proper 4- or 5-point perspective? I couldn't sleep last night, so I figured out one really artistic approach.
Basically, it's a form of raycasting. Camera location is the zero-point, O(0,0). A ray is cast for each pixel, in pre-calculated directions relative to the focus point in the middle of the screen. Since all screen resolutions are divisible by 2, I divide the resolution into quadrants and calculate the angles like this (horizontal example)
These angles are then cosined to x, y and z coordinates of the other end of the ray.
All the rays are then cast. If a ray intersects a triangle that's facing the camera, the pixel is added to the array of the material that's assigned to that triangle.
At rendering, the material arrays are used as clipping masks for material bitmaps which are statically aligned with the viewport. These could be a colour, a pattern, an animation or even a video. Those pixels that did not hit any geometry remain transparent, allowing the background pattern to show.
What is thusly achieved is an interesting shadow puppet play of 3D geometry that has proper perspective in relation to the camera angle used. This system of calculating pixels allows even 360+degree fisheye views. Also, a realistic zoom effect is achieved where geometry changes according to camera angle.
All in all, what do you think? Can this be done? Can this be done with ZGameEditor or should this be done from scratch?
P.S. I am not a programmer, game- or otherwise. I'm an architecture student interested in architectural visualization. This is why I'm interested in a more realistic perspective. I also realize that real lighting with such a system is raytracing and thus too power intensive to consider at this point. Thus the shadow approach.
Basically, it's a form of raycasting. Camera location is the zero-point, O(0,0). A ray is cast for each pixel, in pre-calculated directions relative to the focus point in the middle of the screen. Since all screen resolutions are divisible by 2, I divide the resolution into quadrants and calculate the angles like this (horizontal example)
Code: Select all
horizontal_angle_unit = camera_angle/h_resolution
for (i=0; i<=h_resolution/2; i++){
horizontal_alpha[0] = horizontal_angle_unit
horizontal_alpha[1..n] = horizontal_angle_unit*(2*i+1)
}
All the rays are then cast. If a ray intersects a triangle that's facing the camera, the pixel is added to the array of the material that's assigned to that triangle.
At rendering, the material arrays are used as clipping masks for material bitmaps which are statically aligned with the viewport. These could be a colour, a pattern, an animation or even a video. Those pixels that did not hit any geometry remain transparent, allowing the background pattern to show.
What is thusly achieved is an interesting shadow puppet play of 3D geometry that has proper perspective in relation to the camera angle used. This system of calculating pixels allows even 360+degree fisheye views. Also, a realistic zoom effect is achieved where geometry changes according to camera angle.
All in all, what do you think? Can this be done? Can this be done with ZGameEditor or should this be done from scratch?
P.S. I am not a programmer, game- or otherwise. I'm an architecture student interested in architectural visualization. This is why I'm interested in a more realistic perspective. I also realize that real lighting with such a system is raytracing and thus too power intensive to consider at this point. Thus the shadow approach.