Realtidsrendering Av Hud Daniel Holst
Total Page:16
File Type:pdf, Size:1020Kb
LiU-ITN-TEK-A--17/019--SE Realtidsrendering av hud Daniel Holst 2017-06-09 Department of Science and Technology Institutionen för teknik och naturvetenskap Linköping University Linköpings universitet nedewS ,gnipökrroN 47 106-ES 47 ,gnipökrroN nedewS 106 47 gnipökrroN LiU-ITN-TEK-A--17/019--SE Realtidsrendering av hud Examensarbete utfört i Medieteknik vid Tekniska högskolan vid Linköpings universitet Daniel Holst Handledare Apostolia Tsirikoglou Examinator Jonas Unger Norrköping 2017-06-09 Upphovsrätt Detta dokument hålls tillgängligt på Internet – eller dess framtida ersättare – under en längre tid från publiceringsdatum under förutsättning att inga extra- ordinära omständigheter uppstår. Tillgång till dokumentet innebär tillstånd för var och en att läsa, ladda ner, skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat för ickekommersiell forskning och för undervisning. Överföring av upphovsrätten vid en senare tidpunkt kan inte upphäva detta tillstånd. All annan användning av dokumentet kräver upphovsmannens medgivande. För att garantera äktheten, säkerheten och tillgängligheten finns det lösningar av teknisk och administrativ art. Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsman i den omfattning som god sed kräver vid användning av dokumentet på ovan beskrivna sätt samt skydd mot att dokumentet ändras eller presenteras i sådan form eller i sådant sammanhang som är kränkande för upphovsmannens litterära eller konstnärliga anseende eller egenart. För ytterligare information om Linköping University Electronic Press se förlagets hemsida http://www.ep.liu.se/ Copyright The publishers will keep this document online on the Internet - or its possible replacement - for a considerable time from the date of publication barring exceptional circumstances. The online availability of the document implies a permanent permission for anyone to read, to download, to print out single copies for your own use and to use it unchanged for any non-commercial research and educational purpose. Subsequent transfers of copyright cannot revoke this permission. All other uses of the document are conditional on the consent of the copyright owner. The publisher has taken technical and administrative measures to assure authenticity, security and accessibility. According to intellectual property law the author has the right to be mentioned when his/her work is accessed as described above and to be protected against infringement. For additional information about the Linköping University Electronic Press and its procedures for publication and for assurance of document integrity, please refer to its WWW home page: http://www.ep.liu.se/ © Daniel Holst LINKOPING¨ UNIVERSITY Real-time rendering of skin by Daniel Holst June 2017 LINKOPING¨ UNIVERSITY Abstract by Daniel Holst In this thesis the topic of subsurface scattering is examined. A couple of methods to accomplish this in real-time applications will be explained and implemented in the game engine Stingray. The main topic is to get realistic skin for human characters and for an artist to be able to get the desired look in the editor. The implementation is divided into two parts where on takes care of the light from light sources in front of the object in order to create a smooth look. The other step handles light sources that are behind the object and contributes through light that passes through the object. These methods have to be combined in a good way after this to create a physically correct contribution. The last step is to optimize the solutions so it works well for a real-time game engine. Acknowledgements I would like to thank everyone at Autodesk for a great time and much support during my time there and especially my supervisor Jim, who has helped me and been a great support throughout the entire thesis work. ii Contents Abstract i Acknowledgements ii List of Figures v 1 Introduction 1 1.1 Human skin ................................... 1 1.2 Real-time vs offline rendering ......................... 2 1.3 Stingray ..................................... 2 1.4 Used content .................................. 3 1.5 Related work .................................. 3 2 Background 5 2.1 Light transport ................................. 5 2.2 Subsurface scattering .............................. 6 3 Method 7 3.1 Front light scattering .............................. 7 3.2 Density dependent color ............................ 8 3.3 Back light scattering .............................. 10 3.3.1 Object depth and transmittance profile . 12 4 Implementation 13 4.1 Subsurface effect ................................ 13 4.2 Back light scattering .............................. 15 4.3 Optimization steps ............................... 17 5 Results 18 5.1 Front light effect ................................ 18 5.2 Translucency .................................. 19 6 Discussion 23 6.1 Optimization .................................. 23 6.2 Different skin colors .............................. 24 6.3 Future work ................................... 25 iii Contents iv 7 Conclusion 26 List of Figures 1.1 When light passes through thin parts of the skin the red color is very visible. Image from [7]. ............................ 2 1.2 The model head from the beginning. .................... 3 1.3 Diffusion profile for human skin. It can be seen here how the red color gets scattered more then green and blue. Image from [5]. 4 2.1 Difference between the normal brdf model and the bssrdf model. Image from [7]. .................................... 6 2.2 An illustration of how the light can bounce around inside the skin. Image from [7]. .................................... 6 3.1 Illustration of how the blur method works. Image from [2]. 9 3.2 Illustration of the density method. ...................... 10 3.3 Overview of direct and translucency lighting vectors. Image from [9]. 11 3.4 The color range that can be obtained from the transmittance profile based on the distance the light travels through the object. Image from [8]. 12 4.1 To big kernel causes some unwanted artifacts that can be seen by the edges for the ear here for example. ...................... 14 4.2 UI for the density dependent subsurface scattering method . 15 4.3 The color contribution from translucency using depth and the transmit- tance profile tested on a cube. ......................... 16 5.1 The blur method applied on the model to the right compared to the original model to the left. ........................... 19 5.2 The human skin represented with the density dependent method to the right compared to original model to the left. 19 5.3 The difference between passing the specular light through as normal (left) or through the blurring pass (right). ..................... 20 5.4 Two different translucency gradients achieved from the input colors. The top one is created to mimic the gradient of human skin. 21 5.5 The translucency contribution for the two methods compared to without. Original left, Frostbite method middle, method using depth right. 21 5.6 The different methods tested on the Stanford bunny . 22 5.7 The result achieved with the Unreal Engine . 22 6.1 The color change from light Caucasian skin to dark African skin. Image from [12]. .................................... 24 v Chapter 1 Introduction In computer graphics the demands for the visual realism increases as the years go. When rendering scenes it is desired that the light behaves as physically correct as possible. For some surfaces this is rather easy to accomplish with normal lighting models, but for many materials this is not feasible as the light scatters in a complex way. For materials like milk, leaves, wax and human skin all the light does not reflect directly on the surface, but is scattered and enters the interior before it goes out again. The way the light traverse inside the medium depends on various physical factors like density and interaction with other parts of the body like bones. This effect is referred to as subsurface scattering and can be complex to imitate. Materials that have this property is called translucent and most of this report will examine how those materials can be rendered in a good and efficient way for real-time applications. 1.1 Human skin The human skin has a lot of interesting functions and properties. It is the outer covering of our body that protects us against infections and regulates the heat of our body. As the skin is translucent and contains different layers the light enters the skin and bounces around between the layers before it leaves the surface. The different layers in the skin have different purposes and properties causing the light to behave differently. In a lower layer of the skin lies the blood vessels, causing the hint of red. This is especially visible in cases where a strong light source is behind a thin part of the skin, see image 1.1. In order to render human skin and get realistic results these layers needs to be considered in a good way. The properties of the skin are also a bit different from area to area on the body which will cause the appearance to differ. Because of its many special properties it is hard to render skin in a realistic way. 1 2 Figure 1.1: When light passes through thin parts of the skin the red color is very visible. Image from [7]. 1.2 Real-time vs offline rendering The difference between rendering of human skin in real-time applications and offline applications is very big. As the light transport inside skin is so complex it is not possible to do this in a physically correct way in real-time. For real-time implementations a lot of cheating and simplifications need to be done, but good results can still be achieved. For these cases the subsurface scattering effect is often accomplished by doing some post effects after a normal light shading. When rendering movies on the other hand the demands of visual realism is extremely high and then complex methods are used since it does not have to be rendered in real-time. With these methods it can take minutes or hours to render one frame. Methods that are used for offline rendering often use some sort of ray casting algorithm and the light is refracted and traced inside the object in a physically correct way.