[go: up one dir, main page]

CN112184878B - Method, device and equipment for automatic generation and rendering of 3D night scene lights - Google Patents

Method, device and equipment for automatic generation and rendering of 3D night scene lights Download PDF

Info

Publication number
CN112184878B
CN112184878B CN202011103870.3A CN202011103870A CN112184878B CN 112184878 B CN112184878 B CN 112184878B CN 202011103870 A CN202011103870 A CN 202011103870A CN 112184878 B CN112184878 B CN 112184878B
Authority
CN
China
Prior art keywords
rendering
coverage area
array
light
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011103870.3A
Other languages
Chinese (zh)
Other versions
CN112184878A (en
Inventor
丁伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongzhi Software Co.,Ltd.
Original Assignee
Luoyang Zhongzhi Software Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Luoyang Zhongzhi Software Technology Co ltd filed Critical Luoyang Zhongzhi Software Technology Co ltd
Priority to CN202011103870.3A priority Critical patent/CN112184878B/en
Publication of CN112184878A publication Critical patent/CN112184878A/en
Application granted granted Critical
Publication of CN112184878B publication Critical patent/CN112184878B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/506Illumination models
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02BCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO BUILDINGS, e.g. HOUSING, HOUSE APPLIANCES OR RELATED END-USER APPLICATIONS
    • Y02B20/00Energy efficient lighting technologies, e.g. halogen lamps or gas discharge lamps
    • Y02B20/40Control techniques providing energy savings, e.g. smart controller or presence detection

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The application relates to a method, a device and equipment for automatically generating and rendering three-dimensional night scene lamplight, which are characterized in that a projection area of a rendering scene on a preset plane is obtained, a pre-built array is added in the projection area, a current coverage area of a camera window with the same shape as an array block in the array is detected, lamplight particles are distributed in the current coverage area according to a preset rule, lamplight rendering is carried out on the current rendering scene corresponding to the current coverage area, along with the movement of the camera window, the movement coverage area of the camera window in the array is determined, the lamplight particles in the current coverage area are transferred to a position corresponding to the coordinates of the array block of the movement coverage area, and lamplight rendering is carried out on the movement rendering scene corresponding to the movement coverage area, so that each lamplight particle is always distributed in the camera window according to the same coordinates, the regional effect overview is realized, the quantity of lamplight particles required to be rendered is reduced, and the running speed and the drawing efficiency are further effectively improved.

Description

三维夜景灯光自动生成和渲染的方法、装置和设备Method, device and equipment for automatic generation and rendering of 3D night scene lights

技术领域technical field

本发明涉及灯光渲染技术领域,具体涉及一种三维夜景灯光自动生成和渲染的方法、装置和设备。The invention relates to the technical field of lighting rendering, in particular to a method, device and equipment for automatically generating and rendering three-dimensional night scene lighting.

背景技术Background technique

灯光有助于表达情感,能够引导观众的眼睛到特定的位置,还可以为场景提供更大的深度,展现丰富的层次,使模型更加立体美观,灯光的运用已经成为一大流行趋势。Lighting helps express emotions, guides the audience's eyes to a specific location, and can also provide greater depth to the scene, show rich layers, and make the model more three-dimensional and beautiful. The use of lighting has become a popular trend.

目前,常用的灯光渲染方式有以下几种:第一,高级全局照明渲染器和全局照明渲染器,主要依据“光线跟踪”(ray trace)在模型表面之间追踪射线,射线不断被某些对象表面反射到其他对象表面,直到从场景中消失。第二,辐射度渲染法,通过集成缓存辐照度计算,反射能量在场景中不断反弹,能量逐级减弱。根据几何形状、能源、地理位置、日期或材料研究灯光效果,或粒子系统作为光源。第三,Lumaobject效果,Lumaobject使自发光物体作为光源,并可控制光线衰减在某种程度上实现了辐射度的效果,以白炽灯、立体光源和特殊材料属性的形式提供灯光效果。第四,多边形着色聚光灯uv大师,通过BPR渲染功能,利用全景图作为背景贴合模型,在渲染时作为环境的照明和着色。At present, the commonly used light rendering methods are as follows: first, advanced global illumination renderer and global illumination renderer, mainly based on "ray tracing" (ray trace) to trace rays between the surface of the model, the rays are constantly being drawn by some objects The surface reflects off other object surfaces until it disappears from the scene. Second, the radiosity rendering method, through the integrated cache irradiance calculation, the reflected energy bounces continuously in the scene, and the energy gradually weakens. Investigate light effects based on geometry, energy source, geographic location, date or material, or particle systems as light sources. Third, Lumaobject effect, Lumaobject makes self-illuminating objects as light sources, and can control light attenuation to achieve the effect of radiance to a certain extent, providing lighting effects in the form of incandescent lamps, three-dimensional light sources and special material properties. Fourth, Polygon Coloring Spotlight UV Master, through the BPR rendering function, uses the panorama as the background to fit the model, and serves as the lighting and coloring of the environment during rendering.

但是,现有技术中的灯光渲染方法均不能实现大面积灯光的一键插入,只能逐个放置,不能形成区域性的效果概览,且灯光过多时运行速度慢,影响作图效率。However, none of the lighting rendering methods in the prior art can realize one-click insertion of large-area lights, and can only be placed one by one, which cannot form a regional overview of effects. Moreover, when there are too many lights, the running speed is slow, which affects the drawing efficiency.

发明内容Contents of the invention

有鉴于此,本发明的目的在于提供一种三维夜景灯光自动生成和渲染的方法、装置和设备,以克服目前灯光渲染方法均不能实现大面积灯光的一键插入,只能逐个放置,不能形成区域性的效果概览,且灯光过多时运行速度慢,影响作图效率的问题。In view of this, the object of the present invention is to provide a method, device and equipment for automatic generation and rendering of 3D night scene lights, so as to overcome the fact that the current lighting rendering methods cannot realize one-key insertion of large-area lights, which can only be placed one by one and cannot be formed. An overview of regional effects, and the running speed is slow when there are too many lights, which affects the efficiency of drawing.

为实现以上目的,本发明采用如下技术方案:To achieve the above object, the present invention adopts the following technical solutions:

一种三维夜景灯光自动生成和渲染的方法,包括:A method for automatically generating and rendering 3D night scene lights, comprising:

获取渲染场景的预设面作为投影区域;Obtain the preset surface of the rendered scene as the projection area;

在所述投影区域中添加预先构建的阵列;其中,所述阵列的每个阵列区块均设置有相同的坐标系;Adding a pre-built array in the projection area; wherein, each array block of the array is provided with the same coordinate system;

检测形状、大小均与任一所述阵列区块相同的相机视窗在所述阵列中的当前覆盖区域;Detecting the current coverage area of the camera window in the array whose shape and size are the same as any of the array blocks;

将灯光粒子按照预设规律分布在所述当前覆盖区域中,对所述当前覆盖区域对应的当前渲染场景进行灯光渲染;Distributing light particles in the current coverage area according to preset rules, and performing light rendering on the current rendering scene corresponding to the current coverage area;

随着所述相机视窗的移动,确定所述相机视窗在所述阵列中的移动覆盖区域;determining a moving coverage area of the camera window in the array as the camera window moves;

将所述当前覆盖区域中的所述灯光粒子转移到所述移动覆盖区域的所述阵列区块坐标对应的位置处,对所述移动覆盖区域对应的移动渲染场景进行灯光渲染;Transfer the light particles in the current coverage area to the position corresponding to the array block coordinates of the mobile coverage area, and perform light rendering on the mobile rendering scene corresponding to the mobile coverage area;

将所述移动覆盖区域作为所述相机视窗下一次移动时的所述当前覆盖区域,以使每个所述灯光粒子始终按照同一坐标分布在所述相机视窗内。The moving coverage area is used as the current coverage area when the camera window moves next time, so that each light particle is always distributed in the camera window according to the same coordinates.

进一步地,以上所述的三维夜景灯光自动生成和渲染的方法,每个所述阵列区块包括相同的子阵列,所述子阵列中的子阵列区块的数量与所述灯光粒子的数量相同;Further, in the above-mentioned method for automatically generating and rendering three-dimensional night scene lights, each of the array blocks includes the same sub-array, and the number of sub-array blocks in the sub-array is the same as the number of light particles ;

所述将灯光粒子按照预设规律分布在所述当前覆盖区域中,包括:The distributing light particles in the current coverage area according to preset rules includes:

确定所述子阵列区块中,所述当前覆盖区域覆盖的目标子阵列区块;determining a target sub-array block covered by the current coverage area among the sub-array blocks;

在每个所述目标子阵列区块的任意位置均放置一个所述灯光粒子。One light particle is placed at any position of each target sub-array block.

进一步地,以上所述的三维夜景灯光自动生成和渲染的方法,所述阵列区块和所述子阵列区块均为彼此相接的正方形区块;Further, in the above-mentioned method for automatically generating and rendering three-dimensional night scene lights, the array blocks and the sub-array blocks are square blocks connected to each other;

所述在每个所述目标子阵列区块的任意位置均放置一个所述灯光粒子之前,还包括:Before placing one light particle at any position of each target sub-array block, the method further includes:

在0到N1之间随机设置每个所述灯光粒子的光照范围半径;其中,N1为所述子阵列区块的边长。The radius of the illumination range of each light particle is randomly set between 0 and N1; wherein, N1 is the side length of the sub-array block.

进一步地,以上所述的三维夜景灯光自动生成和渲染的方法,所述将所述当前覆盖区域中的所述灯光粒子转移到所述移动覆盖区域的所述阵列区块坐标对应的位置处,包括:Further, in the above-mentioned method for automatically generating and rendering 3D night scene lights, the said light particles in the current coverage area are transferred to the positions corresponding to the array block coordinates of the mobile coverage area, include:

按照如下公式确定所述灯光粒子的偏移值:Determine the offset value of the light particles according to the following formula:

vOffset=(vCell+floor(uCameraPositionMod+0.5-vCell)-uCameraPositionMod)×N2;vOffset=(vCell+floor(uCameraPositionMod+0.5-vCell)-uCameraPositionMod)×N2;

其中,vOffset为所述偏移值,vCell为所述当前覆盖区域中的任一所述灯光粒子的坐标(i,j),uCameraPositionMod为mod(CameraPosition,N2),N2为所述阵列区块的边长,CameraPosition为相机位置;Wherein, vOffset is the offset value, vCell is the coordinate (i, j) of any light particle in the current coverage area, uCameraPositionMod is mod(CameraPosition, N2), and N2 is the position of the array block Side length, CameraPosition is the camera position;

按照所述偏移值转移所述灯光粒子。Shifts the light particles by the offset value.

进一步地,以上所述的三维夜景灯光自动生成和渲染的方法,所述对所述当前覆盖区域对应的当前渲染场景进行灯光渲染,包括:Further, in the method for automatically generating and rendering 3D night scene lights described above, performing light rendering on the current rendering scene corresponding to the current coverage area includes:

确定所述当前渲染场景中所述灯光粒子的高度属性、色温属性和光晕属性;Determine the height attribute, color temperature attribute and halo attribute of the light particles in the current rendering scene;

将所述高度属性、所述色温属性和所述光晕属性叠加到所述灯光粒子中,以对所述当前渲染场景进行灯光渲染。The height attribute, the color temperature attribute and the halo attribute are superimposed on the light particles, so as to perform light rendering on the current rendering scene.

进一步地,以上所述的三维夜景灯光自动生成和渲染的方法,所述对所述移动覆盖区域对应的移动渲染场景进行灯光渲染,包括:Further, in the above-mentioned method for automatically generating and rendering 3D night scene lights, performing light rendering on the mobile rendering scene corresponding to the mobile coverage area includes:

将所述高度属性、所述色温属性和所述光晕属性叠加到所述灯光粒子中,以对所述移动渲染场景进行灯光渲染。The height attribute, the color temperature attribute and the halo attribute are superimposed on the light particles to perform light rendering on the mobile rendering scene.

进一步地,以上所述的三维夜景灯光自动生成和渲染的方法,所述获取渲染场景的预设面作为投影区域,包括:Further, in the above-mentioned method for automatically generating and rendering 3D night scene lights, the acquisition of the preset surface of the rendering scene as the projection area includes:

获取所述渲染场景俯视面作为所述投影区域。Obtain the top view surface of the rendering scene as the projection area.

本发明还提供了一种三维夜景灯光自动生成和渲染的装置,包括:The present invention also provides a device for automatically generating and rendering three-dimensional night scene lights, including:

获取模块,用于获取渲染场景的预设面作为投影区域;An acquisition module, which is used to acquire the preset surface of the rendering scene as the projection area;

添加模块,用于在所述投影区域中添加预先构建的阵列;其中,所述阵列的每个阵列区块均设置有相同的坐标系;Adding module, for adding pre-built array in the projection area; wherein, each array block of the array is set with the same coordinate system;

检测模块,用于检测形状、大小均与任一所述阵列区块相同的相机视窗在所述阵列中的当前覆盖区域;A detection module, configured to detect the current coverage area of the camera window in the array whose shape and size are the same as any of the array blocks;

渲染模块,用于将灯光粒子按照预设规律分布在所述当前覆盖区域中,对所述当前覆盖区域对应的当前渲染场景进行灯光渲染;A rendering module, configured to distribute light particles in the current coverage area according to preset rules, and perform light rendering on the current rendering scene corresponding to the current coverage area;

确定模块,用于随着所述相机视窗的移动,确定所述相机视窗在所述阵列中的移动覆盖区域;A determining module, configured to determine a moving coverage area of the camera window in the array as the camera window moves;

所述渲染模块,还用于将所述当前覆盖区域中的所述灯光粒子转移到所述移动覆盖区域的所述阵列区块坐标对应的位置处,对所述移动覆盖区域对应的移动渲染场景进行灯光渲染;将所述移动覆盖区域作为所述相机视窗下一次移动时的所述当前覆盖区域,以使每个所述灯光粒子始终按照同一坐标分布在所述相机视窗内。The rendering module is further configured to transfer the light particles in the current coverage area to positions corresponding to the coordinates of the array block in the mobile coverage area, and render the mobile rendering scene corresponding to the mobile coverage area Perform light rendering; use the moving coverage area as the current coverage area when the camera window moves next time, so that each light particle is always distributed in the camera window according to the same coordinates.

进一步地,以上所述的三维夜景灯光自动生成和渲染的装置,每个所述阵列区块包括相同的子阵列,所述子阵列中的子阵列区块的数量与所述灯光粒子的数量相同;Further, in the above-mentioned device for automatically generating and rendering three-dimensional night scene lights, each of the array blocks includes the same sub-array, and the number of sub-array blocks in the sub-array is the same as the number of the light particles ;

所述渲染模块,具体用于确定所述子阵列区块中,所述当前覆盖区域覆盖的目标子阵列区块;在每个所述目标子阵列区块的任意位置均放置一个所述灯光粒子。The rendering module is specifically configured to determine the target sub-array blocks covered by the current coverage area in the sub-array blocks; place one light particle at any position of each target sub-array block .

本发明还提供了一种三维夜景灯光自动生成和渲染的设备,包括处理器和存储器,所述处理器与所述存储器相连:The present invention also provides a device for automatically generating and rendering three-dimensional night scene lights, including a processor and a memory, and the processor is connected to the memory:

其中,所述处理器,用于调用并执行所述存储器中存储的程序;Wherein, the processor is configured to call and execute the program stored in the memory;

所述存储器,用于存储所述程序,所述程序至少用于执行以上任一项所述的三维夜景灯光自动生成和渲染的方法。The memory is used to store the program, and the program is at least used to execute the method for automatic generation and rendering of three-dimensional night scene lights described in any one of the above.

本发明的三维夜景灯光自动生成和渲染的方法、装置和设备,通过获取渲染场景在预设平面上的投影区域,在投影区域中添加预先构建的阵列,其中,阵列的每个阵列区块均设置有相同的坐标系,检测与阵列区块形状相同的相机视窗在阵列中的当前覆盖区域,将灯光粒子按照预设规律分布在当前覆盖区域中,对当前覆盖区域对应的当前渲染场景进行灯光渲染,随着相机视窗的移动,确定相机视窗在阵列中的移动覆盖区域,将当前覆盖区域中的灯光粒子转移到移动覆盖区域的阵列区块的坐标对应的位置处,对移动覆盖区域对应的移动渲染场景进行灯光渲染,并且,将移动覆盖区域作为相机视窗下一次移动时的当前覆盖区域,以使每个灯光粒子始终按照同一坐标分布在相机视窗内,实现了区域性的效果概览,减小了需要渲染的灯光粒子数量,进而有效提高了运行速度和作图效率。The method, device and equipment for automatic generation and rendering of three-dimensional night scene lights of the present invention, by obtaining the projection area of the rendering scene on the preset plane, adding a pre-built array in the projection area, wherein each array block of the array is Set the same coordinate system, detect the current coverage area of the camera window in the array with the same shape as the array block, distribute the light particles in the current coverage area according to the preset rules, and light the current rendering scene corresponding to the current coverage area Rendering, with the movement of the camera window, determine the mobile coverage area of the camera window in the array, and transfer the light particles in the current coverage area to the position corresponding to the coordinates of the array block of the mobile coverage area. Move the rendering scene for light rendering, and use the mobile coverage area as the current coverage area when the camera window moves next time, so that each light particle is always distributed in the camera window according to the same coordinates, achieving a regional overview of the effect, reducing The number of light particles that need to be rendered is reduced, thereby effectively improving the running speed and drawing efficiency.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.

图1是本发明三维夜景灯光自动生成和渲染的方法一种实施例提供的流程图;Fig. 1 is a flow chart provided by an embodiment of the method for automatically generating and rendering three-dimensional night scene lights of the present invention;

图2是本发明三维夜景灯光自动生成和渲染的方法一种实施例提供的渲染场景示意图;Fig. 2 is a schematic diagram of a rendering scene provided by an embodiment of the method for automatically generating and rendering three-dimensional night scene lights of the present invention;

图3是本发明三维夜景灯光自动生成和渲染的方法一种实施例提供的阵列示意图;Fig. 3 is a schematic diagram of an array provided by an embodiment of the method for automatically generating and rendering three-dimensional night scene lights of the present invention;

图4是本发明三维夜景灯光自动生成和渲染的方法一种实施例提供的阵列区块示意图;Fig. 4 is a schematic diagram of an array block provided by an embodiment of the method for automatically generating and rendering three-dimensional night scene lights of the present invention;

图5是图2中区域S的灯光渲染效果示意图;FIG. 5 is a schematic diagram of the lighting rendering effect of area S in FIG. 2;

图6是本发明三维夜景灯光自动生成和渲染的装置一种实施例提供的结构示意图;Fig. 6 is a structural schematic diagram provided by an embodiment of the device for automatically generating and rendering three-dimensional night scene lights of the present invention;

图7是本发明三维夜景灯光自动生成和渲染的设备一种实施例提供的结构示意图。Fig. 7 is a schematic structural diagram provided by an embodiment of the device for automatically generating and rendering 3D night scene lights according to the present invention.

具体实施方式Detailed ways

为使本发明的目的、技术方案和优点更加清楚,下面将对本发明的技术方案进行详细地描述。显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所得到的所有其它实施方式,都属于本发明所保护的范围。In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described in detail below. Apparently, the described embodiments are only some of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other implementations obtained by persons of ordinary skill in the art without making creative efforts fall within the protection scope of the present invention.

图1是本发明三维夜景灯光自动生成和渲染的方法一种实施例提供的流程图。请参阅图1,本实施例可以包括以下步骤:Fig. 1 is a flow chart provided by an embodiment of the method for automatically generating and rendering 3D night scene lights in the present invention. Referring to Figure 1, this embodiment may include the following steps:

S101、获取渲染场景的预设面作为投影区域。S101. Obtain a preset surface of a rendering scene as a projection area.

本实施例中,可以获取渲染场景在预设平面上的投影区域。在一种具体的实施方式中,预设面为渲染场景的俯视面。即,获取渲染场景的俯视面作为投影区域。In this embodiment, the projection area of the rendered scene on the preset plane may be obtained. In a specific implementation manner, the preset surface is a top view surface of the rendering scene. That is, the top view plane of the rendered scene is obtained as the projection area.

图2是本发明三维夜景灯光自动生成和渲染的方法一种实施例提供的渲染场景示意图。在一种具体的实施例中,渲染场景包括若干座高度不同的房屋,如图2所示。本实施例中,获取图2中渲染场景的俯视图作为投影区域。Fig. 2 is a schematic diagram of a rendering scene provided by an embodiment of the method for automatically generating and rendering 3D night scene lights according to the present invention. In a specific embodiment, the rendering scene includes several houses with different heights, as shown in FIG. 2 . In this embodiment, the top view of the rendered scene in FIG. 2 is obtained as the projection area.

S102、在投影区域中添加预先构建的阵列。S102. Add a pre-built array in the projection area.

本实施例中预先构建用于渲染灯光的阵列,阵列包含若干个阵列区块,每个阵列中均设置有相同的坐标系。图3是本发明三维夜景灯光自动生成和渲染的方法一种实施例提供的阵列示意图。如图3所示,若某一阵列中存在坐标(i,j),i≥0,j>0。在剩余的其他所有阵列中,均能在相同的位置找到相同的坐标(i,j)。In this embodiment, an array for rendering lights is pre-constructed, and the array includes several array blocks, and the same coordinate system is set in each array. Fig. 3 is a schematic diagram of an array provided by an embodiment of the method for automatically generating and rendering 3D night scene lights according to the present invention. As shown in FIG. 3 , if coordinates (i, j) exist in a certain array, i≥0, j>0. In all other remaining arrays, the same coordinate (i,j) can be found at the same location.

S103、检测形状、大小均与任一阵列区块相同的相机视窗在阵列中的当前覆盖区域。S103. Detect the current coverage area of the camera window in the array whose shape and size are the same as any array block.

相机视窗所覆盖的区域对应的渲染场景为用户能够通过显示屏看到的区域。在一种具体的实施方式中,用户能够通过移动鼠标或者其他控制设备控制相机视窗移动,进而移动相机视窗所覆盖的区域对应的渲染场景,以浏览渲染场景的不同部分。The rendering scene corresponding to the area covered by the camera window is the area that the user can see through the display screen. In a specific implementation manner, the user can control the movement of the camera window by moving the mouse or other control devices, and then move the rendered scene corresponding to the area covered by the camera window to browse different parts of the rendered scene.

其中,相机视窗的大小和形状与任一阵列区块相同。如此一来,相机视窗无论处在阵列中的哪一位置,相机视窗在阵列中覆盖的区域都会包括一个完整的阵列区块坐标系包含的所有坐标。Wherein, the size and shape of the camera window are the same as any array block. In this way, no matter where the camera window is in the array, the area covered by the camera window in the array will include all the coordinates contained in a complete array block coordinate system.

具体地,如图3所示,若相机视窗处于位置A,与其中一个阵列区块对齐,那么相机视窗的覆盖区域包含该阵列区块坐标系的所有坐标。若相机视窗处于位置B,相机视窗所覆盖的区域b11和相机视窗未覆盖的区域b12的坐标对应相同,相机视窗所覆盖的区域b21与相机视窗未覆盖的区域b22的坐标对应相同。如此一来,b12、b22和b3组成了一完整的阵列区块坐标系包含的所有坐标。因此,无论相机视窗如何移动,相机视窗在阵列中覆盖的区域都会包括一个完整的阵列区块坐标系包含的所有坐标,即,都会包括(i,j)这一坐标。Specifically, as shown in FIG. 3 , if the camera window is at position A and aligned with one of the array blocks, then the coverage area of the camera window includes all the coordinates of the array block coordinate system. If the camera window is at position B, the coordinates of the area b11 covered by the camera window and the area b12 not covered by the camera window are the same, and the coordinates of the area b21 covered by the camera window are corresponding to the area b22 not covered by the camera window. In this way, b12, b22 and b3 form a complete array of all coordinates contained in the block coordinate system. Therefore, no matter how the camera window moves, the area covered by the camera window in the array will include all the coordinates contained in a complete array block coordinate system, that is, the coordinate (i, j) will be included.

本实施例中,在投影区域中添加预先构建的阵列后,则需要检测相机视窗初始位置,以及初始位置对应的当前覆盖区域。In this embodiment, after adding the pre-built array in the projection area, it is necessary to detect the initial position of the camera window and the current coverage area corresponding to the initial position.

S104、将灯光粒子按照预设规律分布在当前覆盖区域中,对当前覆盖区域对应的当前渲染场景进行灯光渲染。S104. Distribute light particles in the current coverage area according to a preset rule, and perform light rendering on the current rendering scene corresponding to the current coverage area.

本实施例中,每个阵列区块包括相同的子阵列,子阵列中的子阵列区块的数量与灯光粒子的数量相同。确定相机视窗的当前覆盖区域后,可以按照如下步骤将灯光粒子按照预设规律分布在当前覆盖区域中。In this embodiment, each array block includes the same sub-array, and the number of sub-array blocks in the sub-array is the same as the number of light particles. After determining the current coverage area of the camera window, the light particles can be distributed in the current coverage area according to the preset rules according to the following steps.

步骤一:确定子阵列区块中,当前覆盖区域覆盖的目标子阵列区块。Step 1: Determine the target sub-array block covered by the current coverage area among the sub-array blocks.

步骤二:在每个目标子阵列区块的任意位置均放置一个灯光粒子。Step 2: Place a light particle anywhere in each target subarray block.

图4是本发明三维夜景灯光自动生成和渲染的方法一种实施例提供的阵列区块示意图。在一种具体的实施方式中,当前覆盖区域覆盖的目标子阵列区块如图4中的阴影区域C所示,为了提高场景照明复杂度和视觉冲击力,在图4所示的当前覆盖区域覆盖的每个目标子阵列区块中放置一个灯光粒子L。Fig. 4 is a schematic diagram of an array block provided by an embodiment of the method for automatically generating and rendering 3D night scene lights in the present invention. In a specific implementation manner, the target sub-array block covered by the current coverage area is shown in the shaded area C in Figure 4. In order to improve the scene lighting complexity and visual impact, the current coverage area shown in Figure 4 A light particle L is placed in each covered target subarray block.

由于光照渲染的复杂度和每个像素所接受的灯光数量直接相关,本实施例中为了限制整个场景光照计算的复杂度,将阵列区块和子阵列区块均设置为彼此相接的正方形区块,如图3和图4所示。并且,在上述步骤二之前,还可以包括如下步骤:Since the complexity of lighting rendering is directly related to the number of lights received by each pixel, in this embodiment, in order to limit the complexity of lighting calculations for the entire scene, both the array block and the sub-array block are set as square blocks connected to each other , as shown in Figure 3 and Figure 4. And, before the above step two, the following steps may also be included:

在0到N1之间随机设置每个灯光粒子的光照范围半径;其中,N1为子阵列区块的边长。具体地,每个灯光粒子的光照范围半径在子阵列区块的边长以内,那么每个灯光粒子影响范围为其所在的子阵列区块和它相邻的8个子阵列区块。这样,每个子阵列区块最多将会受到自身以及相邻8个子阵列区块中的共9个灯光粒子影响,有效减少了光照计算的复杂度。Randomly set the radius of the illumination range of each light particle between 0 and N1; where N1 is the side length of the subarray block. Specifically, if the radius of the illumination range of each light particle is within the side length of the sub-array block, then the influence range of each light particle is the sub-array block where it is located and its 8 adjacent sub-array blocks. In this way, each sub-array block will be affected by a total of 9 light particles in itself and 8 adjacent sub-array blocks at most, which effectively reduces the complexity of lighting calculations.

如图4所示,其中虚线框的灯光粒子L1代表了一种极限情况,即虚线框的灯光粒子的位置恰好随机到了所在子阵列区块的角点上,影响半径恰好随机为N1。此时,该灯光粒子的影响范围并没有超出它所在的子阵列区块及周边的子阵列区块,因此在此策略下可以任意随机而不会出现越界现象,同时又能够极大地提高灯光复杂度。As shown in Figure 4, the light particle L1 in the dotted line box represents a limit case, that is, the position of the light particle in the dotted line box happens to be at the corner of the sub-array block at random, and the influence radius is exactly N1 at random. At this time, the influence range of the light particle does not exceed the sub-array block where it is located and the surrounding sub-array blocks. Therefore, under this strategy, it can be randomly randomized without cross-border phenomenon, and at the same time, it can greatly improve the lighting complexity. Spend.

本步骤中,还可以确定当前渲染场景中灯光粒子的高度属性、色温属性和光晕属性。将高度属性、色温属性和光晕属性叠加到灯光粒子中,以对当前渲染场景进行灯光渲染。其中高度属性可以根据当前渲染场景中的高度信息确定,光晕属性和色温属性可以根据灯光粒子的位置确定。In this step, the height attribute, color temperature attribute and halo attribute of the light particles in the current rendering scene can also be determined. Overlay the height attribute, color temperature attribute and halo attribute to the light particles to perform light rendering on the current rendering scene. Among them, the height attribute can be determined according to the height information in the current rendering scene, and the halo attribute and color temperature attribute can be determined according to the position of the light particles.

图5是图2中区域S的灯光渲染效果示意图。在一种具体的实施方式中,图1中区域S的俯视图对应图4中的当前覆盖区域,并按照图4所示的灯光粒子分布情况和预设的高度属性、光晕属性和色温属性对区域S进行渲染,即可得到如图5所示的渲染图,即用户通过显示屏看到的相机视窗对应的渲染图。FIG. 5 is a schematic diagram of lighting rendering effects in area S in FIG. 2 . In a specific implementation, the top view of area S in FIG. 1 corresponds to the current coverage area in FIG. 4 , and according to the distribution of light particles shown in FIG. The area S is rendered, and the rendered image shown in FIG. 5 can be obtained, that is, the rendered image corresponding to the camera window seen by the user through the display screen.

S105、随着相机视窗的移动,确定相机视窗在阵列中的移动覆盖区域。S105. As the camera window moves, determine a moving coverage area of the camera window in the array.

用户若需要查看其它区域的灯光效果,需要移动鼠标或者其他控制设备,以切换相机视窗的覆盖范围。本实施例中,随着相机视窗的不断移动,确定相机视窗在阵列中的移动覆盖区域。If the user needs to view the lighting effects in other areas, he needs to move the mouse or other control devices to switch the coverage of the camera window. In this embodiment, as the camera window moves continuously, the moving coverage area of the camera window in the array is determined.

S106、将当前覆盖区域中的灯光粒子转移到移动覆盖区域的阵列区块的坐标对应的位置处,对移动覆盖区域对应的移动渲染场景进行灯光渲染。S106. Transfer the light particles in the current coverage area to the position corresponding to the coordinates of the array block in the mobile coverage area, and perform light rendering on the mobile rendering scene corresponding to the mobile coverage area.

通过上述分析,可以明确得到如下结论:Through the above analysis, the following conclusions can be clearly drawn:

相机视窗无论处在阵列中的哪一位置,相机视窗在阵列中覆盖的区域都会包括一个完整的阵列区块坐标系包含的所有坐标。No matter where the camera window is in the array, the area covered by the camera window in the array will include all the coordinates contained in a complete array block coordinate system.

那么,可以将当前覆盖区域中灯光粒子按照坐标的对应关系转移到移动覆盖区域的阵列区块的坐标对应的位置处,以使用户在移动相机视窗的过程中感觉不到灯光粒子的移动,同时有效提高渲染效率。Then, the light particles in the current coverage area can be transferred to the position corresponding to the coordinates of the array block in the mobile coverage area according to the corresponding relationship of coordinates, so that the user cannot feel the movement of the light particles during the process of moving the camera window, and at the same time Effectively improve rendering efficiency.

具体地,按照如下公式确定灯光粒子的偏移值,按照偏移值转移灯光粒子即可。Specifically, the offset value of the light particles is determined according to the following formula, and the light particles can be transferred according to the offset value.

公式为:vOffset=(vCell+floor(uCameraPositionMod+0.5-vCell)-uCameraPositionMod)×N2;The formula is: vOffset=(vCell+floor(uCameraPositionMod+0.5-vCell)-uCameraPositionMod)×N2;

其中,vOffset为偏移值,vCell为当前覆盖区域中的任一灯光粒子的坐标(i,j),uCameraPositionMod为mod(CameraPosition,N2),N2为阵列区块的边长,CameraPosition为相机视窗对应的相机位置。Among them, vOffset is the offset value, vCell is the coordinate (i,j) of any light particle in the current coverage area, uCameraPositionMod is mod(CameraPosition,N2), N2 is the side length of the array block, and CameraPosition is the corresponding camera window camera position.

若每一个阵列区块包含数量为a×a的子阵列区块,则有:If each array block contains sub-array blocks whose number is a×a, then:

N2=N1×aN2=N1×a

需要说明的是,将移动覆盖区域作为相机视窗下一次移动时的当前覆盖区域,以使每个灯光粒子始终按照同一坐标分布在相机视窗内,用户始终感觉不到灯光粒子的移动,不会影响用户的使用体验效果。It should be noted that the moving coverage area is used as the current coverage area when the camera window moves next time, so that each light particle is always distributed in the camera window according to the same coordinates, and the user will never feel the movement of the light particles and will not affect User experience effect.

此外,在一种具体的实时方式中,若相机视窗未发生移动,本实施例同样会重新确定相机视窗视窗在阵列中的覆盖区域,以重复对覆盖区域进行灯光粒子的计算和灯光渲染。相对于数据的重复保存和读取,重复的计算能够进一步提高灯光的渲染速度。In addition, in a specific real-time manner, if the camera window does not move, this embodiment will also re-determine the coverage area of the camera window in the array, so as to repeatedly perform light particle calculation and light rendering on the coverage area. Compared with repeated saving and reading of data, repeated calculations can further improve the rendering speed of lights.

本实施例的三维夜景灯光自动生成和渲染的方法,通过获取渲染场景在预设平面上的投影区域,在投影区域中添加预先构建的阵列,其中,阵列的每个阵列区块均设置有相同的坐标系,检测与阵列区块形状相同的相机视窗在阵列中的当前覆盖区域,将灯光粒子按照预设规律分布在当前覆盖区域中,对当前覆盖区域对应的当前渲染场景进行灯光渲染,随着相机视窗的移动,确定相机视窗在阵列中的移动覆盖区域,将当前覆盖区域中的灯光粒子转移到移动覆盖区域的阵列区块的坐标对应的位置处,对移动覆盖区域对应的移动渲染场景进行灯光渲染,并且,将移动覆盖区域作为相机视窗下一次移动时的当前覆盖区域,以使每个灯光粒子始终按照同一坐标分布在相机视窗内,实现了区域性的效果概览,减小了需要渲染的灯光粒子数量,进而有效提高了运行速度和作图效率。The method for automatically generating and rendering three-dimensional night scene lights in this embodiment obtains the projection area of the rendering scene on a preset plane, and adds a pre-built array in the projection area, wherein each array block of the array is set with the same coordinate system, detect the current coverage area of the camera window in the array with the same shape as the array block, distribute the light particles in the current coverage area according to the preset rules, perform light rendering on the current rendering scene corresponding to the current coverage area, and then With the movement of the camera window, determine the mobile coverage area of the camera window in the array, transfer the light particles in the current coverage area to the position corresponding to the coordinates of the array block in the mobile coverage area, and render the scene corresponding to the mobile coverage area Perform lighting rendering, and use the mobile coverage area as the current coverage area when the camera window moves next time, so that each light particle is always distributed in the camera window according to the same coordinates, achieving a regional effect overview and reducing the need for The number of light particles rendered can effectively improve the running speed and drawing efficiency.

本发明还提供了一种三维夜景灯光自动生成和渲染的装置,用于实现上述方法实施例。图6是本发明三维夜景灯光自动生成和渲染的装置一种实施例提供的结构示意图。如图6所示,本实施例的装置,包括:The present invention also provides a device for automatically generating and rendering three-dimensional night scene lights, which is used to realize the above-mentioned method embodiments. Fig. 6 is a schematic structural diagram provided by an embodiment of the device for automatically generating and rendering 3D night scene lights according to the present invention. As shown in Figure 6, the device of this embodiment includes:

获取模块11,用于获取渲染场景的预设面作为投影区域;An acquisition module 11, configured to acquire a preset surface of a rendering scene as a projection area;

添加模块12,用于在投影区域中添加预先构建的阵列;其中,阵列的每个阵列区块均设置有相同的坐标系;The adding module 12 is used to add a pre-built array in the projection area; wherein, each array block of the array is provided with the same coordinate system;

检测模块13,用于检测形状、大小均与任一阵列区块相同的相机视窗在阵列中的当前覆盖区域;The detection module 13 is used to detect the current coverage area of the camera window in the array whose shape and size are the same as any array block;

渲染模块14,用于将灯光粒子按照预设规律分布在当前覆盖区域中,对当前覆盖区域对应的当前渲染场景进行灯光渲染;The rendering module 14 is configured to distribute light particles in the current coverage area according to preset rules, and perform light rendering on the current rendering scene corresponding to the current coverage area;

确定模块15,用于随着相机视窗的移动,确定相机视窗在阵列中的移动覆盖区域;Determining module 15 is used for determining the mobile coverage area of the camera window in the array along with the movement of the camera window;

渲染模块14,还用于将当前覆盖区域中的灯光粒子转移到移动覆盖区域的阵列区块坐标对应的位置处,对移动覆盖区域对应的移动渲染场景进行灯光渲染;将移动覆盖区域作为相机视窗下一次移动时的当前覆盖区域,以使每个灯光粒子始终按照同一坐标分布在相机视窗内。The rendering module 14 is also used to transfer the light particles in the current coverage area to the position corresponding to the array block coordinates of the mobile coverage area, and perform light rendering on the mobile rendering scene corresponding to the mobile coverage area; use the mobile coverage area as the camera window The current coverage area for the next move, so that each light particle is always distributed within the camera viewport at the same coordinates.

关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the apparatus in the foregoing embodiments, the specific manner in which each module executes operations has been described in detail in the embodiments related to the method, and will not be described in detail here.

进一步地,本实施例的三维夜景灯光自动生成和渲染的装置,每个阵列区块包括相同的子阵列,子阵列中的子阵列区块的数量与灯光粒子的数量相同;Further, in the device for automatically generating and rendering three-dimensional night scene lights in this embodiment, each array block includes the same sub-array, and the number of sub-array blocks in the sub-array is the same as the number of light particles;

渲染模块14,具体用于确定子阵列区块中,当前覆盖区域覆盖的目标子阵列区块,在每个目标子阵列区块的任意位置均放置一个灯光粒子。The rendering module 14 is specifically configured to determine the target sub-array blocks covered by the current coverage area in the sub-array blocks, and place a light particle at any position of each target sub-array block.

进一步地,本实施例的三维夜景灯光自动生成和渲染的装置,阵列区块和子阵列区块均为彼此相接的正方形区块;Further, in the device for automatically generating and rendering three-dimensional night scene lights in this embodiment, the array blocks and the sub-array blocks are square blocks connected to each other;

渲染模块14,具体用于在0到N1之间随机设置每个灯光粒子的光照范围半径;其中,N1为子阵列区块的边长。The rendering module 14 is specifically configured to randomly set the radius of the illumination range of each light particle between 0 and N1; wherein, N1 is the side length of the sub-array block.

进一步地,本实施例的三维夜景灯光自动生成和渲染的装置,渲染模块14,具体用于按照如下公式确定灯光粒子的偏移值:Further, the device for automatically generating and rendering 3D night scene lights in this embodiment, the rendering module 14, is specifically used to determine the offset value of light particles according to the following formula:

vOffset=(vCell+floor(uCameraPositionMod+0.5-vCell)-uCameraPositionMod)×N2;vOffset=(vCell+floor(uCameraPositionMod+0.5-vCell)-uCameraPositionMod)×N2;

其中,vOffset为偏移值,vCell为当前覆盖区域中的任一灯光粒子的坐标(i,j),uCameraPositionMod为mod(CameraPosition,N2),N2为阵列区块的边长,CameraPosition为相机位置;Among them, vOffset is the offset value, vCell is the coordinate (i, j) of any light particle in the current coverage area, uCameraPositionMod is mod(CameraPosition, N2), N2 is the side length of the array block, and CameraPosition is the camera position;

按照偏移值转移灯光粒子。Shifts light particles by offset.

进一步地,本实施例的三维夜景灯光自动生成和渲染的装置,渲染模块14,具体用于确定当前渲染场景中灯光粒子的高度属性、色温属性和光晕属性,将高度属性、色温属性和光晕属性叠加到灯光粒子中,以对当前渲染场景进行灯光渲染。Further, in the device for automatically generating and rendering 3D night scene lights in this embodiment, the rendering module 14 is specifically used to determine the height attribute, color temperature attribute, and halo attribute of light particles in the current rendering scene, and set the height attribute, color temperature attribute, and halo attribute to Superimposed into light particles for light rendering of the currently rendered scene.

进一步地,本实施例的三维夜景灯光自动生成和渲染的装置,渲染模块14,具体用于将高度属性、色温属性和光晕属性叠加到灯光粒子中,以对移动渲染场景进行灯光渲染。Further, the rendering module 14, the device for automatically generating and rendering 3D night scene lights in this embodiment, is specifically used to superimpose the height attribute, color temperature attribute and halo attribute into the light particles, so as to perform light rendering on the mobile rendering scene.

进一步地,本实施例的三维夜景灯光自动生成和渲染的装置,获取模块11具体用于,获取渲染场景俯视面作为投影区域。Furthermore, in the apparatus for automatically generating and rendering 3D night scene lights in this embodiment, the acquiring module 11 is specifically used to acquire the top view surface of the rendered scene as the projection area.

关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the apparatus in the foregoing embodiments, the specific manner in which each module executes operations has been described in detail in the embodiments related to the method, and will not be described in detail here.

本发明还提供了一种三维夜景灯光自动生成和渲染的设备,用于实现上述方法实施例。图7是本发明三维夜景灯光自动生成和渲染的设备一种实施例提供的结构示意图。如图7所示,本实施例的三维夜景灯光自动生成和渲染的设备包括处理器21和存储器22,处理器21与存储器22相连。其中,处理器21用于调用并执行存储器22中存储的程序;存储器22用于存储程序,程序至少用于执行以上实施例中的三维夜景灯光自动生成和渲染的方法。The present invention also provides a device for automatically generating and rendering three-dimensional night scene lights, which is used to realize the above method embodiment. Fig. 7 is a schematic structural diagram provided by an embodiment of the device for automatically generating and rendering 3D night scene lights according to the present invention. As shown in FIG. 7 , the device for automatically generating and rendering 3D night scene lights in this embodiment includes a processor 21 and a memory 22 , and the processor 21 is connected to the memory 22 . Wherein, the processor 21 is used to call and execute the program stored in the memory 22; the memory 22 is used to store the program, and the program is at least used to execute the method for automatically generating and rendering the 3D night scene light in the above embodiment.

在一种具体的实施方式中,处理器21包括显卡,存储器22包括显存。In a specific implementation manner, the processor 21 includes a graphics card, and the storage 22 includes a video memory.

本申请实施例提供的三维夜景灯光自动生成和渲染的设备的具体实施方案可以参考以上任意实施例的三维夜景灯光自动生成和渲染的方法的实施方式,此处不再赘述。For the specific implementation of the device for automatically generating and rendering 3D night scene lights provided in the embodiments of the present application, reference may be made to the implementation of the method for automatically generating and rendering 3D night scene lights in any of the above embodiments, which will not be repeated here.

可以理解的是,上述各实施例中相同或相似部分可以相互参考,在一些实施例中未详细说明的内容可以参见其他实施例中相同或相似的内容。It can be understood that, the same or similar parts in the above embodiments can be referred to each other, and the content that is not described in detail in some embodiments can be referred to the same or similar content in other embodiments.

需要说明的是,在本发明的描述中,术语“第一”、“第二”等仅用于描述目的,而不能理解为指示或暗示相对重要性。此外,在本发明的描述中,除非另有说明,“多个”的含义是指至少两个。It should be noted that, in the description of the present invention, terms such as "first" and "second" are only used for description purposes, and should not be understood as indicating or implying relative importance. In addition, in the description of the present invention, unless otherwise specified, the meaning of "plurality" means at least two.

流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本发明的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本发明的实施例所属技术领域的技术人员所理解。Any process or method descriptions in flowcharts or otherwise described herein may be understood to represent modules, segments or portions of code comprising one or more executable instructions for implementing specific logical functions or steps of the process , and the scope of preferred embodiments of the invention includes alternative implementations in which functions may be performed out of the order shown or discussed, including substantially concurrently or in reverse order depending on the functions involved, which shall It is understood by those skilled in the art to which the embodiments of the present invention pertain.

应当理解,本发明的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。It should be understood that various parts of the present invention can be realized by hardware, software, firmware or their combination. In the embodiments described above, various steps or methods may be implemented by software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one or combination of the following techniques known in the art: Discrete logic circuits, ASICs with suitable combinational logic gates, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.

本技术领域的普通技术人员可以理解实现上述实施例方法携带的全部或部分步骤是可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,该程序在执行时,包括方法实施例的步骤之一或其组合。Those of ordinary skill in the art can understand that all or part of the steps carried by the methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. During execution, one or a combination of the steps of the method embodiments is included.

此外,在本发明各个实施例中的各功能单元可以集成在一个处理模块中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing module, each unit may exist separately physically, or two or more units may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software function modules. If the integrated modules are implemented in the form of software function modules and sold or used as independent products, they can also be stored in a computer-readable storage medium.

上述提到的存储介质可以是只读存储器,磁盘或光盘等。The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, and the like.

在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本发明的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任何的一个或多个实施例或示例中以合适的方式结合。In the description of this specification, descriptions referring to the terms "one embodiment", "some embodiments", "example", "specific examples", or "some examples" mean that specific features described in connection with the embodiment or example , structure, material or characteristic is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.

尽管上面已经示出和描述了本发明的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本发明的限制,本领域的普通技术人员在本发明的范围内可以对上述实施例进行变化、修改、替换和变型。Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limiting the present invention, those skilled in the art can make the above-mentioned The embodiments are subject to changes, modifications, substitutions and variations.

Claims (6)

1.一种三维夜景灯光自动生成和渲染的方法,其特征在于,包括:1. A method for automatic generation and rendering of three-dimensional night scene lights, characterized in that, comprising: 获取渲染场景的预设面作为投影区域;Obtain the preset surface of the rendered scene as the projection area; 在所述投影区域中添加预先构建的阵列;其中,所述阵列的每个阵列区块均设置有相同的坐标系;每个所述阵列区块包括相同的子阵列,所述子阵列中的子阵列区块的数量与灯光粒子的数量相同;Add a pre-built array in the projection area; wherein, each array block of the array is provided with the same coordinate system; each array block includes the same sub-array, and the sub-arrays in the sub-array The number of subarray blocks is the same as the number of light particles; 检测形状、大小均与任一所述阵列区块相同的相机视窗在所述阵列中的当前覆盖区域;Detecting the current coverage area of the camera window in the array whose shape and size are the same as any of the array blocks; 将灯光粒子按照预设规律分布在所述当前覆盖区域中,对所述当前覆盖区域对应的当前渲染场景进行灯光渲染;其中,所述将灯光粒子按照预设规律分布在所述当前覆盖区域中,包括:确定所述子阵列区块中,所述当前覆盖区域覆盖的目标子阵列区块;在0到N1之间随机设置每个所述灯光粒子的光照范围半径;其中,N1为所述子阵列区块的边长;在每个所述目标子阵列区块的任意位置均放置一个所述灯光粒子;所述阵列区块和所述子阵列区块均为彼此相接的正方形区块;Distributing light particles in the current coverage area according to preset rules, and performing light rendering on the current rendering scene corresponding to the current coverage area; wherein, distributing light particles in the current coverage area according to preset rules , including: determining the target sub-array block covered by the current coverage area in the sub-array block; randomly setting the illumination range radius of each light particle between 0 and N1; wherein, N1 is the The side length of the sub-array block; one light particle is placed at any position of each target sub-array block; the array block and the sub-array block are square blocks connected to each other ; 随着所述相机视窗的移动,确定所述相机视窗在所述阵列中的移动覆盖区域;determining a moving coverage area of the camera window in the array as the camera window moves; 将所述当前覆盖区域中的所述灯光粒子转移到所述移动覆盖区域的所述阵列区块坐标对应的位置处,对所述移动覆盖区域对应的移动渲染场景进行灯光渲染;其中,所述将所述当前覆盖区域中的所述灯光粒子转移到所述移动覆盖区域的所述阵列区块坐标对应的位置处,包括:按照如下公式确定所述灯光粒子的偏移值:Transfer the light particles in the current coverage area to the position corresponding to the array block coordinates of the mobile coverage area, and perform light rendering on the mobile rendering scene corresponding to the mobile coverage area; wherein, the Transferring the light particles in the current coverage area to the position corresponding to the coordinates of the array block in the mobile coverage area includes: determining the offset value of the light particles according to the following formula: vOffset=(vCell+floor(uCameraPositionMod+0.5-vCell)-uCameraPositionMod)×N2;vOffset=(vCell+floor(uCameraPositionMod+0.5-vCell)-uCameraPositionMod)×N2; 其中,vOffset为所述偏移值,vCell为所述当前覆盖区域中的任一所述灯光粒子的坐标(i,j),uCameraPositionMod为mod(CameraPosition,N2),N2为所述阵列区块的边长,CameraPosition为相机位置;按照所述偏移值转移所述灯光粒子;Among them, vOffset is the offset value, vCell is the coordinate (i, j) of any light particle in the current coverage area, uCameraPositionMod is mod(CameraPosition, N2), and N2 is the position of the array block Side length, CameraPosition is the camera position; transfer the light particles according to the offset value; 将所述移动覆盖区域作为所述相机视窗下一次移动时的所述当前覆盖区域,以使每个所述灯光粒子始终按照同一坐标分布在所述相机视窗内。The moving coverage area is used as the current coverage area when the camera window moves next time, so that each light particle is always distributed in the camera window according to the same coordinates. 2.根据权利要求1所述的三维夜景灯光自动生成和渲染的方法,其特征在于,所述对所述当前覆盖区域对应的当前渲染场景进行灯光渲染,包括:2. The method for automatically generating and rendering three-dimensional night scene lights according to claim 1, wherein said performing light rendering on the current rendering scene corresponding to the current coverage area comprises: 确定所述当前渲染场景中所述灯光粒子的高度属性、色温属性和光晕属性;Determine the height attribute, color temperature attribute and halo attribute of the light particles in the current rendering scene; 将所述高度属性、所述色温属性和所述光晕属性叠加到所述灯光粒子中,以对所述当前渲染场景进行灯光渲染。The height attribute, the color temperature attribute and the halo attribute are superimposed on the light particles, so as to perform light rendering on the current rendering scene. 3.根据权利要求2所述的三维夜景灯光自动生成和渲染的方法,其特征在于,所述对所述移动覆盖区域对应的移动渲染场景进行灯光渲染,包括:3. The method for automatically generating and rendering three-dimensional night scene lights according to claim 2, wherein said performing light rendering on the mobile rendering scene corresponding to the mobile coverage area comprises: 将所述高度属性、所述色温属性和所述光晕属性叠加到所述灯光粒子中,以对所述移动渲染场景进行灯光渲染。The height attribute, the color temperature attribute and the halo attribute are superimposed on the light particles to perform light rendering on the mobile rendering scene. 4.根据权利要求1所述的三维夜景灯光自动生成和渲染的方法,其特征在于,所述获取渲染场景的预设面作为投影区域,包括:4. The method for automatic generation and rendering of three-dimensional night scene lights according to claim 1, wherein the acquisition of the preset surface of the rendering scene as a projection area includes: 获取所述渲染场景俯视面作为所述投影区域。Obtain the top view surface of the rendering scene as the projection area. 5.一种三维夜景灯光自动生成和渲染的装置,其特征在于,包括:5. A device for automatically generating and rendering three-dimensional night scene lights, characterized in that it comprises: 获取模块,用于获取渲染场景的预设面作为投影区域;An acquisition module, which is used to acquire the preset surface of the rendering scene as the projection area; 添加模块,用于在所述投影区域中添加预先构建的阵列;其中,所述阵列的每个阵列区块均设置有相同的坐标系;每个所述阵列区块包括相同的子阵列,所述子阵列中的子阵列区块的数量与灯光粒子的数量相同;The adding module is used to add a pre-built array in the projection area; wherein, each array block of the array is provided with the same coordinate system; each of the array blocks includes the same sub-array, so The number of subarray blocks in the subarray is the same as the number of light particles; 检测模块,用于检测形状、大小均与任一所述阵列区块相同的相机视窗在所述阵列中的当前覆盖区域;A detection module, configured to detect the current coverage area of the camera window in the array whose shape and size are the same as any of the array blocks; 渲染模块,用于将灯光粒子按照预设规律分布在所述当前覆盖区域中,对所述当前覆盖区域对应的当前渲染场景进行灯光渲染;其中,所述将灯光粒子按照预设规律分布在所述当前覆盖区域中;具体用于确定所述子阵列区块中,所述当前覆盖区域覆盖的目标子阵列区块;在0到N1之间随机设置每个所述灯光粒子的光照范围半径;其中,N1为所述子阵列区块的边长;在每个所述目标子阵列区块的任意位置均放置一个所述灯光粒子;所述阵列区块和所述子阵列区块均为彼此相接的正方形区块;A rendering module, configured to distribute light particles in the current coverage area according to preset rules, and perform light rendering on the current rendering scene corresponding to the current coverage area; wherein, the light particles are distributed in the current coverage area according to preset rules In the current coverage area; it is specifically used to determine the target sub-array block covered by the current coverage area in the sub-array block; randomly set the illumination range radius of each of the light particles between 0 and N1; Wherein, N1 is the side length of the sub-array block; one light particle is placed at any position of each target sub-array block; the array block and the sub-array block are mutually contiguous square blocks; 确定模块,用于随着所述相机视窗的移动,确定所述相机视窗在所述阵列中的移动覆盖区域;A determining module, configured to determine a moving coverage area of the camera window in the array as the camera window moves; 所述渲染模块,还用于将所述当前覆盖区域中的所述灯光粒子转移到所述移动覆盖区域的所述阵列区块坐标对应的位置处,对所述移动覆盖区域对应的移动渲染场景进行灯光渲染;将所述移动覆盖区域作为所述相机视窗下一次移动时的所述当前覆盖区域,以使每个所述灯光粒子始终按照同一坐标分布在所述相机视窗内;其中,所述将所述当前覆盖区域中的所述灯光粒子转移到所述移动覆盖区域的所述阵列区块坐标对应的位置处;所述渲染模块,具体用于按照如下公式确定所述灯光粒子的偏移值:The rendering module is further configured to transfer the light particles in the current coverage area to positions corresponding to the coordinates of the array block in the mobile coverage area, and render the mobile rendering scene corresponding to the mobile coverage area Perform light rendering; use the moving coverage area as the current coverage area when the camera window moves next time, so that each light particle is always distributed in the camera window according to the same coordinates; wherein, the Transfer the light particles in the current coverage area to the position corresponding to the coordinates of the array block in the mobile coverage area; the rendering module is specifically used to determine the offset of the light particles according to the following formula value: vOffset=(vCell+floor(uCameraPositionMod+0.5-vCell)-uCameraPositionMod)×N2;vOffset=(vCell+floor(uCameraPositionMod+0.5-vCell)-uCameraPositionMod)×N2; 其中,vOffset为所述偏移值,vCell为所述当前覆盖区域中的任一所述灯光粒子的坐标(i,j),uCameraPositionMod为mod(CameraPosition,N2),N2为所述阵列区块的边长,CameraPosition为相机位置;按照所述偏移值转移所述灯光粒子。Among them, vOffset is the offset value, vCell is the coordinate (i, j) of any light particle in the current coverage area, uCameraPositionMod is mod(CameraPosition, N2), and N2 is the position of the array block Side length, CameraPosition is the camera position; transfer the light particles according to the offset value. 6.一种三维夜景灯光自动生成和渲染的设备,其特征在于,包括处理器和存储器,所述处理器与所述存储器相连:6. A device for automatic generation and rendering of three-dimensional night scene lighting, characterized in that it includes a processor and a memory, and the processor is connected to the memory: 其中,所述处理器,用于调用并执行所述存储器中存储的程序;Wherein, the processor is configured to call and execute the program stored in the memory; 所述存储器,用于存储所述程序,所述程序至少用于执行权利要求1-4任一项所述的三维夜景灯光自动生成和渲染的方法。The memory is used to store the program, and the program is at least used to execute the method for automatically generating and rendering three-dimensional night scene lights according to any one of claims 1-4.
CN202011103870.3A 2020-10-15 2020-10-15 Method, device and equipment for automatic generation and rendering of 3D night scene lights Active CN112184878B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011103870.3A CN112184878B (en) 2020-10-15 2020-10-15 Method, device and equipment for automatic generation and rendering of 3D night scene lights

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011103870.3A CN112184878B (en) 2020-10-15 2020-10-15 Method, device and equipment for automatic generation and rendering of 3D night scene lights

Publications (2)

Publication Number Publication Date
CN112184878A CN112184878A (en) 2021-01-05
CN112184878B true CN112184878B (en) 2023-08-25

Family

ID=73949788

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011103870.3A Active CN112184878B (en) 2020-10-15 2020-10-15 Method, device and equipment for automatic generation and rendering of 3D night scene lights

Country Status (1)

Country Link
CN (1) CN112184878B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112802170B (en) * 2021-02-07 2023-05-16 抖音视界有限公司 Illumination image generation method, device, equipment and medium
CN118247467B (en) * 2024-01-04 2024-12-06 广州凡拓动漫科技有限公司 Digital twin data rendering method, system, electronic equipment and storage medium
CN119538599B (en) * 2025-01-22 2025-05-16 浙江中元照明股份有限公司 Night scene illumination energy-saving design method based on dynamic dimming technology

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104103092A (en) * 2014-07-24 2014-10-15 无锡梵天信息技术股份有限公司 Real-time dynamic shadowing realization method based on projector lamp
CN104751464A (en) * 2015-03-30 2015-07-01 山东大学 Real sense material measurement device and method based on camera light source array modes
CN106878698A (en) * 2016-12-23 2017-06-20 中国科学院自动化研究所 Method and system for mobile naked-eye three-dimensional virtual reality based on optical path acquisition
CN108597010A (en) * 2018-04-19 2018-09-28 北京知道创宇信息技术有限公司 Cut-fill rendering intent and device
CN110083965A (en) * 2019-05-07 2019-08-02 洛阳众智软件科技股份有限公司 Analysis of Thermal Environment method, apparatus, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104103092A (en) * 2014-07-24 2014-10-15 无锡梵天信息技术股份有限公司 Real-time dynamic shadowing realization method based on projector lamp
CN104751464A (en) * 2015-03-30 2015-07-01 山东大学 Real sense material measurement device and method based on camera light source array modes
CN106878698A (en) * 2016-12-23 2017-06-20 中国科学院自动化研究所 Method and system for mobile naked-eye three-dimensional virtual reality based on optical path acquisition
CN108597010A (en) * 2018-04-19 2018-09-28 北京知道创宇信息技术有限公司 Cut-fill rendering intent and device
CN110083965A (en) * 2019-05-07 2019-08-02 洛阳众智软件科技股份有限公司 Analysis of Thermal Environment method, apparatus, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于WebGL的三维落叶场景仿真;张文娟 等;计算机技术与发展(第06期);第165-169页 *

Also Published As

Publication number Publication date
CN112184878A (en) 2021-01-05

Similar Documents

Publication Publication Date Title
CN112184878B (en) Method, device and equipment for automatic generation and rendering of 3D night scene lights
US10928189B2 (en) Intensity-modulated light pattern for active stereo
JP6910130B2 (en) 3D rendering method and 3D rendering device
KR102292923B1 (en) 3d rendering method and apparatus
CN102768765B (en) Real-time soft shadow rendering method for point light sources
US20180122129A1 (en) Generation, transmission and rendering of virtual reality multimedia
EP2973425B1 (en) System and method for remote generation indirect illumination sources in three-dimensional graphics
US9418629B2 (en) Optical illumination mapping
CN105006021B (en) A kind of Color Mapping Approach and device being applicable to quickly put cloud three-dimensional reconstruction
CA2866849C (en) Method for estimating the opacity level in a scene and corresponding device
CN104103092A (en) Real-time dynamic shadowing realization method based on projector lamp
US12131419B2 (en) Rendering images for non-standard display devices
KR102775308B1 (en) Method and apparatus of outputting light source information
CN115115747B (en) Lighting rendering method, device, electronic device and storage medium
CN107493411A (en) Image processing system and method
CN110211197B (en) A photon mapping optimization method, device and system based on polygon space division
CN105245805A (en) Projection method and electronic equipment
CN105447905B (en) Three-dimensional scenic approximation soft shadows method for drafting based on observability smothing filtering
US12322037B2 (en) System and method for real-time ray tracing in a 3D environment
CN114758051A (en) An image rendering method and related equipment
CN103093491A (en) Three-dimensional model high sense of reality virtuality and reality combination rendering method based on multi-view video
CN117456076A (en) A material map generation method and related equipment
CN106447759B (en) The method for realizing the indirect lighting effect proximity rendering of three-dimensional scenic using visibility interpolation
JP2008249952A (en) Image display system and image display program
Zang et al. Augmented reality using full panoramic captured scene light-depth maps

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: Floor 13, 14 and 15, building 3, lianfei building, No.1, Fenghua Road, high tech Development Zone, Luoyang City, Henan Province, 471000

Patentee after: Zhongzhi Software Co.,Ltd.

Country or region after: China

Address before: Floor 13, 14 and 15, building 3, lianfei building, No.1, Fenghua Road, high tech Development Zone, Luoyang City, Henan Province, 471000

Patentee before: Luoyang Zhongzhi Software Technology Co.,Ltd.

Country or region before: China

CP03 Change of name, title or address
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Method, device, and equipment for automatic generation and rendering of 3D night scene lighting

Granted publication date: 20230825

Pledgee: Luoyang Chanrong Group Co.,Ltd.

Pledgor: Zhongzhi Software Co.,Ltd.

Registration number: Y2024980049208

PE01 Entry into force of the registration of the contract for pledge of patent right