Available online at www.sciencedirect.com Available online at www.sciencedirect.com
Procedia Engineering
ProcediaProcedia Engineering 00 (2012) Engineering 29 000–000 (2012) 1565 – 1572 www.elsevier.com/locate/procedia
2012 International Workshop on Information and Electronics Engineering (IWIEE)
A Method of Real-time Rendering for Subsurface Scattering Based on BRDF Wang Lilia, Li Hongfeia, Ma Zhiqianga* a
State Key Laboratory of Virtual Reality Technology and Systems, Beihang University,Beijing, 100191,China
Abstract Translucent objects are very common in the real world, so the real-time rendering of the translucent objects is a hot research topic in recent years. However, because of the special properties and translucent material and the complexity of interaction with light, it is too difficult to achieve both realistic and real-time. This paper proposes a real-time subsurface scattering rendering method for translucent objects. In the paper, a method of illumination model decomposition for subsurface scattering is proposed first. And then use the BRDF model to approximate the illumination of single subsurface scattering , at the same time improve the traditional rendering equation of the multiple subsurface scattering. Using the technology of deferred shading and parallel computing capability of GPU, which has reduced the integral computation during rendering. This paper has achieved the real-time rendering of subsurface scattering for translucent object without affect the final rendering effect.
© 2011 Published by Elsevier Ltd. Selection and/or peer-review under responsibility of Harbin University of Science and Technology. Keywords: subsurface scattering;translucent material; image space; real-time rendering .
1. Introduction Here follows further instructions for authors The Realistic in the real-time rendering of translucent material plays an essential part in Computer Graphics. Translucent materials are frequently encountered in the natural world. Examples include marble, jade, milk, and leaves, etc. During their interaction with light, in addition to the reflection on the appearance, part of the energy can peer into the inside and spout
* Corresponding author. Tel.: +86-010-82339669; fax: +86-010-82339909. E-mail address:
[email protected].
1877-7058 © 2011 Published by Elsevier Ltd. doi:10.1016/j.proeng.2012.01.174
21566
WangLili/ LiliProcedia et al. / Procedia Engineering 29 000–000 (2012) 1565 – 1572 Wang Engineering 00 (2012)
out from another point after many times of scattering. Such process is known as subsurface scattering. The BSSRDF (Bidirectional Surface Scattering Reflectance Distribution Function) is used to evaluate the physical effect of these materials during rendering. This paper introduces a real-time rendering method that is targeted on the subsurface scattering. The concrete realization includes three aspects: In the first place it’s the decomposition of the illumination model, which is decomposed into Phone-model, scatter-model and compensatory light (reflection); and then it comes to the improvement of subsurface scattering model, which can be divided into single scattering and multiple scattering. The traditional single subsurface scattering is approximated by BRDF(Bidirectional Reflectance Distribution Function) in this paper and the efficiency has been improved by reducing the extensive calculation in the traditional model. And such improvement is predicated on the none-influence to final result. Meanwhile, the Dipole model and the adjustment of relative parameters are used to model the multiple subsurface scattering; Last but nor least is the real-time rendering of subsurface scattering: Both deferred shading and the computing of GPU contribute to the rendering in image space. Afterwards, the approximations to the BRDF in this paper better the efficiency in calculation as well as the realistic. According to the interaction between light and translucent materials, Ishmaru[1] proposed the concept of subsurface scattering by the first time in 1978. However, this method does not directly describe corresponding physical quantity of the object; instead it only describes the relationship between incident flux and outgoing ray. Thus complicated computing is unavoidable in the rendering because we have to simulate ray’s transmission in substance, which is inefficient. Jensen et al[2]. suggested an efficient approach to simulate scattering media by using Dipole diffusion approximation for multiple scattering, with an exact solution for single scattering events. Later Jensen introduced a more efficient two-pass rendering technique for translucent material[3]. They decouple the computation of irradiance at the surface from the evaluation into two passes, where the first pass consists of computing the irradiance at selected points on the surface, and the second pass uses a rapid hierarchical integration technique to evaluate a diffusion approximation based on the irradiance samples. This approach is substantially faster than previous methods, but because of the limitation of the hardware, it can not be conducted on CPU to speed up. Hao[4] introduced a real-time rendering based on spherical harmonics. This approach is an improvement of Jensen’s and it is still a two-stage process. They show how to greatly reduce memory storage requirements for the pre-computed integrals by using reference points with spherical harmonics. In 2005 Wang[5] presented a technique, based on PRT(Pre-computed Radiance Transfer), for interactive rendering of translucent objects under all-frequency environment maps. The paper introduced an approximated single scattering term in the pre-computation, by which the efficiency is largely improved. Wang[6] also suggested a real-time rendering method based on pre-computation. In this approach, the diffused scattering (multiple scattering) in Dipole model is decomposed through PCA and the pre-composed data P is secondary wavelet compressed. Although this method improves efficiency, it needs a great deal of pre-computation, which covers much time and does not suitable for the real-time rendering under active illumination. Green[7] directed a subsurface scattering approximation and made some improvement on illumination model to deal with real-time rendering. Through this method the object against light source can also obtain some illumination, which means through the translucent material, the illumination can achieve a high level of realism. Bastioni[8] has improved Green’s model to achieve better rendering effect. There are also methods[9,10] based on image space. These methods map the object geometric information and light intensity into textures for the further approximate calculation of Jensen method through multi-passes rendering. However, these approaches can only simulate low frequency interactive rates to some extent; it is not a system incorporating all frequency environment lighting.
1567 3
Wang Lili et al.Procedia / ProcediaEngineering Engineering0029(2012) (2012)000–000 1565 – 1572 Wang Lili/
2. Mathematics background In this section, we briefly review the classical BSSRDF formulation proposed by Jensen. This
ur
ur
formulation assumes Lo ( xo , ωo ) is the outgoing radiance at point xo in direction ωo , and the illumination
ur
uur
intensity is formed by single scattering Lss ( xo , ωo ) and multiple scattering Lsm ( xo , ωo )
ur
Lo ( xo , ωo ) =
ur
ur
ur r ur
r
ur
ur
∫ ∫ S ( xi , ωi ; xo , ωo )Li ( xi , ωi )(n ⋅ ωi )d ω i Ax = Lss ( xo , ωo ) + Lsm ( xo , ωo ) i
(1)
A 2π
r
r
Where θ is the outgoing radiance and S ( x , ω ; x , ω ) is the BSSRDF. Thus the total outgoing radiance i
i
o
o
is computed by an integral over incoming directions and area A. It is also the liner combination of single and multiple scattering. zv r
zr
Fig 1. (a) Single Scattering; (b) Multiple Scattering
2.1. Single scattering
ur
The Lss ( xo , ωo ) in formula (1) can be computed by the following formula:
ur
r' r'
∞
Lso ( xo , ωo ) = σ s ( xo ) ∫ Fp (θ )(ω i , ω o ) ∫ e 2π
0
r'
− σ tc
ur
ur
Li ( xi , ωi )dsd ωi
(2)
r'
Where θ is included angle between incident flux ω i and outgoing radiance ω o inside the material, F is the Fresnel term, σ s ( xo ) is the scattering coefficient, and s is the outgoing radiance path. The sketch map of single scattering is shown in Fig 1a. 2.2. Multiple scattering
ur
The Lsm ( xo , ωo ) in formula (1) can be computed through approximation of Dipole model (Fig 1b):
ur 1 r r ur r ur Lsm ( xo , ωo ) = Ft (η , ω i )Rd ( xi − xo ) Ft (η , ω o ) Li ( xi , ωi )( n ⋅ ωi ) dA π
∫
A
Where Ft is the Fresnel term, Rd is diffuse reflectance(See Reference[1] for more details). 3. Our Method
(3)
41568
WangLili/ LiliProcedia et al. / Procedia Engineering 29 000–000 (2012) 1565 – 1572 Wang Engineering 00 (2012)
Computation in this paper includes two sections: the decomposition of illumination model and the adjustments of subsurface scattering. 3.1. Decomposition We need to make a hypothesis on scene in order to better the rendering: Using the lighting source as point source and the ambient light as cubes light source; The general illumination can be turned into local one in computation for the outgoing illumination from the vertex is only affected by neighbor. Therefore, this lighting can be separated into three components: the Phone model under the influence of point source, the subsurface scattering model of translucent materials and compensational transmission. The Phone model equation L phone = Ls + Ld + La shows that Phone lighting L phone is composed by specular reflection component Ls , diffuse reflection component Ld and ambient light component La ; while subsurface scattering is composed by single scattering L ss and multiple scattering Lsm ; and Lcr stands for compensational transmission, which complies with the law of Fresnel. At last we get the rendering equation: Lo= λ1 ( Ls + Ld + La ) + λ2 (λs Lss + λm Lsm ) + λ3 Lcr
(4)
Where λ = (λ1 , λ2 , λ3 ) is weight coefficient of every component. 3.2. The BDRF approximation of single scattering and the adjustment of multiple scattering adjustments 3.2.1. Single scattering Single scattering can be computed through simplifying integral for multiple scattering is the main factor which influences the ultimate effect of subsurface scattering. We use the same sampling in multiple scattering and make intensive sample around the current position, then set up various weight coefficient in accordance with different position to accumulate. The reflection of single incident flux can be turned into many positions and be computed by the reversible optical circuit principle. Here is the simplified equation:
ur
ur
Lss ( xo , ωo ) = ∑ σ j Lij ( xij , ωij )
Where
ur
ur
Lss ( xo , ωo )
is
the
outgoing
radiance
of
(5)
single
scattering
at
point
xo
in
direction ωo . σ = (σ 1 , σ 2 L σ n ) is scattering frequency σ s Computation of coefficient: with the illumination compare of single scattering and BRDF, we’ll get:
ur Lso ( xo , ωo ) ur Lro ( xo , ωo )
r' r'
∞
2π
Fp (ω i , ω o ) ∫ e
ur
∫ ur ur ur ur ( , ) ( , )d ω ⋅ Fp w w L x α ω ∫
2σ s ( xo )
− σ tc s
0
i
2π
o
i
i
ur
Li ( xi , ωi )dsd ωi i
i
≈
2σ s ( xo )
αe
− σ tc s
(6)
so the final equation of single subsurface scattering is:
ur
Lss ( xo , ωo ) =
2σ s ( xo )
αe
− σ tc s
ur
L BRDF ( xo , ωo )
(7)
1569 5
Wang Lili et al.Procedia / ProcediaEngineering Engineering0029(2012) (2012)000–000 1565 – 1572 Wang Lili/
Where F is the Fresnel term, p is phrase function, α is reflection coefficient, s is the distance between the outgoing point and the intersection of incident flux and the reverse extension cord of outgoing ray,
ur
ur
ur
Lss ( xo , ωo ) is the outgoing radiance of single scattering at point xo in direction ωo , and L BRDF ( xo , ωo ) is the
ur
outgoing radiance of BRDF at point xo in direction ωo . 3.2.2. Multiple scattering We make some adjustments to the multiple scattering parameters according to Jensen’s Dipole model. After simplifying formula (3) and (4), we get the final equation. (The illumination model is shown in Fig 1b).
ur
−σ d −σ d ur α ' ⎡ e e ⎤ Lms ( xo , ωo ) ∑ Lij ( xij , ωij ) (σ tr d r + 1) = + z v (σ tr d v + 1) 3 3 ⎥ ⎢ 4π ⎣ σ 't d r σ 't d v ⎦ tr
According to Fig 1b, we get α ' = σ 's / σ 't , σ tr =
r
tr
v
3σ α σ 't , σ 't = σ 's + σ α , σ= 's σ s (1 − g ) ,
r + z r is the distance from the outgoing point to the real light source, while= dv
= dr
2
(8)
2
r 2 + zv2 is
the distance from the outgoing point to virtual light source. 4. Calculation • Set parameters of translucent material Measure the quality of material first because various qualities of the translucent objects can result in various sense of reality. The measured parameter Table1 is shown as follow and the cube lighting is seen in Fig 2. • Rendering texture of the single scattering We draw a full-screen quadrilateral and make approximation to the single subsurface scattering illumination according to formula (5), and then render the results into color texture Lss .
The light source used currently is the scattered light of the cube light box, aiming at calculating the sampling points around the incident light.
ur
= Lso ( xo , ωo )
ur 2σ s ( xo ) ( , ω = L x ∑ α e −σ s BRDF o o ) tc
∑
2σ s ( xo )
αe
− σ tc s
ur
τ
Lij ( xij , ωij ) ⋅ ( N ⋅ H )
(9)
Where λ is weight coefficient, N is normal vector, H is the half horn vector of view vector and normal vector, τ is weak coefficient, and other parameters are the same as above. • Rendering texture of Phone model and the compensate illumination MRT(Multi rendering target) is employed to draw a full-screen quadrilateral under the point light. We make approximation to the reflection and the refracted ray(Follows the Fresnel law), and then render the results into L phone and Lcr . •
Rendering texture of the multiple scattering
61570
WangLili/ LiliProcedia et al. / Procedia Engineering 29 000–000 (2012) 1565 – 1572 Wang Engineering 00 (2012)
A full-screen quadrilateral is drawn under the cube light box. Approximation is made to the multiple subsurface scattering illuminations according to formula (8), and then the result is rendered to color texture Lms . • Rendering texture of the multiple scattering A full-screen quadrilateral is drawn under the cube light box. Approximation is made to the multiple subsurface scattering illuminations according to formula (8), and then the result is rendered to color texture Lms . Table 1 Measured Parameters for Several Materials
σ s [ mm ]
σ α [ mm ]
−1
'
Material
−1
Diffuse Reflectance
η
R
G
B
R
G
B
R
G
B
Sphere
2.29
2.39
1.97
0.003
0.0034
0.046
0.85
0.84
0.53
1.3
Dinosaur
0.15
0.21
0.38
0.015
0.077
0.19
0.31
0.15
0.10
1.3
Bunny
7.38
5.47
3.15
0.0002
0.0028
0.0163
0.98
0.90
0.73
1.3
Dragon
1.09
1.59
1.79
0.013
0.07
0.145
0.81
0.81
0.69
1.3
Fig 2. (a) cube lighting source 1; (b) cube lighting source 2 • Rendering texture of the multiple scattering A full-screen quadrilateral is drawn under the cube light box. Approximation is made to the multiple subsurface scattering illuminations according to formula (8), and then the result is rendered to color texture Lms . • Render the final color and get the final image A full-screen quadrilateral is drawn and final result will be got after the liner accumulation of the color texture in step 2), 3), and 4), which is done based on formula 5). 5. Results
Tests are recorded on an Inter Core (TM)2 2.67GHz computer with 2GB memory and an NVIDIA GeForce GTX 465 1GB graphic card. Our programs are compiled using Shader version 3.0. The cube light source in this experiment is shown Fig 2. Table2 shows the property of the test model and according to the data we can get the conclusion that real-time rendering for subsurface scattering can be completed realized. Although Column1 and Column2 in Fig 3 are models of the same quality, their renderings through cube light source in Fig 3 vary from each other. With Fig 3 we show renderings of models with various qualities and we can better the subsurface scattering by revising relative parameters.
Wang Lili et al.Procedia / Procedia Engineering (2012) 1565 – 1572 Wang Lili/ Engineering 0029 (2012) 000–000 Table 2 The parameters and fps of experiment model
Model
No. of Vertices
No. of Triangles
Frame rate(fps)
Dinosaur
2922
2886
62
Sphere
10199
19800
55
Bunny
36743
69451
50
Dragon
476462
871414
45
Fig 3. Rendering effect of the translucent material from Table2
6. Conclusion and future work
In this paper we have presented a decomposition method of illumination model in all-frequency lighting, which is based on the classical subsurface scattering of Jensen. The traditional single subsurface scattering has been approximated to BRDF in this paper to enhance the rendering efficiency, and relative parameters have been adjusted during multiple scattering to reduce the extensive calculation. The results have shown that the computation in this paper can realize the sense of reality and the real-time rendering of subsurface scattering. One direction for future work is to make subsurface scattering rendering of the translucent material in uneven substance; that is to seek solution of an equation by incorporating multi-layered rendering. Another interesting direction is to take advantage of Jensen’s analytic model and make real-time rendering on transmission of translucent materials. Acknowledgment
This work is the part of Project 043/2009/A2 funded by Macao Science and Technology Development Fund, and is also supported by Beijing Science and Technology Star Plans (No. 2009B09). References
1571 7
81572
Wang LiliProcedia et al. / Procedia Engineering 29000–000 (2012) 1565 – 1572 Wang Lili/ Engineering 00 (2012)
[1] Ishimaru A. Wave Propagation and Scattering in Random Media . New York: Academic Press, 1978 [2] Jensen H W, Stephen R, Marc L, Pat H. A Practical Model for Subsurface Light Transport. ACM SIGGRAPH 2001 [3] Jensen H W, Buhler J. A Rapid Hierarchical Rendering Technique for Translucent Materials. ACM SIGGRAPH 2002 [4] XJ Hao and Amitabh Varshney. Real-time Rendering of Translucent Meshes. ACM Transactions on Graphics, April 2004:120–142 [5] R Wang, John Tran, David Luebke. All-frequency Interactive Relighting of Translucent Objects with Single and Multiple Scattering. ACM Transactions on Graphics, August 2005:1202–1207 [6] R Wang, Ewen C.P, David L, W Hua, QS Peng, HJ Bao, Real-time Editing and Rendering of Translucent Materials with Homogeneous Diffuse BSSRDFS, Journal of Computer-aided Design and Computer Graphics, 2008:993-1000 [7] Green S. Real-time Approximations to Subsurface Scattering[A]. GPU Gems: Programming Techniques, Tips, and Tricks for Real-Time Graphics. Massachusetts: Addison-Wesley, 2004: 263-278 [8] Bastioni M. A Simplified Model for Subsurface Scattering Applied to The Vertex Shader in Blender[EB/OL]. http://www.dedalo-3d.com/, 2005 [9] Hyunwoo Ki, Jihye Lyu, Kyoungsu Oh. Real-Time Approximate Subsurface Scattering on Graphics Hardware [10] Yi Gong,Wei Chen, Long Zhang, Yun Zeng,and Qunsheng Peng. An Approximate Image-Space Approach for Real-time Rendering of Deformable Translucent Objects