技术领域technical field
本发明涉及图形处理领域,尤其是涉及一种为平面图片设置动态阴影的方法及装置。The invention relates to the field of graphics processing, in particular to a method and device for setting dynamic shadows for plane pictures.
背景技术Background technique
在动画制作的过程中,有时需要为平面图片展示阴影的功能。一般情况下,为平面图片添加的阴影是内阴影,即指在光线照射条件下,造型实体背光方向所形成的阴暗面,这种阴影能够体现出光源照射的方向以及图形实体的景深信息。当前对平面图片的阴影处理方式主要分为两类:In the process of animation, it is sometimes necessary to show the function of shadows for flat pictures. In general, the shadow added to a flat image is the inner shadow, which refers to the dark side formed by the backlight direction of the modeling entity under the lighting condition. This shadow can reflect the direction of the light source and the depth of field information of the graphic entity. Currently, shadow processing methods for flat images are mainly divided into two categories:
第一、事先在图片处理软件(如Photoshop)中为图片添加阴影处理,然后绘制在图片上一起导出使用;First, add shadow processing to the picture in the picture processing software (such as Photoshop) in advance, and then draw on the picture and export it together;
第二、在图片处理软件中制作好阴影的图片,单独导出后,在应用中使用。Second, make a picture of the shadow in the picture processing software, export it separately, and use it in the application.
上述两种处理方式都有一个明显的缺点,就是阴影一旦设置到图片上后,就无法再更改阴影的位置、形状以及浓淡等参数,导致虚拟场景中阴影与现实场景中的阴影不一致,影响画面整体效果。Both of the above two processing methods have an obvious disadvantage, that is, once the shadow is set on the picture, the parameters such as the position, shape and shade of the shadow cannot be changed, resulting in the inconsistency between the shadow in the virtual scene and the shadow in the real scene, affecting the picture overall effect.
发明内容Contents of the invention
本发明提供一种为平面图片设置动态阴影的方法及装置,解决现有技术中虚拟场景中阴影与现实场景的阴影不一致的问题,能使虚拟场景更加逼真。The present invention provides a method and device for setting dynamic shadows for plane pictures, which solves the problem of inconsistency between the shadows in the virtual scene and the shadows in the real scene in the prior art, and can make the virtual scene more realistic.
第一方面,本发明提供一种为平面图片设置动态阴影的方法,包括:In a first aspect, the present invention provides a method for setting dynamic shadows for a plane picture, including:
实时获取光源的当前位置,获取平面图片的中心点与所述光源的当前位置之间的距离,获取所述平面图片的中心点与所述光源的当前位置的连线与坐标轴所形成的角度;Obtain the current position of the light source in real time, obtain the distance between the center point of the plane picture and the current position of the light source, and obtain the angle formed by the line connecting the center point of the plane picture and the current position of the light source with the coordinate axis ;
根据当前获取到的所述距离、所述角度、以及偏移因子,确定所述平面图片当前的阴影的位置和投影图片,将所述投影图片在所述阴影的位置进行显示。According to the currently acquired distance, angle, and offset factor, determine a current shadow position and a projected picture of the planar picture, and display the projected picture at the shadow position.
第二方面,本发明提供一种为平面图片设置动态阴影的装置,包括:In a second aspect, the present invention provides a device for setting dynamic shadows for a plane picture, including:
获取单元,用于实时获取光源的当前位置,获取平面图片的中心点与所述光源的当前位置之间的距离,获取所述平面图片的中心点与所述光源的当前位置的连线与坐标轴所形成的角度;An acquisition unit, configured to acquire the current position of the light source in real time, acquire the distance between the center point of the plane picture and the current position of the light source, and acquire the connection line and coordinates between the center point of the plane picture and the current position of the light source the angle formed by the axes;
确定单元,用于根据当前获取到的所述距离、所述角度、以及偏移因子,确定所述平面图片当前的阴影的位置和投影图片,将所述投影图片在所述阴影的位置进行显示。A determining unit, configured to determine the current shadow position and projected picture of the plane picture according to the currently acquired distance, the angle, and the offset factor, and display the projected picture at the position of the shadow .
本发明提供一种为平面图片设置动态阴影的方法及装置,通过实时获取光源的当前位置,获取平面图片的中心点与所述光源的当前位置之间的距离,获取所述平面图片的中心点与所述光源的当前位置的连线与坐标轴所形成的角度;并根据当前获取到的所述距离、所述角度、以及偏移因子,确定所述平面图片当前的阴影的位置和投影图片,将所述投影图片在所述阴影的位置进行显示。本发明实现根据光源与平面图片的相对位置为平面图片实时生成动态的阴影的目的,解决现有技术中虚拟场景中阴影与现实场景的阴影不一致的问题,能使虚拟场景更加逼真。The present invention provides a method and device for setting a dynamic shadow for a planar picture, by obtaining the current position of the light source in real time, obtaining the distance between the center point of the planar picture and the current position of the light source, and obtaining the center point of the planar picture The angle formed by the line connecting the current position of the light source and the coordinate axis; and according to the currently acquired distance, angle, and offset factor, determine the position of the current shadow of the plane picture and the projected picture , to display the projected picture at the position of the shadow. The invention achieves the purpose of generating real-time dynamic shadows for the plane picture according to the relative position of the light source and the plane picture, solves the problem of inconsistency between the shadow in the virtual scene and the shadow of the real scene in the prior art, and can make the virtual scene more realistic.
附图说明Description of drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对本发明实施例描述中所需要使用的附图作简单的介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据本发明实施例的内容和这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments of the present invention. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention , for those skilled in the art, other drawings can also be obtained according to the content of the embodiment of the present invention and these drawings without any creative effort.
图1是本发明第一实施例提供的为平面图片设置动态阴影的方法的流程图;FIG. 1 is a flow chart of a method for setting dynamic shadows for a plane picture provided by the first embodiment of the present invention;
图2是本发明第二实施例提供的为平面图片设置动态阴影的方法的流程图;FIG. 2 is a flow chart of a method for setting dynamic shadows for a plane picture provided by the second embodiment of the present invention;
图3是本发明第三实施例提供的为平面图片设置动态阴影的方法的流程图;Fig. 3 is a flowchart of a method for setting dynamic shadows for a plane picture provided by the third embodiment of the present invention;
图3-1是本发明第三实施例中光源与平面图片在投影平面是XY平面的投影示意图;Fig. 3-1 is a schematic diagram of the projection of the light source and the plane picture on the XY plane in the projection plane in the third embodiment of the present invention;
图4是本发明第四实施例提供的为平面图片设置动态阴影的装置的结构示意图;Fig. 4 is a schematic structural diagram of a device for setting dynamic shadows for a planar image according to a fourth embodiment of the present invention;
图5是本发明第五实施例提供的为平面图片设置动态阴影的装置的结构示意图。Fig. 5 is a schematic structural diagram of an apparatus for setting a dynamic shadow for a planar image according to a fifth embodiment of the present invention.
具体实施方式Detailed ways
为使本发明解决的技术问题、采用的技术方案和达到的技术效果更加清楚,下面将结合附图对本发明实施例的技术方案作进一步的详细描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the technical problems solved by the present invention, the technical solutions adopted and the technical effects achieved clearer, the technical solutions of the embodiments of the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only the technical solutions of the present invention. Some, but not all, embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts belong to the protection scope of the present invention.
下面结合附图并通过具体实施方式来进一步说明本发明的技术方案。The technical solutions of the present invention will be further described below in conjunction with the accompanying drawings and through specific implementation methods.
第一实施例first embodiment
图1是本发明第一实施例提供的为平面图片设置动态阴影的方法的流程图。参照图1所示,所述为平面图片设置动态阴影的方法,包括如下步骤:Fig. 1 is a flowchart of a method for setting dynamic shadows for a planar picture according to the first embodiment of the present invention. With reference to shown in Figure 1, described method for setting dynamic shadow for plane picture, comprises the following steps:
步骤S110:实时获取光源的当前位置,获取平面图片的中心点与所述光源的当前位置之间的距离,获取所述平面图片的中心点与所述光源的当前位置的连线与坐标轴所形成的角度。Step S110: Obtain the current position of the light source in real time, obtain the distance between the center point of the plane picture and the current position of the light source, and obtain the distance between the center point of the plane picture and the current position of the light source and the coordinate axis. angle formed.
当光源和平面图片的相对位置发生变化时,在平面图片下层所呈现的阴影也不同。首先,监测光源的位置,实时获取光源的当前位置,即,按照预设的获取周期T,每经过时间T,则获取一次光源的位置,记为Plight,并获取用以表示平面图片位置的平面图片的中心点,记为Pimage。根据平面图片的中心点与所述光源的当前位置的坐标计算两者之间的距离Distance。连接平面图片的中心点与所述光源的当前位置,确定所述平面图片的中心点与所述光源的当前位置的连线与坐标轴所成的角度Direct。When the relative position of the light source and the plane picture changes, the shadows presented on the lower layer of the plane picture are also different. First, monitor the position of the light source, and obtain the current position of the light source in real time, that is, according to the preset acquisition cycle T, the position of the light source is obtained every time T passes, which is recorded as Plight , and the position used to represent the plane picture is obtained. The center point of the plane image is denoted as Pimage . Calculate the distance Distance between the center point of the plane picture and the coordinates of the current position of the light source. Connecting the center point of the plane picture and the current position of the light source, and determining the angle Direct formed by the line connecting the center point of the plane picture and the current position of the light source and the coordinate axis.
步骤S120:根据当前获取到的所述距离、所述角度、以及偏移因子,确定所述平面图片当前的阴影的位置和投影图片,将所述投影图片在所述阴影的位置进行显示。Step S120: According to the currently acquired distance, angle, and offset factor, determine a current shadow position and a projected picture of the plane picture, and display the projected picture at the shadow position.
在本实施例中,每得到一次光源的当前位置、平面图片的中心点与光源的当前位置之间的距离、平面图片的中心点与光源的当前位置的连线与坐标轴所形成的角度之后,便执行一次步骤120。In this embodiment, each time the current position of the light source, the distance between the center point of the plane picture and the current position of the light source, and the angle formed by the line connecting the center point of the plane picture and the current position of the light source and the coordinate axis are obtained, , step 120 is performed once.
所述偏移因子是阴影与平面图片的偏移位置的缩放系数。当偏移因子越大时,阴影距离平面图片就越远,显示效果就像平面图片从屏幕中升起。在二维坐标系中,所述偏移因子是由用户预先设定的;但是,在三维坐标系中,所述偏移因子是通过计算平面图片的中心点与所述光源的当前位置在投影平面的投影之间的距离获得的。The offset factor is a scaling factor for the offset position of the shadow from the plane picture. When the offset factor is larger, the shadow is farther away from the flat image, and the display effect is as if the flat image rises from the screen. In the two-dimensional coordinate system, the offset factor is preset by the user; however, in the three-dimensional coordinate system, the offset factor is obtained by calculating the projection between the center point of the plane picture and the current position of the light source The distance between the projections of the planes is obtained.
平面图片的阴影是位于投影平面的所述平面图片的全等图形或者对所述平面图片的全等图形按照比例进行压缩或者拉伸的操作得到的投影图片。The shadow of the planar picture is the congruent figure of the planar picture on the projection plane or the projected picture obtained by compressing or stretching the congruent figure of the planar picture in proportion.
在二维坐标系中,在确定所述平面图片当前的阴影的中心点位置后,实时将所述平面图片的全等图形作为投影图片在所确定的阴影的位置显示,以作为所述平面图片的动态阴影。然而,在三维坐标系中,在确定所述平面图片当前的阴影的中心点位置后,按照计算确定的宽度和高度的缩放因子,实时将所述平面图片的全等图形的宽度和高度分别乘以缩放因子获得压缩或拉伸后的新的投影图片,作为所述平面图片的动态阴影。In the two-dimensional coordinate system, after determining the position of the center point of the current shadow of the planar picture, display the congruent figure of the planar picture as a projected picture at the determined shadow position in real time as the planar picture dynamic shadows. However, in the three-dimensional coordinate system, after determining the position of the center point of the current shadow of the plane picture, the width and height of the congruent figure of the plane picture are respectively multiplied by A compressed or stretched new projected picture is obtained with a scaling factor as a dynamic shadow of the plane picture.
本发明实施例提供的为平面图片设置动态阴影的方法,通过实时获取光源的当前位置,获取平面图片的中心点与所述光源的当前位置之间的距离,获取所述平面图片的中心点与所述光源的当前位置的连线与坐标轴所形成的角度;并根据当前获取到的所述距离、所述角度、以及偏移因子,确定所述平面图片当前的阴影的位置和投影图片,将所述投影图片在所述阴影的位置进行显示。通过本实施例的方法实现根据光源与平面图片的相对位置为平面图片实时生成动态的阴影的目的,解决现有技术中虚拟场景中阴影与现实场景的阴影不一致的问题,能使虚拟场景更加逼真。The method for setting a dynamic shadow for a planar picture provided by the embodiment of the present invention obtains the current position of the light source in real time, obtains the distance between the center point of the planar picture and the current position of the light source, and obtains the distance between the center point of the planar picture and the current position of the light source. The angle formed by the line connecting the current position of the light source and the coordinate axis; and according to the currently acquired distance, angle, and offset factor, determine the current shadow position and projected picture of the plane picture, and displaying the projected picture at the position of the shadow. Through the method of this embodiment, the purpose of generating real-time dynamic shadows for the plane picture according to the relative position of the light source and the plane picture is realized, and the problem of inconsistency between the shadow in the virtual scene and the shadow of the real scene in the prior art is solved, and the virtual scene can be made more realistic. .
第二实施例second embodiment
图2是本发明第二实施例提供的为平面图片设置动态阴影的方法的流程图。所述为平面图片设置动态阴影的方法以本发明第一实施例为基础,进一步的,获取所述平面图片在二维坐标系中的全等图形,以作为所述平面图片的投影图片;Fig. 2 is a flowchart of a method for setting dynamic shadows for a planar picture according to the second embodiment of the present invention. The method for setting a dynamic shadow for a planar picture is based on the first embodiment of the present invention, further, obtaining the congruent figure of the planar picture in a two-dimensional coordinate system as a projected picture of the planar picture;
采用如下公式确定所述平面图片当前的阴影的位置:The following formula is used to determine the current shadow position of the plane picture:
其中,为坐标原点指向阴影中心点Pshadow的向量,为坐标原点指向平面图片的中心点Pimage的向量,为坐标原点指向光源的当前位置Plight的向量,factor为预设的偏移因子且factor>0。in, is the vector from the coordinate origin pointing to the shadow center point Pshadow , is the vector whose coordinate origin points to the center point Pimage of the plane image, is the vector whose coordinate origin points to the current position Plight of the light source, factor is the preset offset factor and factor>0.
参照图2所示,所述为平面图片设置动态阴影的方法,包括如下步骤:Referring to Fig. 2, the method for setting a dynamic shadow for a plane picture includes the following steps:
步骤S210:获取所述平面图片在二维坐标系中的全等图形,以作为所述平面图片的投影图片。Step S210: Obtain the congruent figure of the planar picture in the two-dimensional coordinate system as a projected picture of the planar picture.
本实施例只考虑二维坐标系中平面图片的虚拟场景中的阴影,在此不考虑阴影的压缩和拉伸,仅计算投影图片相对于平面图片的偏移位置。如需考虑阴影的压缩或拉伸,仅需要在本实施例提供的投影图片生成方法的基础上将投影图片的宽度和高度按照一定比例进行缩放即可。This embodiment only considers the shadow in the virtual scene of the plane picture in the two-dimensional coordinate system, and does not consider the compression and stretching of the shadow here, and only calculates the offset position of the projected picture relative to the plane picture. If it is necessary to consider the compression or stretching of the shadow, it is only necessary to scale the width and height of the projection picture according to a certain ratio on the basis of the projection picture generation method provided in this embodiment.
本步骤中,一种优选地获取所述平面图片在二维坐标系中的全等图形的操作具体包括:In this step, an operation of preferably obtaining the congruent graphics of the plane picture in the two-dimensional coordinate system specifically includes:
若所述平面图片是规则图形,则获取所述平面图片的外形尺寸,根据所述外形尺寸在二维坐标系中生成一个与所述平面图片外形尺寸相同的全等图形;If the planar picture is a regular figure, then obtain the external dimensions of the planar picture, and generate a congruent figure with the same external dimensions as the planar picture in a two-dimensional coordinate system according to the external dimensions;
若所述平面图片不是规则图形,则获取所述平面图片的各个像素的透明度值,并将各个像素的颜色取值转换为对应像素的透明度值,将转换操作后得到的灰度图作为二维坐标系中与所述平面图片外形尺寸相同的全等图形。If the plane picture is not a regular figure, then obtain the transparency value of each pixel of the plane picture, and convert the color value of each pixel into the transparency value of the corresponding pixel, and use the grayscale image obtained after the conversion operation as a two-dimensional A congruent figure in the coordinate system having the same dimensions as the planar picture.
为实现上述操作,首先,获取平面图片的边缘像素点的特征值,依据多边形顶点与其他边缘像素点特征值变化规律,快速识别出多边形的顶点及其排列顺序,完成对多边形形状的准确识别。另外,依据特征距计算出图形的中心和半径、长半轴和短半轴长度,构造出圆和椭圆的方程,完成对圆和椭圆的快速识别。定义其他不能识别的图形为不规则图形。In order to realize the above operations, firstly, obtain the feature values of the edge pixels of the plane image, and quickly identify the vertices of the polygon and their arrangement order according to the change rule of the feature values of the polygon vertices and other edge pixels, and complete the accurate recognition of the polygon shape. In addition, the center, radius, semi-major axis and semi-minor axis lengths of the graphics are calculated according to the characteristic distance, and the equations of circles and ellipses are constructed to complete the rapid identification of circles and ellipses. Define other unrecognizable graphics as irregular graphics.
在所述平面图片是规则图形时,根据图形识别的结果获取所述平面图片的外形尺寸。例如,如果所述平面图片是矩形,则获取矩形的长和宽;如果所述平面图片是圆形,则获取圆形的圆心和半径;如果是其他规则图形时,则按照构成该图形的要求获取绘图要素。根据所确定的绘图要素生成与所述平面图片外形尺寸相同的图形。When the planar picture is a regular figure, the outline size of the planar picture is obtained according to the result of pattern recognition. For example, if the plane picture is a rectangle, then obtain the length and width of the rectangle; if the plane picture is a circle, then obtain the center and radius of the circle; if it is other regular graphics, follow the requirements for forming the figure Get drawing elements. A figure with the same external dimensions as the plane picture is generated according to the determined drawing elements.
在所述平面图片是不规则图形时,获取所述图片的各个像素的透明度值,并将所述像素的颜色取值转换为所述透明度值,以作为二维坐标系中与所述平面图片外形尺寸相同的全等图形。When the plane picture is an irregular figure, obtain the transparency value of each pixel of the picture, and convert the color value of the pixel into the transparency value, as a two-dimensional coordinate system related to the plane picture Congruent figures with the same external dimensions.
将像素的颜色取值转换为透明度值的方法为:The method of converting the color value of a pixel into a transparency value is:
得到的(ARGB)pixel即为与所述当前图片外形尺寸相同的投影图片对应像素的颜色值。其中,alpha为所述像素的透明度,Apixel为所述像素的透明通道,Rpixel为所述像素的红色通道,Gpixel为所述像素的绿色通道,Bpixel为所述像素的蓝色通道。因为投影图的ARGB四个分量的值都一种,都为alpha值,所以此时的(ARGB)pixel的颜色为灰色。The obtained (ARGB)pixel is the color value of the pixel corresponding to the projected image having the same external dimensions as the current image. Wherein, alpha is the transparency of the pixel, Apixel is the transparent channel of the pixel, Rpixel is the red channel of the pixel, Gpixel is the green channel of the pixel, and Bpixel is the blue channel of the pixel . Because the values of the four ARGB components of the projected image are all one, and they are all alpha values, so the color of the (ARGB)pixel at this time is gray.
步骤S220:实时根据所述距离、所述角度、以及预设的偏移因子,确定所述平面图片当前阴影的位置。Step S220: Determine the current shadow position of the plane picture according to the distance, the angle, and a preset offset factor in real time.
初始化默认光源,并在将所述平面图片拖放于二维坐标系之后,判断所述默认光源是否经过自定义操作,若否,则拖放光源,并调整光源的高度。实时获取光源的当前位置Plight,坐标记为(Xl,Yl)。Initialize the default light source, and after dragging and dropping the planar image on the two-dimensional coordinate system, determine whether the default light source has been customized, if not, drag and drop the light source, and adjust the height of the light source. The current position Plight of the light source is obtained in real time, and the coordinates are marked as (Xl, Yl).
在二维坐标系中,实时获取用户设置的平面图片的中心点的位置Pimage,坐标记为(Xi,Yi)。那么,根据两点间的距离公式求得平面图片的中心点与所述光源的当前位置之间的距离为:In the two-dimensional coordinate system, the position Pimage of the center point of the planar image set by the user is obtained in real time, and the coordinates are marked as (Xi, Yi). Then, according to the distance formula between two points, the distance between the center point of the plane picture and the current position of the light source is obtained as:
其中,Pimage是用户设置的平面图片的中心点的位置,Plight是光源的当前位置,为坐标原点指向平面图片的中心点Pimage的向量,为坐标原点指向光源的当前位置Plight的向量,Xl是二维坐标系中光源的当前位置在X轴的投影,Yl是二维坐标系中光源的当前位置在Y轴的投影,Xi是二维坐标系中平面图片的中心点的位置在X轴的投影,Yi是二维坐标系中平面图片的中心点的位置在Y轴的投影。Among them, Pimage is the position of the center point of the plane image set by the user, Plight is the current position of the light source, is the vector whose coordinate origin points to the center point Pimage of the plane image, is the vector whose coordinate origin points to the current position Plight of the light source, Xl is the projection of the current position of the light source on the X-axis in the two-dimensional coordinate system, Yl is the projection of the current position of the light source on the Y-axis in the two-dimensional coordinate system, and Xi is the two-dimensional coordinate system Yi is the projection of the position of the center point of the plane picture in the two-dimensional coordinate system on the X axis, and Yi is the projection of the position of the center point of the plane picture in the two-dimensional coordinate system on the Y axis.
所述平面图片的中心点与所述光源的当前位置的连线与坐标轴所成的角度体现了阴影相对于平面图片的方位。在已知阴影相对于平面图片的偏移距离的前提下,可以通过求得阴影相对于平面图片的方位确定阴影的位置。阴影相对于平面图片的方位为:The angle formed by the line connecting the center point of the plane picture and the current position of the light source with the coordinate axis reflects the orientation of the shadow relative to the plane picture. On the premise that the offset distance of the shadow relative to the plane picture is known, the position of the shadow can be determined by obtaining the orientation of the shadow relative to the plane picture. The orientation of the shadow relative to the plane image is:
其中,Xl是二维坐标系中光源的当前位置在X轴的投影,Yl是二维坐标系中光源的当前位置在Y轴的投影,Xi是二维坐标系中平面图片的中心点的位置在X轴的投影,Yi是二维坐标系中平面图片的中心点的位置在Y轴的投影。Among them, Xl is the projection of the current position of the light source on the X axis in the two-dimensional coordinate system, Yl is the projection of the current position of the light source on the Y axis in the two-dimensional coordinate system, and Xi is the position of the center point of the plane picture in the two-dimensional coordinate system In the projection of the X axis, Yi is the projection of the center point of the plane image in the two-dimensional coordinate system on the Y axis.
在二维坐标系中,所述平面图片的中心点与所述光源的当前位置之间的距离与预设的偏移因子的乘积即为阴影相对于平面图片的偏移位置,其中预设的偏移因子是大于零的自然数。实时将所述平面图片的投影图片向所述方位Direct移动所述偏移位置的长度,即可获得平面图片当前的阴影。针对每次获取的光源位置、平面图片的中心点与所述光源的当前位置之间的距离,以及所述平面图片的中心点与所述光源的当前位置的连线与坐标轴所形成的角度,均执行步骤220以确定所述平面图片当前阴影的位置的操作。因此在光源与所述平面图片的相对位置发生变化时,阴影的位置也随之发生变化。In the two-dimensional coordinate system, the product of the distance between the center point of the plane picture and the current position of the light source and the preset offset factor is the offset position of the shadow relative to the plane picture, where the preset The offset factor is a natural number greater than zero. The current shadow of the plane picture can be obtained by moving the projection picture of the plane picture toward the direction Direct by the length of the offset position in real time. For the position of the light source acquired each time, the distance between the center point of the plane picture and the current position of the light source, and the angle formed by the line connecting the center point of the plane picture and the current position of the light source and the coordinate axis , both execute step 220 to determine the position of the current shadow of the plane picture. Therefore, when the relative position of the light source and the plane picture changes, the position of the shadow also changes accordingly.
本发明实施例提供的为平面图片设置动态阴影的方法,通过获取所述平面图片在二维坐标系中的全等图形,以作为所述平面图片的投影图片;实时根据所述距离、所述角度、以及预设的偏移因子,确定所述平面图片当前阴影的位置。通过本方法实现在二维坐标系中,为平面图片设置动态阴影的目的。The method for setting a dynamic shadow for a planar picture provided by the embodiment of the present invention obtains the congruent figure of the planar picture in a two-dimensional coordinate system as a projected picture of the planar picture; according to the distance, the The angle and the preset offset factor determine the position of the current shadow of the planar picture. Through this method, the purpose of setting a dynamic shadow for a plane picture in a two-dimensional coordinate system is realized.
第三实施例third embodiment
图3是本发明第三实施例提供的为平面图片设置动态阴影的方法的流程图。所述为平面图片设置动态阴影的方法以本发明第一实施例为基础,进一步的,在三维坐标系中,将所述实时获取光源的当前位置,获取平面图片的中心点与所述光源的当前位置之间的距离,获取所述平面图片的中心点与所述光源的当前位置的连线与坐标轴所形成的角度的操作具体优化为:Fig. 3 is a flowchart of a method for setting dynamic shadows for a planar picture according to the third embodiment of the present invention. The method for setting a dynamic shadow for a planar picture is based on the first embodiment of the present invention. Further, in the three-dimensional coordinate system, the real-time acquisition of the current position of the light source, the center point of the acquired planar picture and the position of the light source The distance between the current positions, the operation of obtaining the angle formed by the line connecting the center point of the plane picture and the current position of the light source and the coordinate axis is specifically optimized as follows:
获取平面图片的中心点以及光源的当前位置在投影平面的坐标,根据所述坐标计算投影平面内所述平面图片的中心点与所述光源的当前位置之间的距离;Acquiring the coordinates of the center point of the plane picture and the current position of the light source on the projection plane, and calculating the distance between the center point of the plane picture in the projection plane and the current position of the light source according to the coordinates;
根据平面图片的中心点以及光源的当前位置在投影平面的坐标,以及投影平面内所述平面图片的中心点与所述光源的当前位置之间的距离,确定所述平面图片的中心点与所述光源的当前位置在投影平面的连线与坐标轴所成的角度,以作为偏移角度。According to the center point of the plane picture and the coordinates of the current position of the light source on the projection plane, and the distance between the center point of the plane picture and the current position of the light source in the projection plane, determine the distance between the center point of the plane picture and the current position of the light source. The angle formed by the line connecting the current position of the light source on the projection plane and the coordinate axis is used as the offset angle.
进一步的,将根据当前获取到的所述距离、所述角度、以及偏移因子,确定所述平面图片当前的阴影的位置和投影图片的操作具体优化为:实时根据所述光源的当前位置与平面图片的中心点的位置在投影平面内的距离以及预设的投影图片距离平面图片的高度,确定偏移因子;根据所述偏移因子、偏移角度确定所述平面图片当前阴影的位置。Further, according to the currently acquired distance, angle, and offset factor, the operation of determining the current shadow position of the plane picture and the projected picture is specifically optimized as follows: in real time, according to the current position of the light source and The distance of the position of the center point of the planar picture in the projection plane and the preset height of the projected picture from the planar picture determine the offset factor; determine the current shadow position of the planar picture according to the offset factor and offset angle.
参照图3所示,所述为平面图片设置动态阴影的方法,包括如下步骤:Referring to Fig. 3, the method for setting dynamic shadows for a plane picture includes the following steps:
步骤S310:获取光源的当前位置以及平面图片的中心点坐标。Step S310: Obtain the current position of the light source and the coordinates of the center point of the planar image.
初始化默认光源,并在将平面图片拖放于三维坐标系之后,判断所述默认光源是否经过自定义操作,若否,则拖放光源,并调整光源的高度。实时获取光源的当前位置Plight,坐标记为(Xl,Yl,Zl)和平面图片的中心点在三维坐标系中的位置Pimage,坐标记为(Xi,Yi,Zi)。Initialize the default light source, and after dragging and dropping the planar image to the three-dimensional coordinate system, judge whether the default light source has been customized, if not, drag and drop the light source, and adjust the height of the light source. The current position Plight of the light source is obtained in real time, and the coordinates are marked as (Xl, Yl, Zl) and the position Pimage of the center point of the planar image in the three-dimensional coordinate system, and the coordinates are marked as (Xi, Yi, Zi).
步骤S320:根据所述光源的当前位置与平面图片的中心点在投影平面的坐标以及预设的投影图片距离平面图片的高度确定偏移因子。Step S320: Determine the offset factor according to the current position of the light source and the coordinates of the center point of the planar picture on the projection plane and the preset height of the projected picture from the planar picture.
在获取光源的当前位置时,根据光源的当前位置Plight(Xl,Yl,Zl)和平面图片的中心点在三维坐标系中的位置Pimage(Xi,Yi,Zi)以及预设的投影图片距离平面图片的高度Hs确定偏移因子。例如,以XY平面作为投影平面,首先,获得平面图片在XY平面的投影以及所述光源的当前位置在XY平面的投影。根据两点间的距离公式得到平面图片的中心点与所述光源的当前位置在XY平面的投影之间的距离。通过从三维坐标中取出二维投影坐标的方法计算平面图片的中心点与所述光源的当前位置在XY平面的投影之间的距离,根据三维坐标系中的Z轴分量计算偏移因子factor。When obtaining the current position of the light source, according to the current position Plight (Xl, Yl, Zl) of the light source and the position Pimage (Xi, Yi, Zi) of the center point of the plane picture in the three-dimensional coordinate system and the preset projection picture The height Hs from the plane picture determines the offset factor. For example, if the XY plane is used as the projection plane, firstly, the projection of the plane picture on the XY plane and the projection of the current position of the light source on the XY plane are obtained. The distance between the center point of the plane picture and the projection of the current position of the light source on the XY plane is obtained according to the distance formula between two points. Calculate the distance between the center point of the plane picture and the projection of the current position of the light source on the XY plane by taking out the two-dimensional projection coordinates from the three-dimensional coordinates, and calculate the offset factor factor according to the Z-axis component in the three-dimensional coordinate system.
从三维坐标P3D(X,Y,Z)中取出二维投影坐标P2D(X’,Y’)的方法为:The method of extracting the two-dimensional projected coordinates P2D (X', Y') from the three-dimensional coordinates P3D (X, Y, Z) is:
其中,X是三维坐标系中X轴分量,Y是三维坐标系中Y轴分量,X’是三维坐标系中X轴分量在XY平面的投影,Y’是三维坐标系中Y轴分量在XY平面的投影。Among them, X is the X-axis component in the three-dimensional coordinate system, Y is the Y-axis component in the three-dimensional coordinate system, X' is the projection of the X-axis component on the XY plane in the three-dimensional coordinate system, and Y' is the Y-axis component in the three-dimensional coordinate system on XY flat projection.
综上所述,所述平面图片的中心点与所述光源的当前位置在XY平面的投影之间的距离为In summary, the distance between the center point of the plane picture and the projection of the current position of the light source on the XY plane is
其中,Xl是光源的当前位置的X轴分量在XY平面的投影,Yl是光源的当前位置的Y轴分量在XY平面的投影,Xi是平面图片的中心点的X轴分量在XY平面的投影,Yi是平面图片的中心点的Y轴分量在XY平面的投影。Among them, Xl is the projection of the X-axis component of the current position of the light source on the XY plane, Yl is the projection of the Y-axis component of the current position of the light source on the XY plane, and Xi is the projection of the X-axis component of the center point of the plane picture on the XY plane , Yi is the projection of the Y-axis component of the center point of the plane picture on the XY plane.
如图3-1所示,光源和平面图片在YZ平面的投影组成的三角形的边和角的比例关系与光源和平面图片在XY平面的投影的比例关系相同。平面图片在YZ平面的投影平行于投影图片在YZ平面的投影,则∠α=∠β,由三角形比例关系可知:As shown in Figure 3-1, the proportional relationship between the sides and angles of the triangle formed by the projection of the light source and the plane picture on the YZ plane is the same as that of the projection of the light source and the plane picture on the XY plane. The projection of the plane picture on the YZ plane is parallel to the projection of the projected picture on the YZ plane, then ∠α=∠β, which can be known from the triangle proportional relationship:
其中,factor为偏移因子,用以表示投影图片与平面图片的偏移位置的缩放系数,Distance为所述平面图片的中心点与所述光源的当前位置在XY平面的投影之间的距离,Zl为光源当前位置的Z轴分量,Zi为所述平面图片的中心点的Z轴分量,Zs为投影图片的中心点的Z轴分量。Among them, factor is an offset factor, which is used to represent the scaling factor of the offset position between the projection picture and the plane picture, and Distance is the distance between the center point of the plane picture and the projection of the current position of the light source on the XY plane, Zl is the Z-axis component of the current position of the light source, Zi is the Z-axis component of the center point of the plane picture, and Zs is the Z-axis component of the center point of the projected picture.
整理得到:Organized to get:
偏移因子为:The offset factor is:
其中,Xl是光源的当前位置的X轴分量在XY平面的投影,Yl是光源的当前位置的Y轴分量在XY平面的投影,Xi是平面图片的中心点的X轴分量在XY平面的投影,Yi是平面图片的中心点的Y轴分量在XY平面的投影,Zl为光源当前位置的Z轴分量,Zi为所述平面图片的中心点的Z轴分量,Zs为投影图片的中心点的Z轴分量。Among them, Xl is the projection of the X-axis component of the current position of the light source on the XY plane, Yl is the projection of the Y-axis component of the current position of the light source on the XY plane, and Xi is the projection of the X-axis component of the center point of the plane picture on the XY plane , Yi is the projection of the Y-axis component of the center point of the plane picture on the XY plane, Zl is the Z-axis component of the current position of the light source, Zi is the Z-axis component of the center point of the plane picture, and Zs is the projection of the center point of the projected picture Z axis component.
上述计算方法仅是一种获得偏移因子的实施方法,本领域的技术人员可以理解为获得偏移因子的计算方法包括但不仅限于上述列举的方式,只要能实现获得投影图片与平面图片的偏移位置的缩放系数的算法均为本发明的等效实施例。The above calculation method is only an implementation method for obtaining the offset factor. Those skilled in the art can understand that the calculation method for obtaining the offset factor includes but is not limited to the methods listed above, as long as the offset between the projected picture and the plane picture can be obtained. Algorithms for shifting the scaling factor are equivalent embodiments of the present invention.
步骤S330:确定所述光源的当前位置与平面图片中心点在投影平面的投影连线,获取所述投影连线与坐标轴所成的角度,以确定偏移角度。Step S330: Determine the projection line between the current position of the light source and the center point of the planar picture on the projection plane, and obtain the angle formed by the projection line and the coordinate axis to determine the offset angle.
由上可知,所述光源的当前位置Plight(Xl,Yl,Zl)在XY平面的投影是P’light(Xl,Yl),平面图片的中心点Pimage(Xi,Yi,Zi)在XY平面的投影是P’image(Xi,Yi),则由所述光源的当前位置Plight(Xl,Yl,Zl)到平面图片的中心点Pimage(Xi,Yi,Zi)在XY平面的投影之间的连线与坐标轴所成的偏移角度为:As can be seen from the above, the projection of the current position Plight (Xl, Yl, Zl) of the light source on the XY plane is P'light (Xl, Yl), and the center point Pimage (Xi, Yi, Zi) of the plane picture is on the XY plane. The projection of the plane is P'image (Xi, Yi), then the projection from the current position Plight (Xl, Yl, Zl) of the light source to the center point Pimage (Xi, Yi, Zi) of the plane picture on the XY plane The offset angle between the connection line and the coordinate axis is:
其中,Xl是光源的当前位置的X轴分量在XY平面的投影,Yl是光源的当前位置的Y轴分量在XY平面的投影,Xi是平面图片的中心点的X轴分量在XY平面的投影,Yi是平面图片的中心点的Y轴分量在XY平面的投影。Among them, Xl is the projection of the X-axis component of the current position of the light source on the XY plane, Yl is the projection of the Y-axis component of the current position of the light source on the XY plane, and Xi is the projection of the X-axis component of the center point of the plane picture on the XY plane , Yi is the projection of the Y-axis component of the center point of the plane picture on the XY plane.
步骤S340:获取所述平面图片在三维坐标系的投影平面中的全等图形。Step S340: Obtain the congruent figure of the plane picture in the projection plane of the three-dimensional coordinate system.
一种优选地实现方式包括:A preferred implementation includes:
若所述平面图片是规则图形,则获取所述平面图片的外形尺寸,根据所述外形尺寸在三维坐标系的投影平面中生成一个与所述平面图片外形尺寸相同的全等图形;If the planar picture is a regular figure, then obtain the external dimensions of the planar picture, and generate a congruent figure with the same external dimensions as the planar picture in the projection plane of the three-dimensional coordinate system according to the external dimensions;
若所述平面图片是不规则图形,则获取所述平面图片的各个像素的透明度值,并将各个像素的颜色取值转换为对应像素的透明度值,将转换操作后得到的灰度图作为三维坐标系的投影平面中与所述平面图片外形尺寸相同的全等图形。If the plane picture is an irregular figure, the transparency value of each pixel of the plane picture is obtained, and the color value of each pixel is converted into the transparency value of the corresponding pixel, and the grayscale image obtained after the conversion operation is used as a three-dimensional A congruent figure in the projection plane of the coordinate system having the same dimensions as the plane picture.
在本方法中,在三维坐标系的投影平面中生成与所述平面图片外形尺寸相同的全等图形的方式与在二维坐标系中相同,此处不再赘述。In this method, the method of generating congruent graphics with the same dimensions as the planar picture in the projection plane of the three-dimensional coordinate system is the same as that in the two-dimensional coordinate system, and will not be repeated here.
步骤S350:分别对所述全等图形的宽度和高度按照缩放因子进行缩放操作,以获得投影图片。Step S350: Scale the width and height of the congruent figure according to the scaling factor to obtain a projected picture.
一种优选地实现方式包括:A preferred implementation includes:
根据平面图片的对角线的两个端点与所述光源的当前位置在投影平面的距离以及所述光源的当前位置分别与所述平面图片的对角线的两个端点的连线与坐标轴所成的角度,确定所述全等图形的外接矩形,分别确定所述外接矩形的宽度与所述平面图片的宽度的商,以及所述外接矩形的高度与所述平面图片的高度的商,以作为所述全等图形的宽度的缩放因子和高度的缩放因子;According to the distance between the two endpoints of the diagonal line of the plane picture and the current position of the light source on the projection plane, and the connection line and coordinate axis between the current position of the light source and the two end points of the diagonal line of the plane picture respectively The formed angle determines the circumscribing rectangle of the congruent figure, respectively determines the quotient of the width of the circumscribing rectangle and the width of the plane picture, and the quotient of the height of the circumscribing rectangle and the height of the plane picture, as the scaling factor of the width of the congruent figure and the scaling factor of the height;
实时将所述全等图形的宽度和高度分别按照各自的缩放因子进行压缩或拉伸,以获得所述平面图片的投影图片。The width and height of the congruent figure are respectively compressed or stretched according to their respective scaling factors in real time, so as to obtain the projected picture of the planar picture.
下述具体说明将所述平面图片的全等图形按照缩放因子进行压缩或拉伸操作,以获得投影图片的操作步骤。The following describes in detail the operation steps of compressing or stretching the congruent graphics of the planar picture according to the scaling factor to obtain the projected picture.
根据所述平面图片的对角线的两个端点与所述光源的当前位置之间的距离,确定所述平面图片当前的阴影的外接矩形。According to the distance between the two end points of the diagonal line of the plane picture and the current position of the light source, the circumscribed rectangle of the current shadow of the plane picture is determined.
已知所述平面图片的对角线的两个端点的坐标分别是PAi(XAi,YAi,ZAi)与PBi(XBi,YBi,ZBi),求得阴影的外接矩形的对应的对角线的两个端点的坐标PAs(XAs,YAs,ZAs)与PBs(XBs,YBs,ZAs)。Known that the coordinates of the two endpoints of the diagonal of the plane picture are respectively PAi (XAi , YAi , ZAi ) and PBi (XBi , YBi , ZBi ), the circumscribed rectangle of the shadow is obtained The coordinates PAs (XAs , YAs , ZAs ) and PBs (XBs , YBs , ZAs ) of the two endpoints of the corresponding diagonal line.
参照图3-1所示,由三角形比例可知:Referring to Figure 3-1, it can be known from the proportion of the triangle:
其中,factor1为第一偏移因子,用以表示阴影图片的一个端点PAs与平面图片的相应的对角线的端点PAi的偏移位置的缩放系数,Distance1为第一距离,用以表示所述平面图片的端点PAi与所述光源的当前位置在XY平面的投影之间的距离,Zl为光源当前位置的Z轴分量,ZAi为所述平面图片的中心点的Z轴分量,ZAs为投影图片的中心点的Z轴分量。Among them, factor1 is the first offset factor, which is used to represent the scaling factor of the offset position between an end point PAs of the shadow picture and the corresponding diagonal end point PAi of the plane picture, and Distance1 is the first distance, which is used to represent The distance between the endpoint PAi of the plane picture and the projection of the current position of the light source on the XY plane, Z1 is the Z-axis component of the current position of the light source, ZAi is the Z-axis component of the central point of the plane picture, ZAs is the Z-axis component of the center point of the projected image.
将Will
(其中,Xl为光源当前位置的X轴分量在XY平面的投影,Yl为光源当前位置的Y轴分量在XY平面的投影,XAi为所述平面图片的端点PAi的X轴分量在XY平面的投影,YAi为所述平面图片的端点PAi的Y轴分量在XY平面的投影)代入上述公式,整理得到:(Wherein, X1 is the projection of the X-axis component of the current position of the light source on the XY plane, Y1 is the projection of the Y-axis component of the current position of the light source on the XY plane, and XAi is the X-axis component of the endpoint PAi of the plane picture in XY The projection of the plane, YAi is the projection of the Y-axis component of the endpoint PAi of the plane picture on the XY plane) into the above-mentioned formula, arrange and obtain:
其中,Xl为光源当前位置的X轴分量在XY平面的投影,Yl为光源当前位置的Y轴分量在XY平面的投影,XAi为所述平面图片的端点PAi的X轴分量在XY平面的投影,YAi为所述平面图片的端点PAi的Y轴分量在XY平面的投影,Zl为光源当前位置的Z轴分量,ZAi为所述平面图片的中心点的Z轴分量,ZAs为投影图片的中心点的Z轴分量。Wherein, X1 is the projection of the X-axis component of the current position of the light source on the XY plane, Y1 is the projection of the Y-axis component of the current position of the light source on the XY plane, and XAi is the X-axis component of the endpoint PAi of the plane picture on the XY plane YAi is the projection of the Y-axis component of the endpoint PAi of the plane picture on the XY plane, Zl is the Z-axis component of the current position of the light source, ZAi is the Z-axis component of the center point of the plane picture, and ZAs is the Z-axis component of the center point of the projected picture.
由所述光源的当前位置Plight(Xl,Yl,Zl)到平面图片的对角线的其中一个端点PAi(XAi,YAi,ZAi)在XY平面的投影之间的连线与坐标轴所成的偏移角度为:The connection line between the projection of the current position Plight (Xl, Yl, Zl) of the light source to one of the endpoints PAi (XAi , YAi , ZAi ) of the diagonal of the plane picture on the XY plane and The offset angle formed by the coordinate axes is:
其中,Xl为光源当前位置的X轴分量在XY平面的投影,Yl为光源当前位置的Y轴分量在XY平面的投影,XAi为所述平面图片的端点PAi的X轴分量在X平面的投影,YAi为所述平面图片的端点PAi的Y轴分量在XY平面的投影。Wherein, X1 is the projection of the X-axis component of the current position of the light source on the XY plane, Y1 is the projection of the Y-axis component of the current position of the light source on the XY plane, and XAi is the X-axis component of the endpoint PAi of the plane picture on the X plane YAi is the projection of the Y-axis component of the endpoint PAi of the plane picture on the XY plane.
则阴影的外接矩形的对角线的一个端点的坐标是:Then the coordinates of one endpoint of the diagonal of the bounding rectangle of the shadow are:
其中,Xl为光源当前位置的X轴分量在XY平面的投影,Yl为光源当前位置的Y轴分量在XY平面的投影,XAi为所述平面图片的端点PAi的X轴分量在XY平面的投影,YAi为所述平面图片的端点PAi的Y轴分量在XY平面的投影,factor1为第一偏移因子,用以表示投影图片的一个端点PAs与平面图片的相应的对角线的端点PAi的偏移位置的缩放系数。Wherein, X1 is the projection of the X-axis component of the current position of the light source on the XY plane, Y1 is the projection of the Y-axis component of the current position of the light source on the XY plane, and XAi is the X-axis component of the endpoint PAi of the plane picture on the XY plane YAi is the projection of the Y-axis component of the endpoint PAi of the plane picture on the XY plane, and factor1 is the first offset factor, which is used to represent the corresponding diagonal angle between an endpoint PAs of the projected picture and the plane picture Scaling factor for the offset position of the endpoint PAi of the line.
同样的,same,
阴影的外接矩形相应对角线的另一个端点的坐标是:The coordinates of the other endpoint of the corresponding diagonal of the bounding rectangle of the shadow are:
其中,Xl为光源当前位置的X轴分量在XY平面的投影,Yl为光源当前位置的Y轴分量在XY平面的投影,XBi为所述平面图片的端点PBi的X轴分量在XY平面的投影,YBi为所述平面图片的端点PBi的Y轴分量在XY平面的投影,factor2为第二偏移因子,用以表示投影图片的一个端点PBs与平面图片的相应的对角线的端点PBi的偏移位置的缩放系数。Wherein, X1 is the projection of the X-axis component of the current position of the light source on the XY plane, Y1 is the projection of the Y-axis component of the current position of the light source on the XY plane, and XBi is the X-axis component of the endpoint PBi of the plane picture on the XY plane The projection of YBi is the projection of the Y-axis component of the endpoint PBi of the plane picture on the XY plane, and factor2 is the second offset factor, which is used to represent the corresponding diagonal angle between an endpoint PBs of the projected picture and the plane picture Scaling factor for the offset position of the endpoint PBi of the line.
由阴影的外接矩形的对角线的两个端点的坐标,可以得到阴影外接矩形的宽度和高度。本发明中,认为阴影外接矩形的宽度和高度与投影图片的宽度和高度相等,则阴影的宽度和高度分别是:From the coordinates of the two endpoints of the diagonal of the circumscribed rectangle of the shadow, the width and height of the circumscribed rectangle of the shadow can be obtained. In the present invention, it is considered that the width and height of the shadow circumscribed rectangle are equal to the width and height of the projected picture, then the width and height of the shadow are respectively:
其中,XAs为阴影的外接矩形的对角线的一个端点PAs的X轴分量在XY平面的投影,YAs为阴影的外接矩形的对角线的一个端点PAs的Y轴分量在XY平面的投影,XBs为阴影的外接矩形相应对角线的另一个端点PBs的X轴分量在XY平面的投影,YBs为阴影的外接矩形相应对角线的另一个端点PBs的Y轴分量在XY平面的投影。Among them, XAs is the projection of the X-axis component of an endpoint PAs of the diagonal of the circumscribed rectangle of the shadow on the XY plane, and YAs is the Y-axis component of an endpoint of the diagonal of the circumscribed rectangle of the shadow PAs in XY The projection of the plane, XBs is the projection of the X-axis component of the other endpoint PBs of the corresponding diagonal of the circumscribed rectangle of the shadow on the XY plane, YBs is the Y of the other endpoint PBs of the corresponding diagonal of the circumscribed rectangle of the shadow The projection of the axis components on the XY plane.
投影图片的宽度的缩放因子是阴影的外接矩形的宽度除以所述平面图片的宽度,即:The scaling factor for the width of the projected image is the width of the bounding rectangle of the shadow divided by the width of the planar image, ie:
其中,Widthshadow为阴影外接矩形的宽度,Widthimage为所述平面图片的宽度,XAs为阴影图片的对角线上一个端点PAs的X轴分量在XY平面的投影,XBs为阴影图片的对角线上一个端点PBs的X轴分量在XY平面的投影,XAi为所述平面图片的端点PAi的X轴分量在XY平面的投影,XBi为所述平面图片的端点PBi的X轴分量在XY平面的投影。Wherein, Widthshadow is the width of the rectangle circumscribing the shadow, Widthimage is the width of the plane picture, XAs is the projection of the X-axis component of an endpoint PAs on the diagonal of the shadow picture on the XY plane, and XBs is the projection of the shadow picture The projection of the X-axis component of an endpoint PBs on the diagonal on the XY plane, XAi is the projection of the X-axis component of the endpoint PAi of the plane picture on the XY plane, and XBi is the endpoint PBi of the plane picture The projection of the X-axis component on the XY plane.
投影图片的高度的缩放因子是阴影的外接矩形的高度除以所述平面图片的高度,即:The scaling factor for the height of the projected image is the height of the bounding rectangle of the shadow divided by the height of the planar image, ie:
其中,Heightshadow为阴影外接矩形的高度,Heightimage为所述平面图片的高度,YAs为阴影图片的对角线上一个端点PAs的Y轴分量在XY平面的投影,YBs为阴影图片的对角线上一个端点PBs的Y轴分量在XY平面的投影,YAi为所述平面图片的端点PAi的Y轴分量在XY平面的投影,YBi为所述平面图片的端点PBi的Y轴分量在XY平面的投影。Wherein, Heightshadow is the height of the rectangle circumscribing the shadow, Heightimage is the height of the plane picture, YAs is the projection of the Y-axis component of an endpoint PAs on the diagonal of the shadow picture on the XY plane, and YBs is the shadow picture The projection of the Y-axis component of an endpoint PBs on the XY plane on the diagonal of , YAi is the projection of the Y-axis component of the endpoint PAi of the plane picture on the XY plane, and YBi is the endpoint P of the plane picture The projection of the Y-axis component ofBi on the XY plane.
综上可知,投影图片的宽度乘以宽度的缩放因子得到缩放变形后的投影图片的宽度,投影图片的高度乘以高度缩放因子得到缩放变形后的投影图片高度。In summary, the width of the projected picture is multiplied by the scaling factor of the width to obtain the width of the projected picture after scaling and deformation, and the height of the projected picture is multiplied by the height scaling factor to obtain the height of the projected picture after scaling and deformation.
步骤S360:实时根据所述偏移因子、所述偏移角度、以及预设的投影图片距离所述平面图片的高度确定所述平面图片当前阴影的位置。Step S360: Determine the position of the current shadow of the planar picture in real time according to the offset factor, the offset angle, and the preset height of the projected picture from the planar picture.
由步骤S320中得到的偏移因子factor和步骤S330中得到的偏移角度Direct,确定投影中心点的位置Pshadow(Xs,Ys,Zs)为:By the offset factor factor obtained in step S320 and the offset angle Direct obtained in step S330, determine the position Pshadow (Xs, Ys, Zs) of projection center point as:
其中,Direct(x)为偏移角度的X轴分量,Direct(y)为偏移角度的Y轴分量,factor为偏移因子,用以表示投影图片与平面图片的偏移位置的缩放系数;Xl为光源当前位置的X轴分量在XY平面的投影,Yl为光源当前位置的Y轴分量在XY平面的投影,Xi是平面图片的中心点的X轴分量在XY平面的投影,Yi是平面图片的中心点的Y轴分量在XY平面的投影,Distance为所述平面图片的中心点与所述光源的当前位置在XY平面的投影之间的距离。Wherein, Direct(x) is the X-axis component of the offset angle, Direct(y) is the Y-axis component of the offset angle, and factor is an offset factor, which is used to represent the scaling factor of the offset position of the projected picture and the plane picture; Xl is the projection of the X-axis component of the current position of the light source on the XY plane, Yl is the projection of the Y-axis component of the current position of the light source on the XY plane, Xi is the projection of the X-axis component of the center point of the plane image on the XY plane, and Yi is the plane The projection of the Y-axis component of the center point of the picture on the XY plane, and Distance is the distance between the center point of the plane picture and the projection of the current position of the light source on the XY plane.
则阴影中心点的位置Pshadow为其中,factor为偏移因子,用以表示投影图片与平面图片的偏移位置的缩放系数,Distance为所述平面图片的中心点与所述光源的当前位置在XY平面的投影之间的距离,Zi为所述平面图片的中心点的Z轴分量,Hs为投影图片与所述平面图片在XY平面的投影之间的距离。又因为阴影的位置的变化即为在投影平面的平移,则确定了阴影中心点的坐标即可确定阴影的位置。Then the position Pshadow of the center point of the shadow is Among them, factor is an offset factor, which is used to represent the scaling factor of the offset position between the projection picture and the plane picture, and Distance is the distance between the center point of the plane picture and the projection of the current position of the light source on the XY plane, Zi is the Z-axis component of the center point of the plane picture, and Hs is the distance between the projection picture and the projection of the plane picture on the XY plane. And because the change of the position of the shadow is the translation on the projection plane, the position of the shadow can be determined by determining the coordinates of the center point of the shadow.
步骤S370:在确定所述位置和所述投影图片之后,将所述投影图片在所述阴影的位置进行显示。Step S370: After determining the position and the projected picture, display the projected picture at the position of the shadow.
在确定了阴影位置后,将投影图片在所述阴影的位置显示的方法可以是:在投影平面中,实时将所述平面图片的投影图片移动至步骤S360确定的所述平面图片当前阴影的位置,然后根据步骤S350的宽度缩放因子和高度缩放因子对所述平面图片的投影图片的宽度和高度进行压缩或拉伸,并将压缩或拉伸操作后的投影图片显示于所述平面图片当前阴影的位置。针对每次获取光源的当前位置以及平面图片的中心点坐标,均执行S320至S370所记载的操作。After the shadow position is determined, the method for displaying the projected picture at the shadow position may be: in the projection plane, moving the projected picture of the plane picture to the current shadow position of the plane picture determined in step S360 in real time , and then compress or stretch the width and height of the projected picture of the plane picture according to the width scaling factor and the height scaling factor of step S350, and display the projected picture after the compression or stretching operation on the current shadow of the plane picture s position. The operations described in S320 to S370 are performed each time the current position of the light source and the coordinates of the center point of the planar image are acquired.
本发明实施例提供的为平面图片设置动态阴影的方法,通过获取平面图片的中心点以及光源的当前位置在投影平面的坐标,根据投影平面内所述坐标计算所述平面图片的中心点与所述光源的当前位置之间的距离;根据平面图片的中心点以及光源的当前位置在投影平面的坐标,以及投影平面内所述平面图片的中心点与所述光源的当前位置之间的距离,确定所述平面图片的中心点与所述光源的当前位置在投影平面的连线与坐标轴所成的角度,以作为偏移角度;然后,获取所述平面图片在三维坐标系的投影平面中的全等图形,分别对所述全等图形的宽度和高度按照缩放因子进行缩放操作,以获取投影图片;实时根据所述偏移因子、所述偏移角度、以及预设的投影图片距离所述平面图片的高度确定所述平面图片当前阴影的位置,并将所述投影图片在所述阴影的位置进行显示。通过本方法实现在三维坐标系中,为平面图片设置动态阴影的目的。The method for setting a dynamic shadow for a planar picture provided by the embodiment of the present invention obtains the center point of the planar picture and the coordinates of the current position of the light source on the projection plane, and calculates the relationship between the center point of the planar picture and the coordinates in the projection plane according to the coordinates in the projection plane. The distance between the current positions of the light sources; according to the center point of the plane picture and the coordinates of the current position of the light source on the projection plane, and the distance between the center point of the plane picture in the projection plane and the current position of the light source, Determine the angle formed by the center point of the plane picture and the current position of the light source on the projection plane and the coordinate axis as the offset angle; then, obtain the plane picture in the projection plane of the three-dimensional coordinate system Congruent graphics, respectively zooming the width and height of the congruent graphics according to the scaling factor to obtain the projected picture; real-time according to the offset factor, the offset angle, and the preset distance from the projected picture The height of the planar picture determines the position of the current shadow of the planar picture, and the projected picture is displayed at the position of the shadow. Through this method, the purpose of setting a dynamic shadow for a plane picture in a three-dimensional coordinate system is realized.
第四实施例Fourth embodiment
图4是本发明第四实施例提供的为平面图片设置动态阴影的装置的结构示意图。参照图4所示,所述为平面图片设置动态阴影的装置,包括:Fig. 4 is a schematic structural diagram of an apparatus for setting a dynamic shadow for a planar image according to a fourth embodiment of the present invention. Referring to Figure 4, the device for setting dynamic shadows for a plane picture includes:
获取单元410,用于实时获取光源的当前位置,获取平面图片的中心点与所述光源的当前位置之间的距离,获取所述平面图片的中心点与所述光源的当前位置的连线与坐标轴所形成的角度;The acquiring unit 410 is configured to acquire the current position of the light source in real time, acquire the distance between the center point of the plane picture and the current position of the light source, and acquire the connection line between the center point of the plane picture and the current position of the light source and the angle formed by the coordinate axes;
确定单元420,用于根据当前获取到的所述距离、所述角度、以及偏移因子,确定所述平面图片当前的阴影的位置和投影图片,将所述投影图片在所述阴影的位置进行显示。The determining unit 420 is configured to determine a current shadow position and a projected picture of the planar picture according to the currently acquired distance, the angle, and an offset factor, and make the projected picture at the position of the shadow show.
进一步的,在二维坐标系中,所述确定单元420包括:Further, in the two-dimensional coordinate system, the determining unit 420 includes:
第一获取子单元421,用于获取所述平面图片在二维坐标系中的全等图形,以作为所述平面图片的投影图片;The first obtaining subunit 421 is configured to obtain the congruent figure of the planar picture in the two-dimensional coordinate system as a projected picture of the planar picture;
第一确定子单元422,用于采用如下公式确定所述平面图片当前的阴影的位置:The first determining subunit 422 is configured to determine the current shadow position of the plane picture by using the following formula:
其中,为坐标原点指向阴影中心点Pshadow的向量,为坐标原点指向平面图片的中心点Pimage的向量,为坐标原点指向光源的当前位置Plight的向量,factor为预设的偏移因子且factor>0。in, is the vector from the coordinate origin pointing to the shadow center point Pshadow , is the vector whose coordinate origin points to the center point Pimage of the plane image, is the vector whose coordinate origin points to the current position Plight of the light source, factor is the preset offset factor and factor>0.
进一步的,所述第一获取子单元421具体用于:Further, the first acquiring subunit 421 is specifically used for:
若所述平面图片是规则图形,则获取所述平面图片的外形尺寸,根据所述外形尺寸在二维坐标系中生成一个与所述平面图片外形尺寸相同的全等图形;If the planar picture is a regular figure, then obtain the external dimensions of the planar picture, and generate a congruent figure with the same external dimensions as the planar picture in a two-dimensional coordinate system according to the external dimensions;
若所述平面图片不是规则图形,则获取所述平面图片的各个像素的透明度值,并将各个像素的颜色取值转换为对应像素的透明度值,将转换操作后得到的灰度图作为二维坐标系中与所述平面图片外形尺寸相同的全等图形。If the plane picture is not a regular figure, then obtain the transparency value of each pixel of the plane picture, and convert the color value of each pixel into the transparency value of the corresponding pixel, and use the grayscale image obtained after the conversion operation as a two-dimensional A congruent figure in the coordinate system having the same dimensions as the planar picture.
本实施例的技术方案,通过获取单元410实时获取光源的当前位置,平面图片的中心点与所述光源的当前位置之间的距离,以及所述平面图片的中心点与所述光源的当前位置的连线与坐标轴所形成的角度,并通过确定单元420确定所述平面图片当前的阴影的位置和在二维坐标系中投影图片,将所述投影图片在所述阴影的位置进行显示。在二维坐标系中,实现根据光源与平面图片的相对位置为平面图片实时生成动态的阴影的目的,解决现有技术中虚拟场景中阴影与现实场景的阴影不一致的问题,能使虚拟场景更加逼真。In the technical solution of this embodiment, the current position of the light source, the distance between the center point of the plane picture and the current position of the light source, and the current position of the center point of the plane picture and the light source are acquired in real time through the acquisition unit 410 The angle formed by the connection line and the coordinate axis, and determine the position of the current shadow of the plane picture and project the picture in the two-dimensional coordinate system through the determination unit 420, and display the projected picture at the position of the shadow. In the two-dimensional coordinate system, the purpose of generating real-time dynamic shadows for the plane picture according to the relative position of the light source and the plane picture is realized, and the problem of inconsistency between the shadow in the virtual scene and the shadow of the real scene in the prior art is solved, and the virtual scene can be made more transparent. lifelike.
本实施例提供的为平面图片设置动态阴影的装置可执行本发明实施例二所提供的为平面图片设置动态阴影的方法,具备执行方法相应的功能模块和有益效果。The device for setting dynamic shadows for plane pictures provided in this embodiment can execute the method for setting dynamic shadows for plane pictures provided in Embodiment 2 of the present invention, and has corresponding functional modules and beneficial effects for executing the method.
第五实施例fifth embodiment
图5是本发明第五实施例提供的一种为平面图片设置动态阴影的装置的结构示意图。参照图5所示,所述为平面图片设置动态阴影的装置,包括:Fig. 5 is a schematic structural diagram of an apparatus for setting dynamic shadows for a planar image according to a fifth embodiment of the present invention. Referring to Figure 5, the device for setting dynamic shadows for a plane picture includes:
获取单元510,用于实时获取光源的当前位置,获取平面图片的中心点与所述光源的当前位置之间的距离,获取所述平面图片的中心点与所述光源的当前位置的连线与坐标轴所形成的角度;The acquiring unit 510 is configured to acquire the current position of the light source in real time, acquire the distance between the center point of the plane picture and the current position of the light source, and acquire the distance between the center point of the plane picture and the current position of the light source and the angle formed by the coordinate axes;
确定单元520,用于根据当前获取到的所述距离、所述角度、以及偏移因子,确定所述平面图片当前的阴影的位置和投影图片,将所述投影图片在所述阴影的位置进行显示。The determining unit 520 is configured to determine a current shadow position and a projected picture of the planar picture according to the currently acquired distance, the angle, and an offset factor, and perform the projected picture at the position of the shadow. show.
进一步的,在三维坐标系中,所述获取单元510包括:Further, in the three-dimensional coordinate system, the acquisition unit 510 includes:
距离子单元511,用于获取平面图片的中心点以及光源的当前位置在投影平面的坐标,根据投影平面内所述坐标计算所述平面图片的中心点与所述光源的当前位置之间的距离;The distance subunit 511 is used to obtain the center point of the plane picture and the coordinates of the current position of the light source on the projection plane, and calculate the distance between the center point of the plane picture and the current position of the light source according to the coordinates in the projection plane ;
角度子单元512,用于根据平面图片的中心点以及光源的当前位置在投影平面的坐标,以及投影平面内所述平面图片的中心点与所述光源的当前位置之间的距离,确定所述平面图片的中心点与所述光源的当前位置在投影平面的连线与坐标轴所成的角度,以作为偏移角度。The angle subunit 512 is configured to determine the coordinates of the center point of the plane picture and the current position of the light source on the projection plane, and the distance between the center point of the plane picture and the current position of the light source in the projection plane. The angle formed by the line connecting the center point of the planar image and the current position of the light source on the projection plane and the coordinate axis is used as the offset angle.
进一步的,所述确定单元520包括:Further, the determining unit 520 includes:
第二获取子单元521,用于获取所述平面图片在三维坐标系的投影平面中的全等图形;The second acquiring subunit 521 is configured to acquire the congruent figure of the plane picture in the projection plane of the three-dimensional coordinate system;
缩放子单元522,用于分别对所述全等图形的宽度和高度进行缩放操作,以获取投影图片;A scaling subunit 522, configured to respectively perform scaling operations on the width and height of the congruent graphics to obtain a projected picture;
第二确定子单元523,用于实时根据所述光源的当前位置与平面图片的中心点的位置在投影平面内的距离以及预设的投影图片距离平面图片的高度,确定偏移因子;根据所述偏移因子、偏移角度确定所述平面图片当前阴影的位置。The second determining subunit 523 is used to determine the offset factor in real time according to the distance between the current position of the light source and the position of the center point of the planar picture in the projection plane and the preset height of the projected picture from the planar picture; The offset factor and offset angle determine the current shadow position of the planar picture.
进一步的,所述缩放子单元522具体用于:Further, the scaling subunit 522 is specifically used for:
根据平面图片的对角线的两个端点与所述光源的当前位置在投影平面的距离以及所述光源的当前位置分别与所述平面图片的对角线的两个端点的连线与坐标轴所成的角度,确定所述全等图形的外接矩形,确定所述外接矩形的宽度与所述平面图片的宽度的商,以作为所述全等图形的宽度的缩放因子;确定所述外接矩形的高度与所述平面图片的高度的商,以作为所述全等图形的高度的缩放因子。According to the distance between the two endpoints of the diagonal line of the plane picture and the current position of the light source on the projection plane, and the connection line and coordinate axis between the current position of the light source and the two end points of the diagonal line of the plane picture respectively The formed angle determines the circumscribed rectangle of the congruent figure, determines the quotient of the width of the circumscribed rectangle and the width of the plane picture, as the scaling factor of the width of the congruent figure; determines the circumscribed rectangle The quotient of the height of and the height of the plane picture is used as the scaling factor of the height of the congruent figure.
实时将所述全等图形的宽度和高度分别按照各自的缩放因子进行压缩或拉伸,以获得所述平面图片的投影图片。The width and height of the congruent figure are respectively compressed or stretched according to their respective scaling factors in real time, so as to obtain the projected picture of the planar picture.
进一步的,所述第二获取子单元521具体用于:Further, the second acquiring subunit 521 is specifically used for:
若所述平面图片是规则图形,则获取所述平面图片的外形尺寸,根据所述外形尺寸在三维坐标系的投影平面中生成一个与所述平面图片外形尺寸相同的全等图形;If the planar picture is a regular figure, then obtain the external dimensions of the planar picture, and generate a congruent figure with the same external dimensions as the planar picture in the projection plane of the three-dimensional coordinate system according to the external dimensions;
若所述平面图片是不规则图形,则获取所述平面图片的各个像素的透明度值,并将所述各个像素的颜色取值转换为该对应像素的透明度值,将转换操作后得到的灰度图以作为三维坐标系的投影平面中与所述平面图片外形尺寸相同的全等图形。If the plane picture is an irregular figure, then obtain the transparency value of each pixel of the plane picture, and convert the color value of each pixel into the transparency value of the corresponding pixel, and convert the grayscale obtained after the conversion operation The figure is used as a congruent figure in the projection plane of the three-dimensional coordinate system with the same external dimensions as the plane picture.
本实施例的技术方案,通过获取单元510获取投影图片相对于平面图片的偏移角度,再通过确定单元520获取投影图片相对于平面图片的偏移因子,根据所述偏移角度和偏移因子确定三维坐标系中平面图片当前阴影的位置,将按照缩放因子进行压缩或拉伸处理后的所述投影图片,在所述平面图片当前阴影的位置显示。在三维坐标系中,实现根据光源与平面图片的相对位置为平面图片实时生成动态的阴影的目的,解决现有技术中虚拟场景中阴影与现实场景的阴影不一致的问题,能使虚拟场景更加逼真。In the technical solution of this embodiment, the acquisition unit 510 is used to obtain the offset angle of the projection picture relative to the plane picture, and then the determination unit 520 is used to obtain the offset factor of the projection picture relative to the plane picture, according to the offset angle and the offset factor Determine the position of the current shadow of the planar picture in the three-dimensional coordinate system, and display the projected picture compressed or stretched according to the scaling factor at the position of the current shadow of the planar picture. In the three-dimensional coordinate system, realize the purpose of generating real-time dynamic shadows for the plane picture according to the relative position of the light source and the plane picture, solve the problem of inconsistency between the shadow in the virtual scene and the shadow of the real scene in the prior art, and make the virtual scene more realistic .
本实施例提供的为平面图片设置动态阴影的装置可执行本发明实施例三所提供的为平面图片设置动态阴影的方法,具备执行方法相应的功能模块和有益效果。The device for setting dynamic shadows for plane pictures provided in this embodiment can execute the method for setting dynamic shadows for plane pictures provided in Embodiment 3 of the present invention, and has corresponding functional modules and beneficial effects for executing the method.
以上实施例提供的技术方案中的全部或部分内容可以通过软件编程实现,其软件程序存储在可读取的存储介质中,存储介质例如:计算机中的硬盘、光盘或软盘。All or part of the technical solutions provided by the above embodiments can be realized by software programming, and the software program is stored in a readable storage medium, such as a hard disk, an optical disk or a floppy disk in a computer.
注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。Note that the above are only preferred embodiments of the present invention and applied technical principles. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and can also include more other equivalent embodiments without departing from the concept of the present invention, and the present invention The scope is determined by the scope of the appended claims.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510263281.4ACN104933746B (en) | 2015-05-21 | 2015-05-21 | A kind of method and device that dynamic shadow is set for plane picture |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510263281.4ACN104933746B (en) | 2015-05-21 | 2015-05-21 | A kind of method and device that dynamic shadow is set for plane picture |
| Publication Number | Publication Date |
|---|---|
| CN104933746A CN104933746A (en) | 2015-09-23 |
| CN104933746Btrue CN104933746B (en) | 2018-03-23 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201510263281.4AExpired - Fee RelatedCN104933746B (en) | 2015-05-21 | 2015-05-21 | A kind of method and device that dynamic shadow is set for plane picture |
| Country | Link |
|---|---|
| CN (1) | CN104933746B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106846455B (en)* | 2017-01-10 | 2020-12-15 | 努比亚技术有限公司 | Dynamic shadow processing terminal and method |
| CN108320320B (en)* | 2018-01-25 | 2021-04-20 | 重庆爱奇艺智能科技有限公司 | Information display method, device and equipment |
| CN109447925B (en)* | 2018-09-28 | 2021-07-09 | Oppo广东移动通信有限公司 | Image processing method and device, storage medium, electronic device |
| CN115015960A (en)* | 2021-03-04 | 2022-09-06 | 深圳市光鉴科技有限公司 | Offset depth camera and electronic equipment |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1243977A (en)* | 1998-03-20 | 2000-02-09 | 皇家菲利浦电子有限公司 | Electronic unit including screen and method for displaying image |
| US7439975B2 (en)* | 2001-09-27 | 2008-10-21 | International Business Machines Corporation | Method and system for producing dynamically determined drop shadows in a three-dimensional graphical user interface |
| US7764286B1 (en)* | 2006-11-01 | 2010-07-27 | Adobe Systems Incorporated | Creating shadow effects in a two-dimensional imaging space |
| CN102396003A (en)* | 2009-04-17 | 2012-03-28 | 设计代码公司 | Method for adding shadows to objects in computer graphics |
| CN103198516A (en)* | 2011-11-29 | 2013-07-10 | 苹果公司 | Dynamic Graphical Interface Shadow |
| CN104123743A (en)* | 2014-06-23 | 2014-10-29 | 联想(北京)有限公司 | Image shadow adding method and device |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8896600B2 (en)* | 2011-03-24 | 2014-11-25 | Qualcomm Incorporated | Icon shading based upon light intensity and location |
| US20120242664A1 (en)* | 2011-03-25 | 2012-09-27 | Microsoft Corporation | Accelerometer-based lighting and effects for mobile devices |
| US9552147B2 (en)* | 2012-02-01 | 2017-01-24 | Facebook, Inc. | Hierarchical user interface |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1243977A (en)* | 1998-03-20 | 2000-02-09 | 皇家菲利浦电子有限公司 | Electronic unit including screen and method for displaying image |
| US7439975B2 (en)* | 2001-09-27 | 2008-10-21 | International Business Machines Corporation | Method and system for producing dynamically determined drop shadows in a three-dimensional graphical user interface |
| US7764286B1 (en)* | 2006-11-01 | 2010-07-27 | Adobe Systems Incorporated | Creating shadow effects in a two-dimensional imaging space |
| CN102396003A (en)* | 2009-04-17 | 2012-03-28 | 设计代码公司 | Method for adding shadows to objects in computer graphics |
| CN103198516A (en)* | 2011-11-29 | 2013-07-10 | 苹果公司 | Dynamic Graphical Interface Shadow |
| CN104123743A (en)* | 2014-06-23 | 2014-10-29 | 联想(北京)有限公司 | Image shadow adding method and device |
| Title |
|---|
| 实时动态阴影算法的实现及在TGE中的应用;高丽娜等;《现代电子技术》;20100615(第12期);第107-110页* |
| Publication number | Publication date |
|---|---|
| CN104933746A (en) | 2015-09-23 |
| Publication | Publication Date | Title |
|---|---|---|
| CN104268922B (en) | A kind of image rendering method and image rendering device | |
| US10679408B2 (en) | Generating a three-dimensional model from a scanned object | |
| US9652880B2 (en) | 2D animation from a 3D mesh | |
| JP5299173B2 (en) | Image processing apparatus, image processing method, and program | |
| CN105262958B (en) | A kind of the panorama feature splicing system and its method of virtual view | |
| CN107341846B (en) | Method and device for displaying large-scale three-dimensional reconstruction scene in real time | |
| CN111325824A (en) | Image data display method and device, electronic equipment and storage medium | |
| CN104933746B (en) | A kind of method and device that dynamic shadow is set for plane picture | |
| CN112184873B (en) | Fractal graph creation method, fractal graph creation device, electronic equipment and storage medium | |
| RU2680355C1 (en) | Method and system of removing invisible surfaces of a three-dimensional scene | |
| JP2012190428A (en) | Stereoscopic image visual effect processing method | |
| CN108804061A (en) | The virtual scene display method of virtual reality system | |
| US20170064284A1 (en) | Producing three-dimensional representation based on images of a person | |
| TWI502546B (en) | System, method, and computer program product for extruding a model through a two-dimensional scene | |
| CN102819855A (en) | Method and device for generating two-dimensional images | |
| CN104902201B (en) | Based on moving view point with abnormity screen projection as real-time correction method | |
| CN113643414A (en) | Three-dimensional image generation method and device, electronic equipment and storage medium | |
| CN103096102B (en) | Image deformation method | |
| CN117036444A (en) | Three-dimensional model output method, device, equipment and computer readable storage medium | |
| CN111462205B (en) | Image data deformation, live broadcast method and device, electronic equipment and storage medium | |
| CN116167911A (en) | Model training method, 3D scene reconstruction method and device | |
| WO2019042028A1 (en) | All-around spherical light field rendering method | |
| CN103617650A (en) | Displaying method for complex three-dimensional terrain | |
| JP2017059041A (en) | Image processing apparatus, image processing method, and program | |
| JP2004199301A (en) | Image processor |
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CP01 | Change in the name or title of a patent holder | ||
| CP01 | Change in the name or title of a patent holder | Address after:Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18 Patentee after:GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd. Address before:Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18 Patentee before:GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd. | |
| CF01 | Termination of patent right due to non-payment of annual fee | ||
| CF01 | Termination of patent right due to non-payment of annual fee | Granted publication date:20180323 |