350 likes | 473 Views
Transformation of Rendering Algorithms for Hardware Implementation. Ph.D. Thesis by: Ali Mohamed Ali Abbas Scientific Supervisor: Professor Dr. Szirmay-Kalos László Department of Control Engineering and Information Technology Faculty of Electrical Engineering and Informatics
E N D
Transformation of Rendering Algorithmsfor Hardware Implementation Ph.D. Thesis by: Ali Mohamed Ali Abbas Scientific Supervisor: Professor Dr. Szirmay-Kalos László Department of Control Engineering and Information Technology Faculty of Electrical Engineering and Informatics Budapest University of Technology and Economics Budapest, 2003.
The outlines of this talk • General rendering schemes. • Problems of current rendering approaches:- low quality, simple, hardware supported. - high quality, complex, not hardware supported. The main aim of this thesis is to convert high quality complex algorithms to make them appropriate for hardware realization.
The proposed solutions - general framework (Thesis 1)- filtered line drawing (Thesis 2)- spherical interpolation for Phong shading (Thesis 3)- quadratic interpolation for Phong shading and texturing (Thesis 4)- hardware support for global illumination (Thesis 5)
Incremental rendering • Gouraud shading. • Phong shading. L V y N z x
Specular Gouraud shading R(X,Y)= a X + bY + c R,G,B Y R(X,Y) + a R(X+1,Y)= R(X,Y) X Ambient Diffuse
Gouraud shading Phong exponent = 20 System outline of Gouraud shader Tessellation level 374 triangles 168 triangles 690 triangles
Phong shading • vector interpolation • vector normalization • rendering equation V N L R,G,B Y N(X,Y) N(X,Y) = a X + bY + c L(X,Y) = · · · · V(X,Y) =· · · · X
System outline of Phong shader Phong Gouraud
General framework (Thesis 1) • Surface tessellation, to triangles and line segments • Transformation, projection and shading • Incremental concept, I(X+1,Y) = I(X,Y) + ΔI(X,Y)- reducing algorithms complexity- recursive computation • The accuracy of the fixed-point representation was investigated, and the number of fractional bits was computed
I (X +1,Y)= I (X,Y) 2T5 . + Incremental concept for quadratic and linear functions I(X,Y)= T5 X 2+T4 X Y+T3 Y 2 +T2 X+T1Y+T0 . I(X+1,Y)= I(X,Y)(2T5 X +T4 Y+T5 +T2). + I (X,Y)
Publications 1. A. M. Abbas. “Photorealistic Images in Real-Time”, No 20, 2003, in the Journal of “Industrial Researches’’. 2. A. M. Abbas, L. Szirmay-Kalos, and T. Horváth. “Hardware Implementation of Phong Shading using Spherical Interpolation”. “Periodica Polytechnica”, 44(3-4): 283-301, 2000. 3. A. M. Abbas, L. Szirmay-Kalos, T. Horváth, and T. Fóris. “Quadratic Shading and its Hardware Interpolation”, “Machine GRAPHICS & VISION “, 9(4):625-839, 2000. 4. A. M. Abbas, L. Szirmay-Kalos, T. Horváth, T. Fóris, and G. Szijártó, “Quadratic Interpolation in Hardware Rendering”, In “Spring Conference on Computer Graphics”, Budmerice, Slovakia, April 2001. (Best paper award).
Filtered Line Drawing (Thesis 2) Incremental cone-filtering Box-filtering Bresenham’s (Stair-like jaggies)
Cone filtering of lines ΔX d . D = d . cos Φ = (ΔX)2 + (ΔY) 2 = d . ΔD DH = (1 - d) . cos Φ = - D + ΔD DL = (1 + d) . cos Φ = D + ΔD ΔY D(X+1) = D(X) + (ΔX)2 + (ΔY) 2 = D(X) + ΔD- ΔX - ΔY D(X+1) = - D(X) + (ΔX)2 + (ΔY) 2 = - D(X) + ΔD+
Block scheme of incremental cone-filtering Publications: 1. A. M. Abbas. “On 2D Line Scan Conversion”.In “Conference on The Latest Results in Information Technology”. IIT, Technical University of Budapest, Hungary, 1998. 2. A. M. Abbas. “Photorealistic Images in Real-Time”. No 20, 2003, in the Journal of “Industrial Researches’’.
Spherical Interpolation for Phong shading (Thesis 3) • vector interpolation • vector normalization • rendering equation V N L R,G,B Y N(X,Y) N(X,Y) = a X + bY + c L(X,Y) = · · · · V(X,Y) =· · · · X
Linear interpolation + Normalization Spherical Interpolation sin t sin (1-t) u1 + ·u2 u(t) = · sin sin u1 ·u2=cos For uniform interpolation the following equations must be proven for u(t): |u(t)|2 = 1 u1 ·u(t) = cos t u2 ·u(t) = cos (1 - t)
cos θ(t) = u(t) · v(t) Simultaneous spherical interpolation of a pair of vectors cos θ(t) = u'(t) · v1 u'2 expressed by quaternion multiplication. rotating u2 by composition its own transformation and inverse transformation of v1to v2
Calculation of specular reflection for Blinn BRDF and single light-source sin t sin (1-t) (u1 ·v1 ) + · (u'2 · v1) cos θ(t) = u'(t) · v1 = · sin sin cos θ(t) = A · cos (t - α) Iout = Ie + ka · Ia + Iin(L) · kd · cos θL + Iin(L) ·ks·cosn δ Iin(L)·ks· (N ·H) = Iin(L) · ks·An · cosn (t - α) C
Elimination of the exponentiation cosn (t - α):exponentiation with a non-constantn Solution:cosn x cos2 ax cos2 ax, for a = 1.45,1.98,2.76 cosn x, for n = 5,10,50,100,500
n 2 10 500 20 5 50 100 a 1.0000 1.4502 13.5535 6.0791 1.9845 2.7582 4.3143 Correspondence of n and a 2 cosn x ·sin x dx cos2 ax ·sin x dx 2a 0 0 Table of correspondence betweennanda: n=500, a=13.5535 n=5, a=1.4502
Evaluation of the visual accuracy of the functions cosn xcos2 ax cosn x for n = 5,10,20 cos2 ax for a = 1.4502, 1.9845, 2.7582
Quantization errors of address/data bits by cos2 ax cos2 x cos2 x 4 bits 6 bits cos2 ax cos2 ax 6 bits 4 bits cos2 ax cos2 ax
Block scheme of spherical interpolation Publications: 1. A. M. Abbas, L. Szirmay-Kalos, and T. Horváth. “Hardware Implementation of Phong Shading using Spherical Interpolation”. “Periodica Polytechnica”, 44(3-4):283--301, 2000.
Quadratic Interpolation for Phong shading (Thesis 4) V N • vector interpolation • vector normalization • rendering equation L R,G,B Y N(X,Y) N(X,Y) = a X + bY + c L(X,Y) = · · · · V(X,Y) =· · · · X
I3 I23 I2 I33 I13 Error control I12 Subdivision I1 Quadratic interpolation • The interpolation is done in image space. • The interpolation is not linear, but rather quadratic. • Quadratic form has 6 degrees of freedom. I(X,Y)= T5 X 2+T4 X Y+T3 Y 2 +T2 X+T1Y+T0 .
Istart (X,Y) Register Y S Y Counter Y1 I(Xstart ,Y) Istart (X,Y) Register Register S S 2(T5 A2start + T4 Astart + T3 ) 2T5 Astart + T4 Hardware implementation X I(X,Y) Clk X Counter Register Xstart S I (X,Y) Register S 2T5
Linear Quadratic interpolation in texturing (Thesis 4.2) v Texture space Screen space Y y z Real world u x X The corresponding between pixel and texel coordinates is obtained by a homogeneous linear transformation. auX+buY+cu u = , dX+eY+f avX+bvY+cv . v = dX+eY+f
Linear and quadratic texturing Quadratic Linear System outline of quadratic interpolation
Gouraud Phong Quadratic Simulation results of quadratic interpolation
Publications 1. A. M. Abbas, L. Szirmay-Kalos, T. Horváth, and T. Fóris. “Quadratic Shading and its Hardware Interpolation”. “Machine GRAPHICS & VISION “, 9(4):625--839, 2000. 2. A. M. Abbas, L. Szirmay-Kalos, T. Horváth, T. Fóris, and G. Szijártó. “Quadratic Interpolation in Hardware Rendering”. In “Spring Conference on Computer Graphics”, Budmerice, Slovakia, April 2001, (Best paper award). 3. A. M. Abbas, L. Szirmay-Kalos, T. Horváth, T. Fóris, and G. Szijártó. “Quadratic Interpolation in Hardware Phong Shading and Texture Mapping”. In “IEEE Computer Society Press in the Post-Proceedings of The 17th. Spring Conference on Computer Graphics”, Budmerice, Slovakia, April 2001.
Hardware support for global illumination (Thesis 5) Local illumination Global illumination Local illumination + ambient term
Radiance transfer by transillumination buffer Random, global direction 3 3 1 3 1 3 1 2 2 2 Transillumination image buffer - identifying the patches that are visible from a given patch - solution of global visibility problem, transillumination direction - store in visibility map, extended (or modified ) z-buffer
Block scheme of global illumination Publications: 1. L. Kovács, L. Szirmay-Kalos, and A. M. Abbas. “Testing Global Illumination Methods with Analytically Computable Scenes”. In “Winter School of Computer Graphics”, II:419--426, Plzen, Cz., February 2001. 2.R. Martinez, L. Szirmay-Kalos, M. Sbert, and A. M. Abbas. “Parallel implementation of Stochastic Iteration Algorithms”. In “Winter School of Computer Graphics”, II:344--351, Plzen, Cz., February 2001.
Summary • Thesis 1:- general methodology based on incremental concept. • Thesis 2:- anti-aliased line drawing algorithm with simple operations • Thesis 3:- single cosine function (reduced number of dot-products) - no normalization or scalar exponentiation are required • Thesis 4:- approximates non-linear functions (Phong shading or texturing). - simple for hardware implementation. - arbitrary BRDF models.- independent of the number of light sources. • Thesis 5:- speedup global illumination.
Simulation, application • Simulation environments: • the proposed algorithms first simulated in software using C++,thentransformed to hardware design, specified in VHDL and simulated in Model-Technology environments assuming the delay times of a real FPGA device. • the results demonstrate that, these hardware schemes could provide appropriate pixel drawing time, enough for real-time rendering These hardware schemes have not been build yet • Possible applications of the results: • Development of new hardware, • Efficient CPU level and vertex/pixel shader level program development. Thank you very much for your attention