Transformation Transformation of of Rendering AlgorithmsRendering Algorithms
for Hardware Implementationfor Hardware ImplementationPh.D. Thesis by:Ph.D. Thesis by:
Ali Mohamed Ali AbbasAli Mohamed Ali Abbas
Scientific Supervisor: Scientific Supervisor: Professor Dr. Szirmay-Kalos LászlóProfessor Dr. Szirmay-Kalos László
Department of Control Engineering and Information TechnologyDepartment of Control Engineering and Information TechnologyFaculty of Electrical Engineering and InformaticsFaculty of Electrical Engineering and Informatics
Budapest University of Technology and EconomicsBudapest University of Technology and Economics
Budapest, 200Budapest, 20033..
The outlines of this talkThe 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 solutionsThe 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 renderingIncremental rendering
x
y
z
• Gouraud shading.• Phong shading.
N
LV
Gouraud shadingGouraud shading
Diffuse
X
Y
R,G,BR(X,Y) = a X + bY + c
R(X,Y)
R(X+1,Y) = R(X,Y)
Specular
+a
Ambient
System outline of Gouraud shaderSystem outline of Gouraud shader
Gouraud Gouraud shadingshading
Phong exponent = 20
168 triangles 374 triangles 690 trianglesTessellation level
Phong shadingPhong shading
X
Y
R,G,B
N(X,Y) = a X + bY + c
L(X,Y) = · · · ·
V(X,Y) = · · · ·
N(X,Y)
N VL
• vector interpolation• vector normalization• rendering equation
System outline of Phong shaderSystem outline of Phong shader
PhongGouraud
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
General framework (Thesis 1)General framework (Thesis 1)
Incremental concept for Incremental concept for quadratic and linear functionsquadratic 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)
+
+
I (X +1,Y) = I (X,Y) 2T5 .
PublicationsPublications1. 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)Filtered Line Drawing (Thesis 2)
Bresenham’s
Box-filtering
Incremental cone-filtering
(Stair-like jaggies)
Cone filtering of linesCone filtering of lines
(ΔX)2 + (ΔY) 2
ΔXD = d . cos Φ =
DH = (1 - d) . cos Φ = - D + ΔD
DL = (1 + d) . cos Φ = D + ΔD
D(X+1) = D(X) +
D(X+1) = - D(X) + (ΔX)2 + (ΔY) 2
= - D(X) + ΔD+
ΔX - ΔY = D(X) + ΔD-
= d . ΔD
d .
ΔY
(ΔX)2 + (ΔY) 2
Block scheme of incremental cone-filteringBlock 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 Spherical Interpolation for Phong shading (Thesis 3)for Phong shading (Thesis 3)
X
Y
R,G,B
N(X,Y) = a X + bY + c
L(X,Y) = · · · ·
V(X,Y) = · · · ·
N(X,Y)
N VL
• vector interpolation• vector normalization• rendering equation
Linear interpolation + Normalization Linear interpolation + Normalization Spherical Interpolation Spherical Interpolation
u(t) = sin (1-t)sin
u1 +sin tsin ·u2
u1 · u2 = cos
|u(t)|2 = 1
u1 ·u(t) = cos t
u2 ·u(t) = cos (1 - t)
·
For uniform interpolation the followingequations must be proven for u(t):
Simultaneous spherical Simultaneous spherical interpolation of a pair of vectorsinterpolation of a pair of vectors
cos θ(t) = u(t) · v(t)
cos θ(t) = u'(t) · v1
u'2 expressed by quaternion multiplication.
rotating u2 by composition its own transformation and inverse
transformation of v1 to v2
Iout = Ie + ka · Ia + Iin(L) · kd · cos θL + Iin(L) · ks · coscosn n δδ
Calculation of specular reflection for Calculation of specular reflection for Blinn BRDF and single light-sourceBlinn BRDF and single light-source
cos θ(t) = u'(t) · v1 =sin (1-t)
sin (u1 · v1 ) +
sin tsin · (u'2 · v1)·
cos θ(t) = A · cos (t - α)
Iin(L)·ks · (N ·H) =
Iin(L) · ks · An · cosn (t - α)
C
cosn (t - α): exponentiation with a non-constant n
Solution: cosn x cos2 ax
cosn x, for n = 5,10,50,100,500
cos2 ax, for a = 1.45,1.98,2.76
Elimination of the exponentiationElimination of the exponentiation
na
2 5 10 20 50 100 5001.0000 1.4502 1.9845 2.7582 4.3143 6.0791 13.5535
Table of correspondence between n and a:
n=5, a=1.4502 n=500, a=13.5535
0
0
cosn x ·sin x dx cos2 ax ·sin x dx2
2a
Correspondence of Correspondence of nn and and aa
cos2 ax for a = 1.4502, 1.9845, 2.7582
cosn x for n = 5,10,20
Evaluation of the visual accuracy of the functions cosn x cos2 ax
6 bits4 bits
Quantization errors of address/data bits by cos2 ax
6 bits4 bits
cos2 ax cos2 ax
cos2 axcos2 ax
cos2 x cos2 x
Block scheme of spherical interpolationBlock 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 Quadratic Interpolation for Phong shading (Thesis 4)for Phong shading (Thesis 4)
X
Y
R,G,B
N(X,Y) = a X + bY + c
L(X,Y) = · · · ·
V(X,Y) = · · · ·
N(X,Y)
N VL
• vector interpolation• vector normalization• rendering equation
I1
I12
I23
I13
I3
I2
Quadratic interpolation 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 .
Error control
I33
Subdivision
Hardware implementationHardware implementationI(X,Y)
I (X,Y)
2T5
Register
Register
X Counter
X
Xstart
Clk
Y Counter
Y1 Istart (X,Y)
Register
2(T5 A2start + T4 Astart + T3 )
Istart (X,Y)
Register
I (Xstart ,Y)
Register
2T5 Astart + T4
Y
The corresponding between pixel and texel coordinates is obtained by a homogeneous linear transformation.
Linear
u
v
X
Y
x
yz
auX+buY+cu
avX+bvY+cv
dX+eY+f
dX+eY+f
u =
v =
,
.
Quadratic interpolation in texturing (Thesis 4.2)
Texture space Screen space
Real world
Linear and quadratic Linear and quadratic texturingtexturingLinearLinear QuadraticQuadratic
System outlineSystem outlineof quadraticof quadraticinterpolationinterpolation
Gouraud Phong QuadraticSimulation results of quadratic interpolationSimulation results of quadratic interpolation
PublicationsPublications1. 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 17 th.
Spring Conference on Computer Graphics”, Budmerice, Slovakia, April 2001.
Hardware support for Hardware support for global illumination (Thesis 5)global illumination (Thesis 5)
Local illumination Local illumination + ambient term
Global illumination
Radiance transfer by transillumination bufferRadiance transfer by transillumination buffer
Transillumination image buffer
Random, global direction
1
2
3
3
1 3
1 2 3
2
- 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 illuminationBlock 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.
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.
SummarySummary
Simulation environments:– the proposed algorithms first simulated in software using C++,
then transformed 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
Simulation, applicationSimulation, application