Full text
A General Illumination Model for Molecular Visualization P. Hermosilla1, P. Vázquez2, A. Vinacua2, T. Ropinski1 1Visual Computing Group, Ulm University, Ulm, Germany 2VIRVIG Group, Universitat Politècnica de Catalunya, Barcelona, Spain Figure 1: Example of using our new diffuse illumination model for molecules. The system uses a regression analysis over a strategically sampled set of spatial configurations to create a set of equations that can be evaluated in real time to shade molecular models based on cylinders and spheres. The images illustrate the application of our illumination model to different representations of the same molecule. Abstract Several visual representations have been developed over the years to visualize molecular structures, and to enable a better understanding of their underlying chemical processes. Today, the most frequently used atom-based representations are the Space-filling, the Solvent Excluded Surface, the Balls-and-Sticks, and the Licorice models. While each of these representations has its individual benefits, when applied to large-scale models spatial arrangements can be difficult to interpret when employing current visualization techniques. In the past it has been shown that global illumination techniques improve the perception of molecular visualizations; unfortunately existing approaches are tailored towards a single visual representation. We propose a general illumination model for molecular visualization that is valid for different representations. With our illumination model, it becomes possible, for the first time, to achieve consistent illumination among all atom-based molecular representations. The proposed model can be further evaluated in real-time, as it employs an analytical solution to simulate diffuse light interactions between objects. To be able to derive such a solution for the rather complicated and diverse visual representations, we propose the use of regression analysis together with adapted parameter sampling strategies as well as shape parametrization guided sampling, which are applied to the geometric building blocks of the targeted visual representations. We will discuss the proposed sampling strategies, the derived illumination model, and demonstrate its capabilities when visualizing several dynamic molecules. CCS Concepts •Human-centered computing →Scientific visualization; •Computing methodologies →Computer graphics; Rendering; 1. Introduction Molecular simulations have become an important pillar of modern research in areas such as biology and chemistry, since running experiments in silico effectively reduces time and resources in traditional wet labs. The output of these simulations is usually one or multiple molecular trajectories composed of hundreds or thousands of steps, whereby for each step a spatial atom arrangement representing the overall shape is stored. Analyzing such data can be a tedious task without the proper tools. Visualization helps by providing insightful visual representations, highlighting specific features and allowing to form new hypothesis based on the data at hand. Nevertheless, to be beneficial it is of utmost importance that the shape of the visualized molecule is unambiguously perceivable. Unfortunately, due to the complex nature of molecules, and This is the peer reviewed version of the following article: Hermosilla, P., Vázquez, P., Vinacua, A., Ropinski, T. A general illumination model for molecular visualization. "Computer graphics forum", Juny 2018, vol. 37, núm. 3, p. 367-378, which has been published in final form at https://doi.org/10.1111/cgf.13426. This article may be used for non-commercial purposes in accordance with Wiley Terms and Conditions for Self-Archiving.
P. Hermosilla et al. / A General Illumination Model for Molecular Visualization the representations typically used to visualize them, unambiguous perception is not always guaranteed. To improve the situation, advanced illumination models have been proposed to increase the perception in such cases [TCM06]. While the light intensity gradient over a surface can provide enough cues to recognize the shape of an object, in cluttered images such local shading is not sufficient to understand the spatial relations of the different structures of the model. Global illumination techniques, on the contrary, are able to provide additional structural cues, and thus facilitate unambiguous perception. Color bleeding is a good example of such a technique since it provides information about the neighboring objects by simulating the reflection of light on their surfaces. Moreover, as indicated by Color Constancy studies [Fos11], it maintains a good perception of the individual objects, a crucial aspect in molecular visualizations. Unfortunately, as they simulate multiple bounces of light in a scene, global illumination models are of high computational complexity. Their recursive nature usually limits them to off-line rendering, making them not suitable for interactive molecular visualization. Nevertheless, in the past, a few techniques successfully approximated global illumination effects for molecular scenes (e.g., [SGG15,SVGR16]). However, due to the fact that existing techniques are limited to Space-filling representations only, until today it has not been possible to achieve consistent illumination when combining different visual representations or switching between them, which are tasks often performed when analyzing molecular simulation data. In this paper, we present the first general illumination model which can be applied to the four most frequently used atom-based molecular representations, namely the Space-filling, the Solvent Excluded Surface, the Balls-and-Sticks, and the Licorice representation. Other existing representation methods, such as Ribbons, are also popular among domain experts. However, they perform a high abstraction of the molecule by removing atomic information. Whilst these models improve the analysis of certain properties of proteins, in this work, we focus on atom-based representations. The presented illumination model employs an analytical solution to the light transport problem between perfectly diffuse convex objects, which makes it applicable in real-time. To obtain our analytical solution, we analyze the high dimensional parameter space implicitly defined by the geometries of the visual representations and employ symbolic regression [SL09] to fit an adequate function. The idea of deriving an analytical solution for light transport through regression analysis is not new [RWG∗13,SVGR16], but previous solutions have focused on single rendering primitives, such as triangles or spheres. While the reported outcomes for these primitives are convincing, the nature of the regression process, which involves learning from a multitude of samples, has until now forbidden the application to more complex geometries consisting of different shapes. To resolve this limitation, we propose effective sampling strategies, which drastically reduce the number of samples to be considered during regression analysis. For an effective sampling, we show first how to reduce the number of samples by limiting ourselves to a set of representative spatial configurations. Then, each configuration is reparameterized based on the nature of the shape of the function that we aim to approximate. We will show that by applying these two strategies, we arrive at a number of samples which is low enough to perform a regression analysis using symbolic regression, while still arriving at high-quality illumination models. To demonstrate the feasibility of the sampling strategies, we apply them to obtain a general illumination model, that can be applied during an interactive visualization process. As the model describes the radiance at one point as the summation of the reflected light by the nearby objects and their visibility, it results in molecular visualizations incorporating global illumination effects. We would like to emphasize, that the proposed illumination model is only one possible area, where the improved sampling strategies enable regression analysis, and that we expect to see more such models to be derived based on these strategies. Thus, the main contributions of this paper are: •Sampling strategies developed to enable regression analysis of illumination data for complex geometric structures composed out of multiple geometric primitives. •A general interactive illumination model for atom-based molecular visualization, which is applicable to the Space-filling, the Solvent Excluded Surface, the Balls-and-Sticks, and the Licorice representation. The remainder of the paper is structured as follows. Section 2 provides an overview of the work related to our approach. Section 3 formalizes light interactions between geometric primitives, such that regression analysis becomes possible. Since analyzing these interactions naively results in a prohibitive number of samples, we introduce sampling strategies to reduce the samples to a practical level in Section 4. Section 6demonstrates how these sampling strategies can be applied to obtain a general illumination model for the targeted visual representations, i.e., Space-filling, Solvent Excluded Surface, Balls-and-Sticks, and Licorice. Then, in Section 7, the real-time algorithm that implements this model is introduced. Section 8presents results obtained for different molecules, and Section 9discusses the limitations of the presented approach. Finally, the paper concludes in Section 10 by summarizing the findings and discussing open future work. 2. Related Work In this section, we will describe the most relevant methods developed to visualize the targeted molecular representations, i.e., Space-filling (SF), Solvent Excluded Surface (SES), Balls-and- Sticks (B&S), and Licorice representations, with a special focus on the perceptual enhancement through advanced illumination effects. Since providing a comprehensive review of molecular visualization techniques is beyond the scope of this paper, we would like to refer the reader to the recent state-of-the-art report published by Kozlíková et al. for this matter [KKF∗16]. Molecular Representations. As different visual representations for molecules exist, they all have their individual benefits and downsides. The Space-filling model provides a good overview of the space occupied by a molecule and its cavities, by representing the atoms as spheres. However, due to this dense representation, it occludes most of the internal structure of the molecule. The Balls-and-Sticks and Licorice models, on the other hand, provide a good balance between information presented and screen foot-print. In these models, the atoms are also represented by spheres and the bonds between atoms are represented by cylinders. In these models the size of the objects is smaller than in the Space-filling, leaving thus enough empty space to visualize the surrounding objects. Solvent Excluded Surfaces are derived from the Space-filling model and, therefore, they present the same benefits. Besides those, they also provide information about the accessibility of the molecule.
P. Hermosilla et al. / A General Illumination Model for Molecular Visualization While many visual representations of molecules employ spheres to depict atoms, the most commonly used technique to render these spheres is by using glyphs [Gum03,RE05,TCM06,SWBG06]. However, some authors used more sophisticated techniques in order to render millions of these particles in real time. Falk et. al [FKE13] presented a system which was able to render large-scale molecular systems by ray-casting a grid-based data structure. Le Muzic et al. [LMPSV14] also developed a technique which is able to render molecular aggregations in real-time. By exploiting the capabilities of modern GPUs, they were able to generate different levels-of- detail on-the-fly. While sphere rendering is sufficient for the SF representation, B&S and Licorice require also the integration of cylindrical primitives, which are also most commonly rendered using glyphs. Tarini et al. [TCM06] and Sigg et al. [SWBG06], both presented in 2006 two such algorithms, while the technique presented by Tarini et al. was limited to orthographic projections. The most commonly used technique to visualize molecular surfaces, such as SES, is by means of triangular meshes [SOS96,TA96,VBJ∗94]. However, this method requires the surface triangulation which yields aliasing problems. A more advanced technique is ray-casting the patches that compose the surface. This technique was first introduced by Krone et al. [KBE09] and has been later also employed for dynamic molecules by Lindow et al. [LBPH10]. Perception Enhancement. Several techniques have focused on enhancing the perception of molecular structures. Tarini et al. [TCM06] for example, developed a technique to generate silhouettes and halos around the atoms and bonds. Hermosilla et al. [HGVV16] also used halos computed from a 3D data structure to highlight drugs during the visualization of docking simulations. Krone et al. [KBE09] improved the perception of molecular structures through a set of techniques that could be combined together, such as unsharp masking the depth buffer, silhouette rendering, fogging or transparencies. Lawonn et al. [LKEP14] used hatching lines on molecular surfaces to convey their shape. Van der Zwan et al. [vdZLBI11] provided a system to perform smooth transitions between different representation models, being able to select the ones that best communicate the shape of the molecule. Parulek et al. [PJR∗14] persented a technique to visualize smooth transitions between sphere-based molecular representations. Real-time Global Illumination. Simulating the light transport in a scene at interactive frame rates is a difficult task due to the recursive nature of the problem. However, several techniques have been developed to approximate it in real-time. For a complete analysis of these techniques, the reader can refer to [RDGK12]. Within this paragraph, we rather focus on those techniques directly tailored towards molecular visualization. Staib et al. [SGG15] used a grid-based approach inspired by Crassin et al. [CNS∗11], to simulate global illumination in scenes composed of spheres. Later on, Skånberg et al. [SVGR16] have proposed a regression analysis approach, which has been inspired by the work of Ren et al. [RWG∗13]. Due to the inherent problems of regression analysis, with respect to the dimensionality of parameter space to conquer, their approach can only be applied to spherical shapes, in a similar fashion as the original technique presented by Ren et al. was applicable to triangles, only. Moreover, the modulation of the contributions from different objects led to incorrect radiance estimations, i. e. two contributions resulting in red and blue colors would yield almost zero incoming radiance when using modulation to estimate the total contribution. Besides the simulation of these Radiosity-like effects, ambient occlusion was used by several authors to improve the shape perception of molecular structures. Tarini et al. [TCM06] computed the visibility of each atom and bond in a pre-process and stored the ambient occlusion terms for each object in a texture atlas. Later, in 2012, Grottel et al. [GKSE12] presented an interactive technique limited to scenes composed of spheres. They computed a coarse approximation of the scene and used it to compute a rough estimation of the occlusion in each pixel. This technique led to two different approaches that proposed a similar extension of the method. Staib et al. [SGG15], limiting the technique to spheres, and Hermosilla et al. [HGVV16], limiting the technique to spheres and cylinders, used a hierarchical data structure to approximate the scene. Then, for each pixel, they computed the ambient occlusion term using Voxel Cone Tracing [CNS∗11]. An entirely different approach was presented by Skånberg et al. [SVGR16], which approximated the occlusion generated by a sphere by estimating its projected solid angle. While all these techniques, allow for the incorporation of advanced illumination effects in molecular representations, they are all tailored towards a specific visual representation. To our knowledge, no general molecular illumination models exist, which can be applied to multiple representations. 3. Modeling Diffuse Light Interactions To enable regression analysis for the derivation of an analytical illumination model, light interactions first need to be formalized. In this section, we describe how we formalize diffuse light interactions and occlusions, which shall both form an integral part of the formalized illumination model. The amount of light reflected by a point is measured by the reflected radiance. It becomes possible to define this radiance as the sum of the radiance reflected by the surrounding objects plus the radiance arriving from the environment, as the rendering Equation [Kaj86] defines the outgoing radiance from a surface at a given direction as a function of the incoming light from all directions within the hemisphere defined by the normal at each point: Lo(p,ωo) = ZΩ f(p,ωo,ωi)Li(p,ωi)cosθidωi,(1) where Lo(p,ωo)is the outgoing radiance at point pin direction ωo, f(p,ωo,ωi)is the object’s Bidirectional Reflectance Distribution Function (BRDF) and Li(p,ωi)is the incoming radiance from direction ωi. However, for perfectly diffuse objects the same amount of light is reflected in all directions, and, therefore, the BRDF becomes constant (c) and can be moved outside the integral. Lo(p,ωo) = c πZΩ Li(p,ωi)cosθidωi(2) Since RΩcosθi=π, the albedo cof the object is divided by π. Now, for explanatory purposes, let’s assume we have a scene composed of two convex objects (Aand B) separated by a certain distance (Figure 2). Assuming that the only light source in this scene is an environmental radiance of La, the radiance reflected by
P. Hermosilla et al. / A General Illumination Model for Molecular Visualization object Aat a given point pin direction ωocan be computed by the sum of two integrals: LAo(p,ωo) = c1 πZΩ VB(p,ωi)Li(p,ωi)cosθidωi+ 1 πZΩ1−VB(p,ωi)Lacosθidωi(3) The first integral computes the radiance arriving at point p(on the surface of the object A) bounced at the surface of object B. Here the incoming radiance for a given direction ωi(Li) is modulated by the visibility function VB(p,ωi), which is a binary function that is evaluated to 1 when a ray defined by (p,ωi)has its first intersection with object B: VB(p,ωi) = 1poccluded by object B in direction ωi 0 otherwise Using the second integral we can calculate the radiance arriving at the point pfrom the environment. Now let’s assume that we have a scene similar to the one defined previously, in which we have a convex object Aand nconvex objects B1...Bn. Using the same procedure as before, we can define the radiance reflected by object A as a summation of the radiance that reaches preflected by each individual object Bjplus the radiance arriving from the environment: LAo(p,wo) = c1 πZΩ VB1(p,ωi)Li(p,ωi)cosθidωi+ ... 1 πZΩ VBn(p,ωi)Li(p,ωi)cosθidωi+ 1 πZΩ 1− n ∑ j=1 VBj(p,ωi) Lacosθidωi) =c n ∑ j=1 fBj−→A(p)+La 1− n ∑ j=1 OBj−→A(p) (4) where fBj−→A(p)is a function which evaluates the radiance reflected by object Bjonto point p, and OBj−→A(p)describes the occlusion generated by object Bjat point p.OBj−→A(p)is in the range [0,1]and evaluates to 1 when object Bjcovers the entire hemisphere and 0 when object Bjdoes not generate any occlusion wrt. point p. With the previous derivation, our model defines the radiance at any point on the scene as a summation of the radiance arriving from the objects in its vicinity plus the environmental radiance modulated by the visibility of these objects. Since this model does not take into account self-occlusions, it is limited to scenes composed of convex objects. 4. Sampling Strategies Equation 4formalizes the computation of the radiance at a given point. However, fB−→A(p)and OB−→A(p)are complicated functions which can be hard to evaluate. For simple objects, such as B A Figure 2: The diffuse interaction between two objects, A and B, is defined as the environmental light that reaches our point of interest from both, the environment and reflected at object B (grey rays). spheres, these functions can be easily approximated by regression analysis since they are described by a small number of parameters. In contrast, when dealing with more complex objects, a more sophisticated strategy has to be used in order to sample the parameter space efficiently, as the number of samples required by the symbolic regression algorithm increases exponentially with the number of parameters used to describe the new shapes. In this section, we describe strategies that are able to obtain an analytical solution to fB−→A(p)using symbolic regression even for complex objects defined by several parameters. The key idea is to reduce the number of required samples by selecting those which are more representative. 4.1. Determining the Number of Combinations Let us assume, that fB−→A(p)describes the radiance reflected by object Binto a point pon the surface of another object A. In order to simplify its computation, we define a different equation fB−→A(p) for each pair of types of objects Band A. Although, this procedure results in conditional branching, it also reduces the complexity of the function to be approximated. Hence, we initially determine the number of equations to be approximated. For ndifferent types of objects, the number of required equations is n2since we have to cover all possible configurations. Once we have identified them, the following simplifications are carried out for each of the cases. 4.2. Parameterize all Possible Spatial Configurations For each case, we define a set of parameters which identify a unique spatial configuration between two objects of the types studied. The complexity of the regression problem is determined by the number of parameters selected at this step since they determine the size of the space to sample and the complexity of the resulting function. In order to reduce the number of parameters we use the center of one object as the origin of coordinates and define the other with its relative coordinates. 4.3. Parameter Space Sampling As a next step, we determine the spatial configurations we will use as input to the regression analysis. The accuracy of the resulting function will depend on the number and variety of the configurations we provide. A straightforward solution would be to consider uniformly distributed samples in the parameter space by varying the value of
P. Hermosilla et al. / A General Illumination Model for Molecular Visualization one parameter each time. Ensuring that we sample each parameter with enough resolution would allow the symbolic regression algorithm to capture the behavior of our radiance function. However, the number of samples required by this approach increases exponentially with the number of parameters. Assuming that we only take 20 samples for each parameter, for spatial configurations defined by 6 parameters we would generate 64 million of samples, which is infeasible with a limited amount of resources and time, and the main reason why previous approaches have been restricted to single shapes, e.g., [RWG∗13,SVGR16]. Therefore, instead of taking uniformly distributed samples, we limit our sampling to those configurations which appear more often in our scenes. First, we discretize the domain of each parameter, limiting them to kdifferent values. Then, we analyze different realworld scenes in order to determine which spatial configurations are more frequent. Based on this analysis, we determine for each pair of objects the values of the different parameters. The discretization of the different domains allows us to identify each configuration by a vector of mintegers, rid = [r1, ..., rm], where mis the number of parameters. The components of this vector can be understood as indexes to the array of kdifferent values of each parameter. After analyzing the scenes corresponding to these parameters, we are able to obtain a histogram of these identifiers, providing information of how frequent a spatial configuration took place within the scenes. In order to obtain a set of configurations with appropriate pairwise differences, we perform another step that reduces the number of spatial configurations even more. This step aims to remove configurations which are very similar, the ones that only differ in one or two parameters and whose values are very close. As a measure of the difference between two configurations, we use the L2distance between their identifiers, d=|rid −r0 id|. Using an iterative algorithm , we select a subset of configurations in which all of them are at a distance dmin or more from the rest of the configurations in the subset. This algorithm selects in each iteration a new configuration which meets this requirement. Therefore, dmin should be selected experimentally, such that the resulting subset of configurations is small enough (see Section 6.1). Lastly, from the configurations obtained, we select the ones that appear more often in the analyzed scenes until we achieve a small number of configurations which are able to represent the light interactions between the studied objects. 4.4. Samples Reparameterization Although regression analysis is a powerful tool able to provide an analytical model from a reduced set of samples, it can also produce models with high error. If the function we want to approximate is too complex or the number of parameters of the function is too large, the solution space is too big and, therefore, more difficult to explore. This can result in a model which does not fit well the input data. That was the case of our initial parametrization. Although it helped us to easily determine a set of representative spatial configurations, the result of the regression analysis did not take into account relevant parameters, which lead to incorrect shading. In order to solve this problem, we derive a new parametrization of the problem more closely related to the function we wanted to approximate, guiding thus the algorithm to our desired solution. The function we intend to approximate, fB−→A, is an integral over the hemisphere defined by the normal at each point. Our initial parametrization, on the other hand, described the displacement and rotation we should apply to object Ato align it to object B. For our new parametrization, we define instead object Bby its spherical coordinates with respect to each point on the surface of object A. This parametrization not only provides more information about the function we want to obtain but also introduces more variation in the samples. For each point on the surface of object A, object B is described by different values since its projection is also different. 5. Regression Analysis In this section we describe the regression analysis we use to approximate our functions. First, for the selected configurations, we execute a path tracer algorithm on a simple scene composed of two objects (as the scene illustrated in Figure 2). We use an environmental radiance (La) of 1.0 and a reflectance function for both objects equal to 0.9. We selected this value for the reflectance function since objects with this reflectance function illustrate light absorption whilst reflecting almost all the received light. Then, during the interactive visualization, we derive fB−→A(p)for different reflectance functions in real-time (see Section 6.3). Moreover, for simplicity, we only simulate a single bounce of the light (grey rays in Figure 2). However, one bounce is enough to plausibly approximate global illumination effects such as diffuse interreflection. The path tracer computes the following integral for 1282differ- ent points on the surface of object Ausing all the spatial configurations selected in the previous step: fB−→A(p) = 1 πZΩ VB(p,ωi)Li(p,ωi)cosθidωi(5) This algorithm generates an image of 1282pixels for each spatial configuration. Each pixel of this image encodes the environmental radiance reflected by object Bthat reaches a given point on the surface of A(grey rays on Figure 2). All the pixels of the images are then used as input to a symbolic regression algorithm. We use Eureqa [SL09], a symbolic regression package by Nutonian, to approximate our functions. We run the symbolic regression algorithm using the images obtained from the path tracer for all the selected spatial configurations. For each pixel, we compute the reparameterization of object Bdescribed in Section 4.4. These values, together with the parameters describing the position of the pixel on the surface of object A, are used as the parameters of the functions the symbolic regression algorithm has to approximate. With this strategy, we are able to obtain equations which fit our input data with very low error. 6. Molecular Illumination Model In this section we illustrate how, by using the strategies proposed in the previous sections, we are able to obtain different equations describing the diffuse interaction between spheres and cylinders. Then, using these equations, we are able to define a general illumination model for molecular structures. 6.1. Parameter Space First, we select, by performing the 4 steps of the sampling strategy described in Section 4, the set of representative samples:
P. Hermosilla et al. / A General Illumination Model for Molecular Visualization lA lB d φ θx θy z y z x Figure 3: Cylinder-to-cylinder parameterization. The relative position of a cylinder with respect to another can be determined by the use of 6 parameters. 1- Determining the Number of Combinations. As described before, our scenes are only composed of two types of objects, spheres and cylinders. Thus, we need to differentiate 4 possible cases: Case 1: Object Aand Bare cylinders. Case 2: Object Ais a cylinder and object Bis a sphere. Case 3: Object Ais a sphere and object Bis a cylinder. Case 4: Object Aand Bare spheres. 2- Parameterize Spatial Configurations. For each of the cases, we define the parametrization of their spatial configurations. The units used for all the parameters are Ångström (Å) for distances and radians for angles. Case 1: The configuration of a scene composed of two cylinders Figure 4: Although during regression analysis we used a fixed radius to define cylinders, our analytical solution to the diffuse interreflection can be scaled to approximate the diffuse interreflection between cylinders with other radius. In the left figure we scaled by 0.8 the result of our function to simulate a thiner Licorice model. lc d φ rs Figure 5: Parameterization of the cylinder-sphere spatial configuration. We need up to 4 parameters to define the relative position of a sphere with respect to a cylinder. can be fully described by 8 parameters (see Figure 3): the length of both cylinders (lAand lB), the radius of both cylinders (rAand rB), the distance between the closest extreme points (d), the angle between cylinders in axis X(θx), the angle between cylinders in axis Y(θy), and the angle formed by the vector between the closest extreme points and the Z-axis (φ). This number can be reduced to 6 if we assume a constant cylinder radius. Since there is no standard value for the radius of such elements, we use 0.2Åfor both Balls- and-Sticks and Licorice models. However, if other values need to be considered, the resulting function can be scaled to simulate diffuse interreflections between objects of such radius (see Figure 4). Cases 2 and 3: A scene composed of a cylinder and a sphere can be defined by 4 parameters (see Figure 5). The length of the cylinder (lc), the radius of the sphere (rs), the distance between the center of the sphere and the closest extreme of the cylinder (d), and the angle between the Z-axis and the vector that moves the center of the sphere to the closest extreme of the cylinder (φ). Case 4: A scene composed of two spheres, can be easily described by 2 parameters: the ratio of radius between the two spheres and the distance between them. 3- Parameter Space Sampling. In this step, first, we analyze realworld molecular simulations involving different proteins. We have analyzed 6 simulations composed of thousands of steps each one. From this analysis, we obtained a histogram of the spatial configurations. Then we apply the iterative algorithm to select the most representative ones using dmin =5. Case 1: In this case, we obtained a bit more than 37,000 possible configurations after analyzing the molecular simulations. Then, we reduced them to 576 after our iterative algorithm. Finally, we selected the 201 configurations which appear more than 100 times in the simulations, accounting for 99.95% of the appearances of the 576 configurations. Cases 2 and 3: In these cases we obtained around 20,000 possible configurations from the analysis of our data. After reducing them to the most representative ones, we obtained 501 configurations. As before, we selected the ones that appear more than 100 times in our simulations,yielding a total of 286 configurations that account for 99.99% of the appearances of the 501 configurations. Case 4: This case did not need sampling reduction since only 2 parameters needed to be sampled. 4- Samples Reparameterization. In our tests, the resulting equation obtained using regression analysis for the case 1 did not cap-
P. Hermosilla et al. / A General Illumination Model for Molecular Visualization d1 d2 dh θp1 θp2 θph φh ψ1 ψ2 p Figure 6: We reparameterize our samples, describing the cylinders by their spherical coordinates with respect to our sampling points. By this reparameterization we are able to introduce more variability in our values (for given cylinder, its spherical coordinates are different for each sample) and introduce information about the problem we want to solve into the regression analysis (our function is basically an integral over the hemisphere defined at each point). ture well the diffuse interaction between cylinders. The resulting function did not use some of the input parameters, such as θy, resulting in wrong interreflections for most of the configurations were θyvaried. Therefore, we performed the reparameterization described in Section 4.4. Cases 1 and 3: The reparametrization used when object Bis a cylinder is illustrated by Figure 6. First, we project the extremes of cylinder Bonto the hemisphere defined at the point p. For each projected point we obtain two parameters, the distance from the extreme to p(d1and d2) and the angle between the projected points and the normal (θp1and θp2). Then, from the arc defined by the cylinder in the hemisphere, we compute the closest point to the center of the hemisphere, ph. From this point we obtain 3 more parameters, its spherical coordinates (dh,θhand φh). Then, two more parameters are computed which complete the definition of cylinder B, the angle of the arc between the two points of the cylin- Figure 7: In order to compute the value of the radiance for our sampling points, we used a path-tracing algorithm. Each pixel on the left image presents the radiance reaching different points at the surface of a cylinder reflected by another cylinder. The right image, on the other hand, presents the radiance that reaches different points at the surface of a cylinder reflected by a sphere. rs d θ φp Figure 8: As with the case of cylinder-cylinder interaction, we parameterize the position of a sphere relative to a point using spherical coordinates. Using this parametrization we are able to obtain better approximations with the symbolic regression algorithm. der Band the point ph:ψ1and ψ2. The number of parameters required to define the relative position of a cylinder Bfrom a point pis now 9. Despite increasing the number of parameters, with this new parametrization we are able to obtain an analytical solution for the diffuse interreflection problem which fits our input data well. Note that the proposed parametrization can be ambiguous because the same values can define two different configurations. Nonetheless, these configurations are symmetric which will have almost the same diffuse interaction. Cases 2 and 4:We reparameterized the cases when object Bis a sphere in a similar way we parameterized the data in case 1 and 3 (see Figure 8). For each point on the surface of object A, we project sphere Binto the hemisphere defined by the normal of the point, obtaining thus the following parameters: the radius of the sphere (rs), and the polar coordinates of its center (d,θand φ). 6.2. Regression Results For the selected configurations we generate the samples using a path tracer algorithm. This algorithm takes less than 30 seconds to generate one of these images, however, this is a pre-process that is executed only once. Figure 7presents some results obtained by the path tracer algorithm for cases 1 and 2. Figure 9: These images present the evaluation in real-time of the functions obtained by the regression analysis to simulate the diffuse interaction between spheres and cylinders. The objects are rendered without color, to illustrate the diffuse interactions they receive. These are calculated assuming the vertical cylinder is blue, while the horizontal one and the sphere are white.
P. Hermosilla et al. / A General Illumination Model for Molecular Visualization Lastly, we execute the symbolic regression algorithm, obtaining thus the final equations (see Figure 9). Cases 1 and 3: We used the samples generated for case 1 as input to the symbolic regression algorithm. After 15 hours, we obtained a function which approximates our original input data, with values ranging from 0 to 1, with a mean squared error of 0.000185: fB−→A(ψ1,ψ2,d2,dh,θp1,θp2) = =1.25 exp ψ1+0.872ψ2 1.19+d2+dhθp1θp2θ1.19 p1θp2 1.25 −1.25 (6) Note that this equation does not take into account any parameter defining the position in the surface of cylinder A, i. e. the symbolic regression algorithm approximated the occlusion generated by object Aover the surface of object Bwith a constant. Therefore, we used this same equation to compute the radiance in case 3, where object Ais a sphere. Cases 2 and 4: We also executed the symbolic regression algorithm for the samples generated for case 2. After computing for 17 hours, we obtained a function which approximates our original input data, with values ranging from 0 to 1, with a mean squared error of 0.00034: fB−→A(rs,d,θ) = atan 34.3r7 s d7exp(θ2)+5.35r2 s d2exp(θ2)!−0.00196 (7) Again, the obtained function does not depend on object A. Therefore, we used this equation to compute the radiance in case 4 too. Skånberg et al. [SVGR16] also proposed an analytical solution for case 4. However, their formula computes the diffuse interreflection between spheres plus the environmental radiance. This makes it not suitable for our illumination model. 6.3. Model Instance The equations obtained using our sampling reduction techniques, equations 6and 7, allow us to define an illumination model following Equation 4. In the following paragraphs, we describe how we derived our illumination model for molecules: Occlusion Estimation. Equation 4uses functions fB−→A(p)to compute the diffuse interactions between objects. However, Equation 4also relies on the occlusion generated by neighboring objects, OB−→A(p), to determine the amount of environmental radiance that reaches a point. OB−→A(p)could be also approximated using regression analysis as fB−→A(p). In this paper instead, we approximated OB−→A(p)by scaling the result of equation fB−→A(p). From the definition of fB−→A(p)(Equation 5) we know that the incoming radiance, Li, will only contribute to fB−→A(p)when it is reflected by object B. Therefore, the incoming radiance at a point pon the surface of object Afor a given direction ωiis equal to the outgoing radiance from a point p0on the surface of object Bin the same direction ωi. Assuming only one bounce of the light we can define Lias: Li(p,ωi) =LBo(p0,ωi) =cB πZΩ1−V(p0,ωm)Lacosθmdωm =cBLa1 πZΩ(1−V(p0,ωm))cosθmdωm =cBLaAO(p0)(8) where cBis the reflectance function of object B,Lais the environmental radiance, and AO(p0)is the ambient occlusion term at point p0. Following the approximation carried out by the symbolic regression algorithm, we also consider the occlusion generated by object Aconstant over the surface of object B. This assumption allows us to approximate AO(p0)by a constant, ko, and therefore derive OB−→A(p)from fB−→A(p): fB−→A(p) = 1 πZΩ VB(p,ωi)Licosθidωi =1 πZΩ VB(p,ωi)cBLakocosθidωi =cBLako 1 πZΩ VB(p,ωi)cosθidωi =cBLakoOB−→A(p) OBj−→A(p) = fB−→A(p) cBLako (9) This approximation of the occlusion generated by an object is able to provide realistic results as shown in Figure 10. However, if a more exact solution is required the occlusion can be computed using other methods, such as ambient occlusion algorithms (see the algorithm proposed by Shanmugan et al. [SA07]) or finding an analytical solution by using regression analysis. Supporting Different Reflectance Functions. During the computation of Equation 6and Equation 7we assumed that objects have a constant reflectance function equal to 0.9. Nevertheless, this is not the case for real scenes. In order to support different reflectance functions, we perform simple manipulations on Equation 5, which allow us to define the radiance reflected by an object B0with a reflectance function cB0by equation fB−→A(p)defined for an object Bwith a reflectance function of cB=0.9. Note that fB0−→A(p)can be obtained from fB−→A(p)multiplying by cB0and dividing by cB, since the outgoing radiance from object B0, can be derived in the same way from the outgoing radiance defined for object B: fB0−→A(p) = fB−→A(p)cB0 cB (10) LB0o(p0,ωi) = LBo(p0,ωi)cB0 cB =cB0cB πcBZΩ(1−VA(p0,ωj))Lacosθjdωj =cB0 πZΩ(1−VA(p0,ωj))Lacosθjdωj Model Parameters. Our molecular illumination model only has one parameter, ko, which controls the occlusion generated by the objects of the scene. However, in order to provide control over the
P. Hermosilla et al. / A General Illumination Model for Molecular Visualization Figure 10: These images illustrate the effect of the parameter ko, used to approximate the occlusion generated by the nearby objects. The top image was obtained using ko=0.75 whilst the bottom one was obtained by ko=0.95. Note that, since kodivides fB−→A, lower values of this parameter generates higher occlusions. intensity of the diffuse interactions, we also incorporated a scaling, sf, and a power, pf, factors that are applied to the functions fBj−→A(p). The effects of these parameters on the visualization are illustrated by Figure 11 and Figure 10. Supported Representations. This model is used to simulate diffuse interreflections in molecular scenes represented by the most commonly used atomic-based representation methods. Since, the Space-filling, Balls-and-Sticks and Licorice models are representations based on only two geometric primitives, spheres and cylinders, our illumination model can be directly applied here to simulate global illumination effects. The system was developed for cylinders and spheres, however, with some approximations, we can make it work also for SES (see Figure 12): Since SESs are derived from the Space-filling model, for each point in the SES, we compute their final color by using our illumination model as if the scene was composed only of spheres. The structure of the scenes is very different for each of these representations. Whilst the SF and SES models have a high spatial density, generating a high number of occlusions, the B&S and Licorice models create more sparse visualizations. In order to adapt our functions to these different representations, we adjusted the parameters of our model for each of the representations. The values used for the images of the paper were: •Space-filling: sf=0.2, pf=0.9, and ko=0.9. •Balls-and-Sticks: sf=0.5, pf=0.95, and ko=0.85. •Licorice: sf=2.0, pf=0.95, and ko=1.0. •SES: sf=0.55, pf=1.15, and ko=1.05. With these values, we are able to obtain realistic results like the ones shown in Figure 1. 7. Implementation We described an illumination model used to visualize molecules. In this section, instead, we describe some implementation details which allowed us to use this model in real-time. Figure 11: Parameter sfis used to modulate the diffuse interreflection. By increasing this parameter we are able to exaggerate the color bleeding effect. Top image was obtained using sf=0.5 whilst the bottom image used a sf=1.0. 7.1. Acceleration Data Structures Evaluating the diffuse interaction for every pair of objects in the scene can be prohibitive for medium-sized molecules. However, since the sizes of the objects in our scenes are in a well-defined range, we can discard those objects that are farther than a certain distance. Objects far away will have a small projected solid angle and thus, a small diffuse interaction with the point of interest. Hence, to compute the radiance reaching a point, we only have to compute the diffuse interactions with the objects in its vicinity. Determining these objects can be efficiently implemented by using spatial partitioning. Efficient retrieval of neighboring atoms within a fixed radius is a common problem that is usually solved by using spatial subdivision data structures [Gre07,BSC15,Hoe14]. We adopted the method proposed by Green [Gre07], which was later used in different molecular visualization techniques [KGE11,SVGR16,HKG∗17]. We create two data structures, one for atoms and other for bonds, in which we distribute our geometric primitives. These two data structures are computed in milliseconds by the GPU each time the molecular structure is changed. This allows us to maintain real-time interaction during the inspection of full trajectories. In order to achieve a correct simulation of the diffuse interactions, the cell size needs to be accurately selected. A cell size too small could not take into account, during the retrieval, objects that would generate a significant diffuse interaction with our point of interest. The size of the cells, then, has to ensure that for a given point all the objects of interest are selected whilst only the grid cell in which the point is located and the 26 surrounding cells are queried. This can be achieved by determining the distance at which diffuse interaction is negligible. After trying different spatial configurations in our path tracer, we determined that for a projected solid angle, ω, smaller than 0.04 the diffuse contribution of such objects is no longer relevant. From the equations which define the projected solid angle of our geometric shapes ( [Raj14]), we isolate the distance terms and determine at which distances spheres and cylinders project a solid angle of 0.04. These values are then used