Virtual light processing method and apparatus, electronic device, computer readable storage medium and computer program product
By generating virtual occlusions with transparent channels in the virtual scene and controlling the illumination of virtual light sources, the problem of graphics errors in virtual projection is solved, and the universality of the operating environment and display effect of virtual light processing is improved.
Patent Information
- Application Number
- PCT/CN2024/081856
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-05-23
- Filing Date
- 2024-03-15
- Publication Date
- 2024-11-28
AI Technical Summary
The prior art in virtual projection causes graphics errors or missing problems in virtual projection, which limits the universality of the operating environment.
By obtaining the light source position and parameters of the virtual light source, the target size of the virtual occlusion is determined, and a virtual occlusion with transparent channels is generated in the virtual scene, the virtual light source illumination is controlled, so that the virtual light rays pass through the transparent channel, forming a layout rule that meets the layout graphic.
It improves the universality of virtual light processing, ensures that the virtual scenes operate consistently in different environments, reduces production costs, and enhances the display effect of virtual light.
Smart Images

Figure CN2024081856_28112024_PF_FP_ABST
Abstract
Description
Virtual light processing method, device, electronic device, computer-readable storage medium and computer program product
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application is based on the Chinese patent application with application number 202310589460.1 and application date May 23, 2023, and claims the priority of the Chinese patent application. The entire content of the Chinese patent application is hereby introduced into this application as a reference. Technical Field
[0003] The present application relates to the field of computer technology, and in particular to a method, device, electronic device, computer-readable storage medium, and computer program product for processing virtual light. Background Art
[0004] With the rapid development of virtual reality technology, the production of virtual scenes has become increasingly rich. In order to provide players with a realistic virtual reality experience, in applications that support virtual scenes, in order to enhance the expressiveness of the virtual scenes, it is necessary to add lighting effects during the rendering process.
[0005] In the related art, because virtual projection is used when projecting graphics, some versions of the software may cause graphic errors or even missing projection when projecting certain objects or components, resulting in significant limitations on the version requirements of the operating environment for the related art.
[0006] Summary of the Invention
[0007] The embodiments of the present application provide a method, device, electronic device, computer-readable storage medium, and computer program product for processing virtual light, which can effectively improve the universality of the operating environment for processing virtual light.
[0008] The technical solution of the embodiment of the present application is implemented as follows:
[0009] The present invention provides a method for processing virtual light, including:
[0010] Acquire a light source position of a virtual light source used to form a virtual light ray in a virtual scene, and light source parameters of the virtual light source;
[0011] Based on the light source position, determining a target position in the virtual scene, wherein a line connecting the target position and the virtual light source coincides with a central virtual light ray, where the central virtual light ray is a central virtual light ray among multiple virtual light rays emitted by the virtual light source;
[0012] Determining a target size of a virtual occluder in combination with the light source parameters and the target position, wherein the virtual occluder is used to block the virtual light emitted by the virtual light source;
[0013] generating the virtual occluder having the target size at the target position in the virtual scene, wherein the virtual occluder is provided with at least one transparent channel arranged according to an arrangement rule;
[0014] The virtual light source is controlled to illuminate the virtual obstruction, so that the virtual light emitted by the virtual light source passes through the transparent channel and forms a pattern that meets the arrangement rule in the virtual scene.
[0015] An embodiment of the present application provides a virtual light processing device, comprising:
[0016] an acquisition module configured to acquire a light source position of a virtual light source used to form a virtual light ray in a virtual scene, and light source parameters of the virtual light source;
[0017] a position determination module configured to determine a target position in the virtual scene based on the position of the light source, wherein a line connecting the target position and the virtual light source coincides with a central virtual ray, where the central virtual ray is a central virtual ray among multiple virtual rays emitted by the virtual light source;
[0018] a size determination module configured to determine a target size of a virtual occluder based on light source parameters and a target position, the virtual occluder being used to block virtual light emitted by the virtual light source;
[0019] A generating module configured to generate a virtual occluder having a target size at a target position in the virtual scene, wherein the virtual occluder is provided with at least one transparent channel arranged according to an arrangement rule;
[0020] The control module is configured to control the virtual light source to illuminate the virtual obstruction, so that the virtual light emitted by the virtual light source passes through the transparent channel and forms a pattern that meets the arrangement rule in the virtual scene.
[0021] An embodiment of the present application provides an electronic device, including:
[0022] a memory configured to store computer-executable instructions or computer programs;
[0023] The processor is configured to implement the virtual light processing method provided in the embodiment of the present application when executing the computer executable instructions or computer program stored in the memory.
[0024] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions configured to cause a processor to execute the instructions to implement the virtual light processing method provided in the embodiment of the present application.
[0025] Embodiments of the present application provide a computer program product, comprising a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the virtual light processing method described in the embodiments of the present application.
[0026] The embodiments of the present application have the following beneficial effects:
[0027] By obtaining the light source position and light source parameters of a virtual light source, and based on the light source position and light source parameters, determining a target size for a virtual occluder, a virtual occluder of the target size is generated at the target location in the virtual scene, and the virtual light source is controlled to illuminate the virtual occluder so that virtual light emitted by the virtual light source passes through a transparent channel, thereby forming a pattern in the virtual scene that satisfies the arrangement rule. In this way, based on the physical parameters of the virtual scene, such as the light source position and light source parameters, the virtual occluder of the target size is placed at the target location in the virtual scene. Because the virtual occluder is provided with transparent channels arranged according to the arrangement rule, the virtual occluder placed at the target location can selectively block the virtual light, thereby forming a pattern in the virtual scene that satisfies the arrangement rule. Because the placed virtual occluder can meet the virtual light occlusion requirements, and the corresponding physical parameters of the virtual scene remain unchanged under different operating environments, the placed virtual occluder can be applied to various operating environments, thereby effectively improving the universality of the operating environment for processing virtual light. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] FIG1 is a schematic diagram of the architecture of a virtual light processing system provided in an embodiment of the present application;
[0029] FIG2 is a schematic structural diagram of an electronic device for processing virtual light provided in an embodiment of the present application;
[0030] FIG3 is a first flow chart of a method for processing virtual light provided in an embodiment of the present application;
[0031] FIG4 is a second flow chart of a method for processing virtual light provided in an embodiment of the present application;
[0032] FIG5 is a third flow chart of a method for processing virtual light provided in an embodiment of the present application;
[0033] FIG6 is a fourth flow chart of a method for processing virtual light provided in an embodiment of the present application;
[0034] FIG7 is a first schematic diagram of the principle of a method for processing virtual light provided in an embodiment of the present application;
[0035] FIG8 is a first schematic diagram of the principle of a two-dimensional virtual occluder provided in an embodiment of the present application;
[0036] FIG9 is a second schematic diagram of the principle of a two-dimensional virtual occluder provided in an embodiment of the present application;
[0037] FIG10 is a second schematic diagram of the principle of the method for processing virtual light provided in an embodiment of the present application;
[0038] FIG11 is a schematic diagram of the effect of a three-dimensional virtual occluder provided in an embodiment of the present application;
[0039] FIG12 is a first schematic diagram of the principle of a two-dimensional virtual occluder provided in an embodiment of the present application;
[0040] FIG13 is a second schematic diagram of the principle of a two-dimensional virtual occluder provided in an embodiment of the present application;
[0041] FIG14 is a schematic diagram showing the effect of the virtual light processing method provided in an embodiment of the present application;
[0042] FIG15 is a fifth flow chart of a method for processing virtual light provided in an embodiment of the present application;
[0043] FIG16 is a sixth flow chart of a method for processing virtual light provided in an embodiment of the present application;
[0044] FIG17 is a schematic diagram of a cube principle of a virtual light processing method provided in an embodiment of the present application;
[0045] FIG18 is a third schematic diagram of the principle of the method for processing virtual light provided in an embodiment of the present application;
[0046] FIG19 is a seventh flow chart of the method for processing virtual light provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0048] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0049] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0051] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0052] 1) In response to: used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed can be in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed are executed.
[0053] 2) Virtual scene: This is a virtual scene displayed or provided when the application is running on the terminal. The virtual scene can be a simulation of the real world, a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. The virtual scene can be any of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, or a three-dimensional virtual scene. The embodiments of the present application do not limit the dimensions of the virtual scene. For example, the virtual scene can include the sky, land, ocean, etc. The land can include environmental elements such as deserts and cities, and users can control virtual objects to move in the virtual scene.
[0054] 3) Virtual Objects: Images of various people and objects that can interact in a virtual scene, or movable objects in a virtual scene. These movable objects can be virtual people, virtual animals, cartoon characters, etc., such as people, animals, plants, oil drums, walls, stones, etc. displayed in a virtual scene. These virtual objects can be virtual avatars that represent users in the virtual scene. A virtual scene can include multiple virtual objects, each with its own shape and volume, occupying a portion of the space within the virtual scene. These virtual objects can be user characters controlled through client operations, artificial intelligence (AI) trained to play in a virtual scene, or non-player characters (NPCs) used in virtual scene interactions. These virtual objects can be virtual characters that engage in adversarial interactions in the virtual scene. The number of virtual objects participating in the interaction in the virtual scene can be pre-set or dynamically determined based on the number of clients participating in the interaction.
[0055] 4) Game Program: The game program may be any of a massively multiplayer online role-playing game (MMORPG), a first-person shooter (FPS), a third-person shooter, a multiplayer online battle arena (MOBA), a virtual reality application, a three-dimensional mapping program, a simulation program, or a multiplayer shootout survival game.
[0056] 5) Augmented Reality (AR): This technology cleverly integrates virtual information with the real world. It utilizes a wide range of technologies, including multimedia, 3D modeling, real-time registration, intelligent interaction, and sensing. It simulates computer-generated virtual information, such as text, images, 3D models, music, and video, and then applies it to the real world. The two types of information complement each other, thereby "augmenting" the real world. Also known as augmented reality, AR is a relatively new technology that integrates real-world and virtual-world information. It simulates physical information, previously difficult to experience within the spatial confines of the real world, using computer science and other scientific technologies. This overlay allows virtual information to be effectively applied in the real world, and this process is perceived by human senses, creating a sensory experience beyond reality. The real environment and virtual objects overlap, allowing them to coexist in the same image and space.
[0057] 6) Virtual camera: It is a "camera" set up in computer animation software or virtual engine. The role of virtual camera in expressing viewpoint during animation is equivalent to that of traditional camera. The subjects of virtual camera and physical camera are completely different, but their functions are extremely similar. Physical camera shoots real people or actually built scenes, while virtual camera shoots models built in 3D software, which can realize infinite possibilities. Virtual camera is presented in the form of icon in virtual engine, and also has parameters such as lens, focal length, focus, aperture, depth of field, etc. It can realize camera actions such as "push, pull, shake, move, follow, swing, rise, fall, and comprehensive movement", and can realize shooting effects that are difficult or even impossible to achieve with physical camera, such as passing through walls, through keyholes, through objects, etc. The parameters that need to be adjusted for physical camera are distributed on the body of physical camera and require manual operation. The camera parameters of the virtual camera are buttons or numerical input bars integrated on the panel. The operator only needs to input the parameters or drag the mouse. Sometimes a few key frames can determine the motion path of the virtual camera. In actual shooting, physical cameras often require a stabilizer or motion control system. Even so, the shaking of the picture still exists.
[0058] 7) Virtual Engine: A virtual engine refers to some already-written editable computer virtual systems or core components of some interactive real-time image applications. These systems provide virtual scene designers with various tools needed to write virtual scenes. The purpose is to enable designers to write programs easily and quickly. Virtual engines include rendering engines (rendering engines include two-dimensional rendering engines and three-dimensional rendering engines), physics engines, collision detection engines, sound engines, script engines, animation engines, artificial intelligence engines, network engines and scene management engines, etc.
[0059] 8) Virtual light source: It is a "light source" set up in computer animation software or virtual engines. The role of virtual light source in expressing viewpoints in animation production is equivalent to the physical light source in the traditional sense. The objects illuminated by virtual light source and physical light source are completely different, but the functions are extremely similar. Physical light source illuminates real-life characters or actually built scenes, while virtual light source illuminates models built in 3D software, which can realize unlimited possibilities.
[0060] 9) Virtual light: refers to the light in the virtual scene emitted by the virtual light source used to illuminate the virtual scene. Virtual light includes direct light and indirect light. Among them, direct light is the virtual light emitted by the virtual light source, reflected from the virtual illumination point to the virtual camera, and indirect light is the virtual light emitted by the virtual light source, reflected at least once, to the virtual illumination point, and finally reflected from the virtual illumination point to the virtual camera.
[0061] 10) Virtual Production: Virtual production is a broad term that refers to a range of computer-assisted production and visualization methods for filmmaking. Let's first look at some common definitions of virtual production. According to the Weta Digital team, "virtual production is the area where the real and digital worlds merge." Virtual production combines virtual reality and augmented reality with CGI and game engine technologies, enabling filmmakers to see scenes unfold before them as if they were composited and filmed on location.
[0062] 11) DMX Fixtures: Essentially, a DMX fixture is a device responsible for receiving and executing commands based on the data it receives. This might mean turning a light source on or off or rotating it 90 degrees. DMX fixtures come in many varieties, from standard stage lights with simple switches to intelligent lights that can rotate in multiple directions and feature filters. Each fixture has a set of predefined properties / commands at the hardware level. These properties are organized into groups called odes. Many fixtures include multiple modes, which predefine the available properties the fixture will respond to. Fixture manufacturers offer different mode options to accommodate a variety of use cases, including as many features as possible while allowing users to select the features most important to them. This ranges from the simplest, smallest channel count mode; to the more complex, larger channel count mode; and to a number of intermediate modes. In professional lighting practice, intermediate modes are often chosen to strike a balance between functionality and ease of control, while using DMX channels more sparingly. Each mode contains a set of properties. These properties tell the hardware how to respond to received DMX data. In most cases, all properties for a specific fixture can be found in the fixture manual that comes with the fixture.
[0063] During the implementation of the embodiments of this application, the applicant discovered that the related technology has the following problems:
[0064] In the related art, because virtual projection is used when projecting graphics, certain versions of the software may cause graphic errors or even no projection when projecting certain objects or components, resulting in large version limitations of the related art for the operating environment. The embodiment of the present application can enable the projection of graphics to be completely based on the physical illumination method of light in the Unreal Engine to achieve projection, which is applicable to all versions of the operating environment, effectively improving the universality of the operating environment for processing virtual light.
[0065] Embodiments of the present application provide a method, apparatus, electronic device, computer-readable storage medium, and computer program product for processing virtual light, which can effectively improve the universality of the operating environment for processing virtual light. The following describes an exemplary application of the virtual light processing system provided in embodiments of the present application.
[0066] Refer to Figure 1, which is a schematic diagram of the architecture of the virtual light processing system 100 provided in an embodiment of the present application. The terminal (terminal 400 is shown as an example) is connected to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.
[0067] The terminal 400 is configured to allow a user to use a client 410 to display a virtual scene on a graphical interface 410-1 (graphic interface 410-1 is shown as an example). The terminal 400 and the server 200 are connected to each other via a wired or wireless network.
[0068] In some embodiments, the server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal 400 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart TV, a smart watch, a car terminal, etc., but is not limited to this. The electronic device provided in the embodiment of the present application can be implemented as a terminal or as a server. The terminal and the server can be directly or indirectly connected by wired or wireless communication, which is not limited in the embodiment of the present application.
[0069] In some embodiments, the virtual light processing method provided in the embodiments of the present application can be applied to application scenarios such as virtual production and game production.
[0070] For example, in the application scenario of virtual production, lighting effects are usually required to form graphics that meet the corresponding arrangement rules in the produced video. Since the production of corresponding lighting effects in the real world often requires the transformation or upgrading of the light sources in the real world, the production cost is relatively high. The virtual light processing method provided in the embodiment of the present application can produce corresponding lighting effects in various versions of production engines, thereby effectively improving the universality of the operating environment for processing virtual light and effectively reducing the production cost. When using terminal 400 for virtual production, terminal 400 responds to the producer's operation on the image interface 400-1, determines the light source position of the virtual light source used to form the virtual light in the produced video, and arranges the virtual light source with corresponding light source parameters at the light source position. Terminal 400 responds to the producer's lighting effect trigger operation for the virtual light source, combines the light source parameters and the target position, determines the target size of the virtual occluder, and generates a virtual occluder with the target size at the target position in the produced video, and controls the virtual light source to illuminate the virtual occluder so that the virtual light emitted by the virtual light source passes through the transparent channel, forming a graphic (lighting effect) that meets the arrangement rules in the produced video.
[0071] For another example, in the application scenario of game production, lighting effects are usually required to form graphics that meet corresponding arrangement rules in the virtual game scene being produced, so as to make the produced game more vivid. The virtual light processing method provided in the embodiment of the present application uses the terminal 400 for game production. The terminal 400 responds to the producer's operation on the image interface 400-1, determines the light source position of the virtual light source used to form the virtual light in the virtual game scene, and arranges the virtual light source with corresponding light source parameters at the light source position. In response to the producer's lighting effect triggering operation on the virtual light source, the terminal 400 determines the target size of the virtual occluder in combination with the light source parameters and the target position, and generates a virtual occluder with the target size at the target position in the virtual game scene, and controls the virtual light source to illuminate the virtual occluder, so that the virtual light emitted by the virtual light source passes through the transparent channel and forms a graphic that meets the arrangement rules in the virtual game scene.
[0072] In some embodiments, the terminal 400 obtains the light source position and the light source parameters of the virtual light source, and determines the target position in the virtual scene based on the light source position, and determines the target size of the virtual occluder in combination with the target position and the light source parameters, and generates a virtual occluder with the target size at the target position in the virtual scene, and controls the virtual light source to illuminate the virtual occluder, so that the virtual light emitted by the virtual light source passes through the transparent channel to form a graphic that meets the arrangement rules in the virtual scene.
[0073] In other embodiments, the server 200 obtains the light source position and light source parameters of the virtual light source, and determines the target position in the virtual scene based on the light source position, and determines the target size of the virtual occluder in combination with the target position and light source parameters, and sends the target position and target size to the terminal 400. The terminal 400 generates a virtual occluder with a target size at the target position in the virtual scene, and controls the virtual light source to illuminate the virtual occluder, so that the virtual light emitted by the virtual light source passes through the transparent channel to form a graphic that meets the arrangement rules in the virtual scene.
[0074] In other embodiments, the embodiments of the present application can be implemented with the help of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network within a wide area network or local area network to realize data calculation, storage, processing, and sharing.
[0075] Cloud technology is a general term for network, information, integration, management platform, and application technologies used in the cloud computing business model. It can form a resource pool that can be used flexibly and conveniently on demand. Cloud computing technology will become a key support. The backend services of technical network systems require a large amount of computing and storage resources.
[0076] Referring to FIG. 2 , FIG. 2 is a schematic diagram of the structure of an electronic device 500 for processing virtual light provided in an embodiment of the present application, wherein the electronic device 500 shown in FIG. 2 may be the server 200 or the terminal 400 in FIG. 1 , and the electronic device 500 shown in FIG. 2 includes: at least one processor 430, a memory 450, and at least one network interface 420. The various components in the electronic device 500 are coupled together via a bus system 440. It is understood that the bus system 440 is configured to enable connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, all the various buses are labeled as the bus system 440 in FIG.
[0077] The processor 430 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0078] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 450 includes one or more storage devices that are physically remote from the processor 430.
[0079] The memory 450 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0080] In some embodiments, the memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.
[0081] Operating system 451, including system programs configured to handle various basic system services and perform hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., configured to implement various basic services and handle hardware-based tasks;
[0082] The network communication module 452 is configured to reach other electronic devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include: Bluetooth, Wireless Fidelity (WiFi), and Universal Serial Bus (USB).
[0083] In some embodiments, the virtual light processing device provided in embodiments of the present application can be implemented using software. FIG2 shows a virtual light processing device 455 stored in memory 450. This device can be software in the form of a program or plug-in, and includes the following software modules: an acquisition module 4551, a position determination module 4552, a size determination module 4553, a generation module 4554, and a control module 4555. These modules are logical and can be arbitrarily combined or further separated according to the functions implemented. The functions of each module will be described below.
[0084] In other embodiments, the virtual light processing device provided in the embodiments of the present application can be implemented in hardware. As an example, the virtual light processing device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the virtual light processing method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0085] In some embodiments, the terminal or server can implement the virtual light processing method provided in the embodiments of the present application by running a computer program or computer executable instructions. For example, the computer program can be a native program in the operating system (for example, a dedicated virtual light processing program) or a software module, for example, a virtual light processing module that can be embedded in any program (such as an instant messaging client, a photo album program, an electronic map client, a navigation client); for example, it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run. In short, the above-mentioned computer program can be any form of application, module or plug-in.
[0086] The virtual light processing method provided in the embodiment of the present application will be described in combination with the exemplary application and implementation of the server or terminal provided in the embodiment of the present application.
[0087] Refer to Figure 3, which is a flow chart of the virtual light processing method provided in an embodiment of the present application. It will be explained in conjunction with steps 101 to 105 shown in Figure 3. The virtual light processing method provided in an embodiment of the present application can be implemented by the server or the terminal alone, or by the server and the terminal in collaboration. The following will be explained using the server alone as an example.
[0088] In step 101 , the light source position of a virtual light source in a virtual scene for forming a virtual light ray and light source parameters of the virtual light source are obtained.
[0089] In some embodiments, the light source position is used to indicate the three-dimensional position coordinates of the virtual light source in the virtual scene in the coordinate system of the virtual scene, that is, the three-dimensional coordinate position of the geometric center point of the virtual light source in the virtual scene in the coordinate system of the virtual scene. The virtual light source is used to form virtual light in the virtual scene.
[0090] In some embodiments, a virtual light source is a "light source" set up in computer animation software or a virtual engine. The role of a virtual light source in expressing viewpoints during animation production is equivalent to a physical light source in the traditional sense. The objects illuminated by the virtual light source and the physical light source are completely different, but their functions are extremely similar. The physical light source illuminates real-life characters or actually constructed scenes, while the virtual light source illuminates models built in three-dimensional software, which can achieve unlimited possibilities.
[0091] In some embodiments, virtual light refers to light in a virtual scene emitted by a virtual light source used to illuminate the virtual scene. The virtual light includes direct light and indirect light. Direct light is emitted by the virtual light source and reflected from the virtual illumination point to the virtual camera. Indirect light is emitted by the virtual light source and, after at least one reflection, reaches the virtual illumination point and is finally reflected from the virtual illumination point to the virtual camera.
[0092] In some embodiments, the light source parameters include an illumination opening angle of the virtual light source, where the illumination opening angle is used to indicate an angle between a boundary virtual ray and a center virtual ray emitted by the virtual light source.
[0093] In step 102, the target position in the virtual scene is determined based on the light source position.
[0094] In some embodiments, the line connecting the target position and the virtual light source coincides with the central virtual ray, which is the central virtual ray among multiple virtual rays emitted by the virtual light source, and the target position is located on the central virtual ray.
[0095] In some embodiments, the line connecting the target position and the virtual light source refers to a line connecting the target position and the center position of the virtual light source.
[0096] In some embodiments, the central virtual ray is the central virtual ray among multiple virtual rays emitted by the virtual light source, and the multiple virtual rays emitted by the virtual light source include two edge virtual rays and one central virtual ray, wherein the edge virtual ray is a virtual ray with other virtual rays on one side and no other virtual rays on the other side, and the distance between the central virtual ray and the two edge virtual rays is equal.
[0097] As an example, refer to Figure 7, which is a schematic diagram of the principle of the virtual light processing method provided in an embodiment of the present application. The multiple virtual light rays emitted by the virtual light source 74 include a central virtual light ray 71, an edge virtual light ray 72 and an edge virtual light ray 73.
[0098] In some embodiments, referring to FIG. 4 , FIG. 4 is a second flow chart of a method for processing virtual light provided in an embodiment of the present application. Step 102 shown in FIG. 3 can be implemented by executing steps 1021 to 1022 shown in FIG. 4 .
[0099] In step 1021 , a plurality of virtual light rays emitted by the virtual light source and a target length are obtained.
[0100] In some embodiments, the target length is less than the length of the central virtual ray.
[0101] In some embodiments, the length of the central virtual ray refers to the length of the central virtual ray in the virtual scene, the starting point of the central virtual ray is the virtual light source that emits the central virtual ray, the end point of the central virtual ray is the scene position in the virtual scene to which the central virtual ray is emitted, the central virtual ray is a straight line in the virtual scene, and the central virtual ray does not include the reflected light of the central virtual ray at the scene position.
[0102] As an example, referring to FIG. 7 , a plurality of virtual rays emitted by a virtual light source 74 are obtained, for example, the five virtual rays shown in FIG. 7 (including an edge virtual ray 72 , an edge virtual ray 73 and a center virtual ray 71 ).
[0103] In step 1022, a central virtual light ray is determined from the plurality of virtual light rays, and a position on the central virtual light ray where the distance from the light source position is equal to the target length is determined as the target position.
[0104] In some embodiments, the above-mentioned determination of the central virtual light from multiple virtual light rays can be achieved as follows: the following processing is performed on each virtual light ray: when the number of other virtual light rays adjacent to the virtual light ray is two, the virtual light ray is determined as a candidate virtual light ray; when the number of other virtual light rays on both sides of the candidate virtual light ray is equal, the candidate virtual light ray is determined as the central virtual light ray.
[0105] As an example, referring to Figure 7, for virtual ray 71, the number of other virtual rays adjacent to virtual ray 71 is two, and virtual ray 71 is determined as a candidate virtual ray. The number of other virtual rays on both sides of candidate virtual ray 71 is two, that is, the number of other virtual rays on both sides of candidate virtual ray 71 is equal, and candidate virtual ray 71 is determined as the center virtual ray.
[0106] As an example, referring to FIG. 7 , a central virtual ray 73 is determined from a plurality of virtual rays, and a position on the central virtual ray 71 where the distance to the light source position 74 is equal to the target length is determined as the target position 77 .
[0107] In this way, by determining the target position in the virtual scene based on the position of the light source, it is convenient to set a virtual occluder at the target position later so that the virtual occluder blocks the virtual light emitted by the virtual light source. By setting physical occlusion in the virtual scene, it can be applied to various application scenarios and can effectively improve the scene universality of processing virtual light.
[0108] In step 103, the target size of the virtual occluder is determined by combining the light source parameters and the target position.
[0109] In some embodiments, the virtual occluder is used to block the virtual light emitted by the virtual light source, so that the virtual light emitted by the virtual light source cannot pass through the blocking surface of the virtual occluder.
[0110] In some embodiments, the light source parameters include an illumination opening angle of the virtual light source, where the illumination opening angle is used to indicate an angle between a boundary virtual ray and a center virtual ray emitted by the virtual light source.
[0111] In some embodiments, the boundary virtual ray refers to a virtual ray located at an edge among multiple virtual rays emitted by a virtual light source, and the boundary virtual ray refers to a virtual ray with only one adjacent virtual ray among multiple virtual rays emitted by a virtual light source.
[0112] In some embodiments, the boundary virtual ray may be determined as follows: for each virtual ray in the plurality of virtual rays, the number of other virtual rays adjacent to the virtual ray is obtained, and when the number is equal to 1, the virtual ray is determined as a boundary virtual ray.
[0113] As an example, referring to FIG. 7 , the aforementioned boundary virtual light may be a virtual light 72 and a virtual light 73 among a plurality of virtual light rays emitted by a virtual light source 74 .
[0114] As an example, referring to FIG. 7 , the illumination opening angle of the virtual light source is used to indicate the angle between the boundary virtual light ray 73 and the center virtual light ray 71 emitted by the virtual light source.
[0115] In some embodiments, referring to FIG. 5 , FIG. 5 is a flowchart diagram three of a method for processing virtual light provided in an embodiment of the present application. Step 103 shown in FIG. 3 can be implemented by executing steps 1031 to 1035 shown in FIG. 5 .
[0116] In step 1031 , a target length between the target position and the light source position is obtained.
[0117] In some embodiments, the target length is used to indicate the length of the distance between the target position and the light source position.
[0118] In step 1032 , the line connecting the target position and the light source position is determined as a reference line segment.
[0119] As an example, referring to FIG. 7 , the line connecting the target position 77 and the light source position 74 is determined as the reference line segment, and the above distance length is also the line segment length of the reference line segment.
[0120] In step 1033 , based on the boundary virtual ray, a target line segment that is perpendicular to the reference line segment and intersects with the boundary virtual ray is determined.
[0121] In some embodiments, the endpoints of the target line segment are respectively located on the boundary virtual ray and the reference line segment, and the target line segment corresponds one-to-one to the boundary virtual ray, that is, one boundary virtual ray corresponds to one target line segment. The step 1033 can be implemented as follows: obtain a target line perpendicular to the reference line segment, and determine the intersection of the boundary virtual ray and the target line; determine the line segment between the intersection on the target line and the target position as the target line segment.
[0122] As an example, referring to FIG7 , a target line 76 perpendicular to the reference line segment (the line connecting the target position 77 and the light source position 74) is obtained, and the intersection point 75 of the boundary virtual light ray and the target line is determined, and the line segment between the intersection point 75 on the target line 76 and the target position 77 is determined as the target line segment.
[0123] In step 1034 , the length of the target line segment is determined by combining the illumination angle and the target length.
[0124] As an example, referring to FIG7 , the length value of the target line segment (the line segment between the intersection point 75 on the target line 76 and the target position 77) is determined by combining the illumination opening angle (the angle between the boundary virtual ray 73 and the center virtual ray 71) and the target length (the distance between the target position 77 and the light source position 74).
[0125] In some embodiments, the above step 1034 can be implemented as follows: obtain the angle between the boundary virtual light and the target line segment, and determine the cosine value of the angle; obtain the cosine value of the illumination opening angle, and determine the ratio of the cosine value of the illumination opening angle to the cosine value of the angle; and determine the integer multiple of the product of the target length and the ratio as the length value of the target line segment.
[0126] As an example, referring to FIG7 , the angle between the boundary virtual ray 73 and the target line segment 76 is obtained, and the cosine value of the angle is determined; the cosine value of the illumination opening angle (the angle between the boundary virtual ray 73 and the center virtual ray 71) is obtained, and the ratio of the cosine value of the illumination opening angle (the angle between the boundary virtual ray 73 and the center virtual ray 71) to the cosine value of the angle is determined; the integer multiple of the product of the target length (the distance between the target position 77 and the light source position 74) and the ratio is determined as the length value of the target line segment.
[0127] As an example, the expression for the length of the target segment can be:
[0128] Wherein, b is used to indicate the length of the target segment, C is used to indicate the target length, sinB is used to indicate the cosine value of the irradiation opening angle, sinC is used to indicate the cosine value of the included angle, and k is used to indicate a positive integer.
[0129] In step 1035 , a target size of the virtual occluder is determined based on the length value.
[0130] In some embodiments, the above-mentioned target size includes a two-dimensional target size or a three-dimensional target size. The target size of the virtual occluder is used to indicate the size of the area or volume occupied by the virtual occluder in the virtual scene. The two-dimensional target size is used to indicate the size of the area occupied by the virtual occluder in the virtual scene. The three-dimensional target size is used to indicate the size of the volume occupied by the virtual occluder in the virtual scene.
[0131] In some embodiments, the above-mentioned step 1035 can be implemented as follows: in response to a dimension selection operation for the virtual occluder, the dimension of the virtual occluder is determined; when the dimension of the virtual occluder is two-dimensional, the two-dimensional target size of the virtual occluder is determined based on the length value; when the dimension of the virtual occluder is three-dimensional, the three-dimensional target size of the virtual occluder is determined based on the length value.
[0132] In some embodiments, when the dimension of the selected virtual occluder is two-dimensional, the corresponding virtual occluder is a two-dimensional virtual occluder. Since the memory space occupied by the two-dimensional virtual occluder in the virtual scene is smaller than that of the three-dimensional virtual occluder (when the bottom area of the three-dimensional virtual occluder is equal to the area of the two-dimensional virtual occluder), selecting a two-dimensional virtual occluder to block the virtual light emitted by the virtual light source can significantly reduce the memory space occupied by the virtual scene and effectively improve the processing efficiency of the virtual light.
[0133] In some embodiments, when the dimension of the selected virtual occluder is three-dimensional, the corresponding virtual occluder is a three-dimensional virtual occluder. Since the three-dimensional virtual occluder occupies a larger memory space in the virtual scene, but the three-dimensional virtual occluder has multiple sides compared to the two-dimensional virtual occluder, it can more effectively block the virtual light emitted by the virtual light source, and can effectively block other virtual light caused by the diffuse reflection of the virtual light, thereby effectively improving the light blocking effect of the virtual occluder.
[0134] In some embodiments, the above-mentioned determination of the two-dimensional target size of the virtual occluder based on the length value can be achieved as follows: in response to a shape selection operation for the virtual occluder, the shape of the virtual occluder is determined; when the shape of the virtual occluder is a circle and the two-dimensional target size includes the radius of the circle, the length value is determined as the radius of the circle; when the shape of the virtual occluder is a rectangle and the two-dimensional target size includes the side length of the rectangle, the integer multiple of the length value is determined as the side length of the rectangle.
[0135] As an example, refer to Figure 8, which is a principle schematic diagram of a two-dimensional virtual occluder provided in an embodiment of the present application. When the shape of the virtual occluder 81 is a circle and the two-dimensional target size includes the radius of the circle, the length value is determined as the radius of the circle.
[0136] As an example, refer to Figure 9, which is a second principle schematic diagram of a two-dimensional virtual occluder provided in an embodiment of the present application. When the shape of the virtual occluder 91 is a rectangle and the two-dimensional target size includes the side length of the rectangle, an integer multiple of the length value is determined as the side length of the rectangle.
[0137] In some embodiments, when the shape of the virtual occluder is a rectangle, the two-dimensional target size includes the side length of the rectangle, which includes the length and width of the rectangle. The length and width of the rectangle may be equal or unequal. When the length of the rectangle is equal to the width of the rectangle, the third integer multiple of the length value may be determined as the length of the rectangle, and the fourth integer multiple of the length value may be determined as the width of the rectangle, with the third integer multiple being equal to the fourth integer multiple. When the length of the rectangle is not equal to the width of the rectangle, the fifth integer multiple of the length value may be determined as the length of the rectangle, and the sixth integer multiple of the length value may be determined as the height of the rectangle, with the fifth integer multiple being unequal to the sixth integer multiple.
[0138] In some embodiments, when the virtual occluder is a cube, the three-dimensional target size includes the length, height, and width of the cube.
[0139] In some embodiments, the above-mentioned determination of the three-dimensional target size of the virtual obstruction based on the length value can be achieved as follows: the first integer multiple of the length value of the target line segment is determined as the length of the cube, and the second integer multiple of the length value of the target line segment is determined as the width of the cube; the light intensity of the virtual light source is obtained, and the light intensity is divided by the reference light intensity, and the division result is determined as the target multiple of the length value of the target line segment; the length value of the target multiple is determined as the height of the cube.
[0140] In some embodiments, the greater the illumination intensity of the virtual light source, the larger the corresponding target multiple value, and the smaller the illumination intensity of the virtual light source, the smaller the corresponding target multiple value. The illumination intensity of the virtual light source is positively correlated with the corresponding target multiple value.
[0141] As an example, the expression for the target multiple of the length of the target line segment may be:
[0142] Wherein, B is used to indicate the target multiple of the length of the target line segment, G is used to indicate the illumination intensity of the virtual light source, and G1 is used to indicate the reference illumination intensity.
[0143] In this way, by setting the virtual occluder as a three-dimensional virtual occluder and setting the height of the three-dimensional virtual occluder to a height that is positively correlated with the light intensity of the virtual light source, the diffusely reflected virtual light generated by the virtual light of the virtual light source can be blocked by a three-dimensional virtual occluder of appropriate height, thereby effectively improving the blocking effect of the virtual occluder.
[0144] In step 104 , a virtual occluder with a target size is generated at a target position in the virtual scene.
[0145] In some embodiments, the virtual occluder is provided with at least one transparent channel arranged according to an arrangement rule.
[0146] In some embodiments, the arrangement rule refers to the position of the transparent channels on the virtual occluder. The arrangement rule can indicate the positional relationship between different transparent channels on the virtual occluder.
[0147] As an example, refer to Figure 10, which is a second schematic diagram of the principle of the virtual light processing method provided in an embodiment of the present application. As shown in Figure 10, the surface 50 of the virtual occluder is provided with transparent channels 51, transparent channels 52 and transparent channels 53 arranged according to arrangement rules. The above arrangement rules can be that transparent channel 51 is below transparent channel 52 and transparent channel 53, transparent channel 53 is to the left of transparent channel 52 and transparent channel 51, etc.
[0148] In some embodiments, referring to FIG. 6 , FIG. 6 is a fourth flow chart of a method for processing virtual light provided in an embodiment of the present application. Step 104 shown in FIG. 3 can be implemented by executing steps 1041 to 1044 shown in FIG. 6 .
[0149] In step 1041 , an initial virtual occluder of a target size is obtained.
[0150] In some embodiments, the size type of the above-mentioned target size includes a two-dimensional target size and a three-dimensional target size. When the size type of the target size is a two-dimensional target size, the initial virtual occluder is a two-dimensional virtual occluder. When the size type of the target size is a three-dimensional target size, the initial virtual occluder is a three-dimensional virtual occluder.
[0151] In some embodiments, the initial virtual occluder is used to block the virtual light, so that the virtual light cannot pass through the surfaces of the virtual occluder.
[0152] In some embodiments, the above step 1041 can be implemented as follows: obtain the size type of the target size; when the size type is a two-dimensional target size, create a two-dimensional virtual occluder of the two-dimensional target size, and the virtual light emitted by the virtual light source cannot pass through the two-dimensional virtual occluder; determine the two-dimensional virtual occluder as the initial virtual occluder; when the size type is a three-dimensional target size, create a three-dimensional virtual occluder of the three-dimensional target size, and the three-dimensional virtual occluder is a polyhedron with multiple surfaces, and the virtual light emitted by the virtual light source cannot pass through the surfaces of the polyhedron; set any one surface of the three-dimensional virtual occluder as a transparent surface to obtain an initial virtual occluder, and the virtual light emitted by the virtual light source can pass through the transparent surface.
[0153] For example, when the size type is a two-dimensional target size, a two-dimensional virtual occluder of a two-dimensional target size (eg, length 10, width 20) is created, and the virtual light emitted by the virtual light source cannot pass through the two-dimensional virtual occluder.
[0154] In some embodiments, a geometric solid formed by several planar polygons is called a polyhedron. The polygons that enclose the polyhedron are called faces of the polyhedron. The common edges of two faces are called edges of the polyhedron. The common vertices of several edges are called vertices of the polyhedron. If any face of a polyhedron is extended and all other faces are on the same side of the plane, the polyhedron is called a convex polyhedron. A polyhedron has at least four faces and is called a tetrahedron, pentahedron, hexahedron, etc., depending on the number of faces.
[0155] In some embodiments, the above-mentioned creation of a three-dimensional virtual occluder of a three-dimensional target size can be achieved by: in response to a selection operation on a polyhedron, determining a target number of faces in the polyhedron, and creating a target number of faces of a three-dimensional target size.
[0156] As an example, when the size type is a three-dimensional target size, a three-dimensional virtual occluder of the three-dimensional target size is created. The three-dimensional virtual occluder is a polyhedron with multiple surfaces, and the virtual light emitted by the virtual light source cannot pass through the surfaces of the polyhedron; any surface of the three-dimensional virtual occluder is set as a transparent surface to obtain an initial virtual occluder. The virtual light emitted by the virtual light source can pass through the transparent surface, but the virtual light emitted by the virtual light source cannot pass through other surfaces except the transparent surface.
[0157] As an example, refer to Figure 11, which is a schematic diagram of the effect of the three-dimensional virtual occluder provided in an embodiment of the present application. When the size type is a three-dimensional target size, a three-dimensional virtual occluder of the three-dimensional target size is created (such as a hexahedron as shown in Figure 11). The three-dimensional virtual occluder is a hexahedron with six surfaces. The virtual light emitted by the virtual light source cannot pass through the surface of the hexahedron. Any one surface of the three-dimensional virtual occluder is set as a transparent surface (for example, surface 41 is set as a transparent surface) to obtain an initial virtual occluder. Referring to the initial virtual occluder shown in Figure 11, surface 41 is a transparent surface, and surfaces 42, 43, 44, 45, and 46 are non-transparent surfaces. The virtual light emitted by the virtual light source can pass through the transparent surface 41, and the virtual light emitted by the virtual light source cannot pass through other surfaces (surfaces 42, 43, 44, 45, and 46) except the transparent surface.
[0158] In this way, any surface of the three-dimensional virtual occluder is set as a transparent surface to obtain an initial virtual occluder, so that the virtual light can enter the internal space of the three-dimensional virtual occluder through the transparent surface. Since the virtual light emitted by the virtual light source cannot pass through other surfaces except the transparent surface, the virtual light emitted by the virtual light source can be more effectively blocked, and other virtual light caused by the diffuse reflection of the virtual light can be effectively blocked, thereby effectively improving the light blocking effect of the virtual occluder.
[0159] In step 1042 , at least one transparent channel arranged according to an arrangement rule is set on the initial virtual occluder to obtain a virtual occluder.
[0160] As an example, referring to FIG. 10 , transparent channels 51 , 52 , and 53 arranged according to an arrangement rule are set on an initial virtual occluder 50 to obtain a virtual occluder.
[0161] In some embodiments, the above step 1042 can be implemented as follows: obtain a transparent channel map, the transparent channel map is used to indicate the arrangement rules of the transparent channels and the channel shape of each transparent channel, and the map size of the transparent channel map is adapted to the target size of the virtual occluder; according to the arrangement rules indicated by the transparent channel map, a transparent channel is set on the initial virtual occluder to obtain a virtual occluder.
[0162] In some embodiments, after the above step 1042, the virtual occluder can also be updated in the following manner: in response to the pattern update operation for the virtual occluder, an updated transparent channel map is obtained, the updated arrangement rule indicated by the updated transparent channel map is different from the arrangement rule indicated by the transparent channel map, and the virtual occluder is updated according to the arrangement rule indicated by the updated transparent channel to obtain an updated virtual occluder.
[0163] In some embodiments, the texture size of the transparent channel map is adapted to the target size of the virtual occluder, which means that the texture size of the transparent channel map is less than or equal to the target size of the virtual occluder, thereby ensuring that the texture size of the transparent channel map can fit into the initial virtual occluder.
[0164] As an example, referring to FIG10 , the arrangement rules of the transparent channels may be that the transparent channel 51 is below the transparent channel 52 and the transparent channel 53, the transparent channel 52 is to the left of the transparent channel 53, the transparent channel 52 is to the right of the transparent channel 51, and other relative positional relationships between different transparent channels. The channel shape of the transparent channel 51 is circular, the channel shape of the transparent channel 52 is elliptical, and the channel shape of the transparent channel 53 may be elliptical.
[0165] In some embodiments, when the initial virtual occluder is a two-dimensional virtual occluder, the above-mentioned transparent channel is set on the initial virtual occluder according to the arrangement rules indicated by the transparent channel map to obtain the virtual occluder. This can be achieved in the following way: the transparent channel map is arranged on the surface of the two-dimensional virtual occluder; the area on the surface of the two-dimensional virtual occluder that overlaps with the transparent channels of each channel shape in the transparent channel map is determined as the target area; each target area on the two-dimensional virtual occluder is set as a transparent area to obtain the virtual occluder, and the virtual light emitted by the virtual light source can pass through the transparent area.
[0166] As an example, refer to Figure 12, which is a schematic diagram of the principle of a two-dimensional virtual occluder provided in an embodiment of the present application. A transparent channel map 121 is arranged on the surface of a two-dimensional virtual occluder 122; the areas on the surface of the two-dimensional virtual occluder that coincide with the transparent channels of each channel shape in the transparent channel map 122 (areas 124, 125, and 126) are determined as target areas; each target area (area 124, area 125, and area 126) on the two-dimensional virtual occluder is set as a transparent area to obtain a virtual occluder 123, and the virtual light emitted by the virtual light source can pass through the transparent areas (areas 124, area 125, and area 126).
[0167] In other embodiments, when the initial virtual occluder is a three-dimensional virtual occluder, the three-dimensional virtual occluder is a polyhedron, and the polyhedron includes a transparent surface, the above-mentioned arrangement rules indicated by the transparent channel map are used to set a transparent channel on the initial virtual occluder to obtain a virtual occluder. This can be achieved in the following manner: the occluding surface farthest from the transparent surface in the three-dimensional virtual occluder is determined as the target occluding surface; the transparent channel map is arranged on the target occluding surface; the area on the target occluding surface that overlaps with the transparent channels of each channel shape in the transparent channel map is determined as the target area; each target area on the target occluding surface in the three-dimensional virtual occluder is set as a transparent area to obtain a virtual occluder, and the virtual light emitted by the virtual light source can pass through the transparent area.
[0168] As an example, refer to Figure 13, which is a schematic diagram of the principle of a three-dimensional virtual occluder provided in an embodiment of the present application. The occluding surface 64 in the three-dimensional virtual occluder, which is farthest from the transparent surface 61, is determined as the target occluding surface; the transparent channel map is arranged on the target occluding surface 64; the area on the target occluding surface 64 that overlaps with the transparent channels of each channel shape in the transparent channel map is determined as the target area; each target area (target area 641, target area 642 and target area 643) on the target occluding surface in the three-dimensional virtual occluder is set as a transparent area to obtain a virtual occluder, and the virtual light emitted by the virtual light source can pass through the transparent area.
[0169] In this way, when the initial virtual occluder is a three-dimensional virtual occluder, and the three-dimensional virtual occluder is a polyhedron, the occluding surface in the three-dimensional virtual occluder that is farthest from the transparent surface is determined as the target occluding surface; the transparent channel map is laid out on the target occluding surface; the area on the target occluding surface that overlaps with the transparent channels of each channel shape in the transparent channel map is determined as the target area; and each target area on the target occluding surface in the three-dimensional virtual occluder is set as a transparent area to obtain a virtual occluder, thereby allowing the virtual light emitted by the virtual light source to pass through the transparent area. In this way, after passing through the transparent surface, the virtual light can pass through the transparent area of the occluding surface farthest from the transparent surface, thereby forming a pattern in the virtual scene that meets the arrangement rules, thereby effectively improving the light display effect of the virtual light.
[0170] In step 1043 , a virtual occluder is set at a target position in the virtual scene.
[0171] In some embodiments, the geometric center point of the virtual occluder coincides with the target position.
[0172] In some embodiments, the above step 1043 may be implemented in the following manner: setting the collective center point of the virtual occluders at a position that coincides with the target position.
[0173] In step 1044 , the orientation of the virtual occluder at the target position is set to a direction opposite to the direction of the central virtual light.
[0174] In some embodiments, the direction of the central virtual light ray is the direction from the virtual light source to the corresponding virtual occluder. Therefore, the orientation of the virtual occluder at the target location is the direction from the virtual occluder to the virtual light source. If the virtual occluder is a two-dimensional virtual occluder, the orientation of the two-dimensional virtual occluder at the target location coincides with the normal direction of the plane on which the two-dimensional virtual occluder resides. If the virtual occluder is a three-dimensional virtual occluder, the orientation of the three-dimensional virtual occluder at the target location coincides with the normal direction of the plane on which the target surface of the three-dimensional virtual occluder resides.
[0175] As an example, referring to FIG9 , when the virtual occluder is a two-dimensional virtual occluder 91 , the orientation of the two-dimensional virtual occluder 91 at the target position coincides with the normal direction of the plane where the two-dimensional virtual occluder 91 is located, and is opposite to the direction of the central virtual light.
[0176] As an example, referring to FIG13 , when the virtual occluder is a three-dimensional virtual occluder, the orientation of the three-dimensional virtual occluder at the target position coincides with the normal direction of the plane where the target surface 64 of the three-dimensional virtual occluder is located.
[0177] In step 105 , the virtual light source is controlled to illuminate the virtual obstruction, so that the virtual light emitted by the virtual light source passes through the transparent channel and forms a pattern that meets the arrangement rule in the virtual scene.
[0178] In some embodiments, the virtual light source is controlled to illuminate the virtual obstruction at the target position, so that the virtual light emitted by the virtual light source can pass through the transparent channel on the virtual obstruction, but cannot pass through other areas of the virtual obstruction except the transparent channel, so that the virtual light passing through the transparent channel illuminates the corresponding position in the virtual scene. Different transparent channels can pass through the virtual light, so that the virtual light illuminates the corresponding position in the virtual scene. Since the transparent channels meet the arrangement rules, the positions of the virtual light passing through each transparent channel in the virtual scene also meet the arrangement rules. Therefore, by setting the arrangement rules, a lighting effect that meets the arrangement rules can be formed.
[0179] As an example, refer to Figure 14, which is a schematic diagram of the effect of the virtual light processing method provided by an embodiment of the present application. By controlling the virtual light source to illuminate the virtual obstruction at the target position, the virtual light emitted by the virtual light source can pass through the transparent channel on the virtual obstruction, but cannot pass through other areas on the virtual obstruction except the transparent channel, so that the virtual light 31 passing through the transparent channel illuminates the corresponding position in the virtual scene. Different transparent channels can pass through the virtual light, and the virtual light illuminates the corresponding position in the virtual scene. Since the transparent channels meet the arrangement rules, the positions of the virtual light passing through each transparent channel in the virtual scene also meet the arrangement rules, so that by setting the arrangement rules, a lighting effect 32 that meets the arrangement rules can be formed.
[0180] In this manner, by obtaining the light source position and light source parameters of a virtual light source, and based on the light source position and light source parameters, determining the target size of the virtual occluder, a virtual occluder of the target size is generated at the target location in the virtual scene, and the virtual light source is controlled to illuminate the virtual occluder so that the virtual light emitted by the virtual light source passes through the transparent channel, forming a pattern in the virtual scene that satisfies the arrangement rule. Thus, based on the physical parameters of the virtual scene, such as the light source position and light source parameters, the virtual occluder of the target size is placed at the target location in the virtual scene. Because the virtual occluder is provided with transparent channels arranged according to the arrangement rule, the virtual occluder placed at the target location can selectively block the virtual light, thereby forming a pattern in the virtual scene that satisfies the arrangement rule. Because the virtual occluder is based on the physical parameters of the virtual scene, the virtual occluder can meet the virtual light occlusion requirements. At the same time, the corresponding physical parameters of the virtual scene remain unchanged under different operating environments, making the virtual occluder adaptable to various operating environments, thereby effectively improving the universality of the operating environment for processing virtual light.
[0181] Below, an exemplary application of the embodiment of the present application in an actual virtual scene application scenario will be described.
[0182] Virtual production is gradually emerging, and the demand for virtual DMX lamps in virtual production is increasing accordingly, especially in virtual performances and virtual human businesses. Traditional virtual lamps use virtual projection based on lighting function to project patterns.
[0183] The virtual light processing method provided in the embodiments of this application can enable projection of graphics based entirely on the physical illumination of light in the Unreal Engine, and is applicable to all versions. By creating a static mesh component that matches the virtual light source's illumination angle and other properties, and placing a channeled image on the light-transmitting plane of the static mesh component, a static mesh component to be used is obtained. The static mesh component to be used is then placed directly in front of the virtual light source's illumination direction, so that light from the virtual light source can pass through each channel of the static mesh component to form a corresponding lighting effect.
[0184] In some embodiments, referring to FIG15 , FIG15 is a flowchart diagram 5 of the virtual light processing method provided in an embodiment of the present application. The virtual light processing method provided in an embodiment of the present application can be implemented through steps 201 to 209 shown in FIG15 .
[0185] In step 201, a model A (Mesh) is placed directly in front of the spotlight assembly in the DMX lamp.
[0186] In some embodiments, the spotlight assembly in the above-mentioned DMX lamp is also the virtual light source described above, the above-mentioned model A is also the virtual obstruction described above, and the above-mentioned front is also the target position described above. By generating a virtual obstruction with a target size at the target position in the virtual scene, a model A (Mesh) is placed directly in front of the spotlight assembly in the DMX lamp.
[0187] In step 202 , model A is set as a sub-level of the spotlight component.
[0188] In some embodiments, the model A is the virtual occluder described above. The virtual occluder is used to block the virtual light emitted by the virtual light source. The virtual light emitted by the virtual light source cannot pass through the blocking surface of the virtual occluder.
[0189] In step 203, the size of the model A is matched with the properties of the DMX lamp, such as the illumination angle, by real-time calculation of trigonometric functions.
[0190] In some embodiments, trigonometric functions are used in real time to determine model A (i.e., the target size of the virtual occluder) and obtain the target length between the target position and the light source position; the line connecting the target position and the light source position is determined as a reference line segment, and based on the boundary virtual light, a target line segment perpendicular to the reference line segment and intersecting with the boundary virtual light is determined; the length value of the target line segment is determined in combination with the illumination opening angle and the target length; and based on the length value, the target size of the virtual occluder is determined.
[0191] In some embodiments, the above-mentioned combination of the illumination opening angle and the target length to determine the length value of the target line segment can be achieved in the following manner: obtaining the angle between the boundary virtual light and the target line segment, and determining the cosine value of the angle; obtaining the cosine value of the illumination opening angle, and determining the ratio of the cosine value of the illumination opening angle to the cosine value of the angle; and determining the integer multiple of the product of the target length and the ratio as the length value of the target line segment.
[0192] In step 204 , a new material B1 is created and B1 is set to the material properties of model A.
[0193] In some embodiments, the above-mentioned material B1 is also the transparent channel map described above. When model A is a two-dimensional virtual occluder, the transparent channel map is arranged on the surface of the two-dimensional virtual occluder; the area on the surface of the two-dimensional virtual occluder that overlaps with the transparent channels of each channel shape in the transparent channel map is determined as the target area; each target area on the two-dimensional virtual occluder is set as a transparent area to obtain a virtual occluder, and the virtual light emitted by the virtual light source can pass through the transparent area.
[0194] In step 205, a new material B2 for replacing / rotating images is created.
[0195] In some embodiments, the material B2 and the material B1 refer to transparent channel maps with different channel arrangement rules.
[0196] In step 206 , the conversion / switching of the images may be controlled by a terminal or software having a DMX protocol.
[0197] In some embodiments, the switching of material B1 and material B2 can be controlled by a terminal or software with DMX protocol. DMX512 is a digital dimming protocol. It can be used to digitally control dimmers and other control equipment in places such as stages, theaters, and studios. It is suitable for a one-to-multipoint master-slave control system. Its interconnection form adopts a multi-point bus structure, and there is no problem of information path blocking. Its connection is simple and the reliability is high.
[0198] In step 207 , the material B2 is rendered as a channeled image C.
[0199] In step 208 , the rendered image C may be synchronously set to the Mask channel of the material B1 in the model A of the DMX lamp.
[0200] In some embodiments, a transparent channel is set on the initial virtual occluder according to the arrangement rules indicated by the transparent channel map, that is, the rendered image C can be synchronously set to the Mask channel in the material B1 in the model A of the DMX lamp to obtain a virtual occluder.
[0201] In step 209 , the light passes through the Mask channel of the material B1 in the model A to project the shape of the image C rendered by the material B2 into the target object or scene.
[0202] In some embodiments, the embodiments of the present application can be output as a UE plug-in, which includes a DMX virtual lamp class that inherits ADMXFixtureActor. The new DMX lamp class is newly added compared to the native DMX lamp. Static MeshComponent (static mesh component, named Gobo), and this component is assigned a material with a Mask channel to generate the physical projection of the light. A new RTMaterialInstance is added to set and switch pattern-like content, and render it as RenderTarget and save it in memory, for other functions that need to use pattern-like content to call. When the material of the static mesh component named Gobo calls RenderTarget, the virtual light will project a physical projection at the target location.
[0203] In some embodiments, referring to FIG. 16 , FIG. 16 is a flowchart diagram six of a method for processing virtual light provided in an embodiment of the present application. The production of virtual occluders can be achieved through steps 301 to 305 shown in FIG. 16 .
[0204] In step 301 , a cube is created in 3D modeling software.
[0205] As an example, see FIG17 , which is a schematic diagram illustrating the principles of a cube in the virtual light processing method provided in an embodiment of the present application. Cube 17 is created in 3D modeling software. For example, a regular cube is created in 3DMAX or MAYA 3D modeling software, with the dimensions set to 100 cm by 100 cm by 100 cm, and named Gobo.
[0206] In step 302 , the top surface of the cube is deleted, and the normal directions of the other faces are reversed.
[0207] As an example, refer to Figure 18, which is a schematic diagram of the principle of the virtual light processing method provided by the embodiment of the present application. Delete the upper surface 181 of the cube 18, and reverse the normal direction of the other faces. Delete the upper face of the cube and flip the normals of the remaining 5 faces. The reason for retaining the bottom face is that the embodiment of the present application will make a mask on the bottom face so that the light can be cast on it. The reason for retaining the side face is because this Mesh needs to be placed very close to the light source. In this case, if only one plane is used as a mask, there may be light leakage problems, so the side model is needed to block the possible light leakage problems.
[0208] In step 303, the UV of the bottom surface is set so that the UV of the bottom surface is fully covered, and the UV of other surfaces only needs to be set to a position of one pixel and no pattern content.
[0209] In some embodiments, the UV of the bottom surface is set so that the UV of the bottom surface is fully covered, and the UV of other surfaces only needs to be set to a pixel and a position where there will be no pattern content. The reason for doing this is that the embodiment of the present application only requires a mask on the bottom surface, and the side surface does not need and should not have a mask, otherwise the embodiment of the present application will use it to block the light leakage problem.
[0210] In step 304 , the cube is exported.
[0211] In some embodiments, the cube created in the 3D modeling software is exported and imported into a game engine for later use.
[0212] In step 305 , the exported cube is imported into a game engine for standby use.
[0213] In some embodiments, the imported model is placed directly in front of the illumination direction of the spotlight assembly in the DMX lamp, for example, the distance is set to 10, and the rotation value of the model A (Mesh) named Gobo (the corresponding target of the name of Gobo used below should be this model A (Mesh)) is set so that the normal direction of the bottom surface of Gobo is consistent with the direction of the light source.
[0214] The sine theorem formula is used to calculate the size of the Gobo in real time based on the straight-line distance between the Mesh and the light source and the illumination angle of the light. The size is then set to the Gobo's Scale3D property. This function is set because DMX lamps have a Zoom property and the illumination angle of the light will change. The Gobo in the embodiment of the present application needs to change its size in real time according to the change of Zoom so that the Gobo can always just block the illumination range of the light.
[0215] The law of sine formula is:
[0216] Among them, a is used to indicate the length of side a of the triangle, A is used to indicate the angle of angle BAC of the triangle, b is used to indicate the length of side b of the triangle, B is used to indicate the angle of angle ABC of the triangle, c is used to indicate the length of side c of the triangle, and C is used to indicate the angle of angle ACB of the triangle.
[0217] In some embodiments, the distance between the light source and the bottom of the Gobo is set to h=10 (because the embodiment of the present application has set the distance between the light source and the bottom of the Gobo to be 10). Since h is the height perpendicular to the bottom of the Gobo, the angle A between h and the bottom of the Gobo is 90°. At this time, according to the properties of the angle of the lamp itself, it can be known that the value of 1 / 2 of the Zoom of the lamp is B. Therefore, according to the characteristics of the right triangle, the angle of the third angle of this triangle is C=90-B. The above information combined with the sine theorem formula can be used to deduce the length formula of b: b=C*sinB / sinC=10*sinB / sin(90-B) (4)
[0218] Because in Unreal Engine, the unit of object scaling is meter (M), and because the embodiment of the present application uses 100cm when making the Mesh named Gobo, that is, the side length of Gobe is 1m, the embodiment of the present application needs to divide h by 100, so the final length formula of b should be: b=10 / 100*sinB / sin(90-B) (5)
[0219] Because the result b obtained here is only 1 / 2 of the range when the light is directly in front of the light at a distance h under a zoom value of 2B, the width of the Gobo should be 2b. Therefore, the final calculated result of b should be multiplied by 2 and then applied to the Scale3D property of the Gobo.
[0220] In some embodiments, referring to FIG19 , FIG19 is a flow chart seven of the method for processing virtual light provided in an embodiment of the present application. The production of pattern transformation material can be achieved through steps 401 to 407 shown in FIG19 , which will be described separately below.
[0221] In step 401, a material is created for switching / rotating patterns.
[0222] In some embodiments, the material created above is the initial virtual occluder described above. Through the created initial virtual occluder, a transparent channel is set on the initial virtual occluder according to the arrangement rules indicated by the transparent channel map, thereby obtaining a virtual occluder.
[0223] In step 402, the lighting model of the material is set to Unlit.
[0224] In some embodiments, this material of the present application embodiment does not need to receive light, so the Shading Mode type of this material is set to Unlit; create material logic, scale and translate the pattern UV according to the number of patterns and the currently selected pattern index, and obtain the final texture sampling.
[0225] In step 403, the UV of the pattern is scaled and translated according to the number of patterns and the currently selected pattern index to obtain the final texture sampling.
[0226] In step 404, a dynamic material instance is created using this material.
[0227] In some embodiments, a RenderTarget named RT is created. A dynamic material instance named Mat_RT_Inst is created based on the Mat_RT material. The dynamic material instance Mat_RT_Inst is rendered to RT and stored in memory. RT is assigned to the Texture property of the material used by objects such as Gobos, Spotlighting, and Beams that need to render patterns. It is possible to switch between two or more patterns simultaneously, creating a pattern overlay effect. The following demonstrates this pattern overlay effect.
[0228] In step 405 , a render target is created.
[0229] In step 406 , the rendering result of the dynamic material instance is saved to the rendering target and stored in memory.
[0230] In step 407, the rendering target obtained in the previous step is assigned to the corresponding attribute channel of the material of the object or component that needs to use the pattern content, such as Gobo.
[0231] In this way, the Mask projection method is used, which allows the projection of graphics to be completely based on the physical illumination method of the light in the Unreal Engine. It is applicable to all versions and can be used to present multi-pattern overlay effects, such as the double pattern disk effect of a stage moving head light.
[0232] In this manner, by obtaining the light source position and light source parameters of a virtual light source, and based on the light source position and light source parameters, determining the target size of the virtual occluder, a virtual occluder of the target size is generated at the target location in the virtual scene, and the virtual light source is controlled to illuminate the virtual occluder so that the virtual light emitted by the virtual light source passes through the transparent channel, forming a pattern in the virtual scene that satisfies the arrangement rule. Thus, based on the physical parameters of the virtual scene, such as the light source position and light source parameters, the virtual occluder of the target size is placed at the target location in the virtual scene. Because the virtual occluder is provided with transparent channels arranged according to the arrangement rule, the virtual occluder placed at the target location can selectively block the virtual light, thereby forming a pattern in the virtual scene that satisfies the arrangement rule. Because the virtual occluder is based on the physical parameters of the virtual scene, the virtual occluder can meet the virtual light occlusion requirements. At the same time, the corresponding physical parameters of the virtual scene remain unchanged under different operating environments, making the virtual occluder adaptable to various operating environments, thereby effectively improving the universality of the operating environment for processing virtual light.
[0233] It is understandable that in the embodiments of this application, when data related to virtual light is applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0234] The following continues to describe an exemplary structure of the virtual light processing device 455 provided as a software module. In some embodiments, as shown in FIG2 , the software modules in the virtual light processing device 455 stored in the memory 450 may include: an acquisition module 4551, configured to acquire the light source position of the virtual light source used to form the virtual light in the virtual scene, and the light source parameters of the virtual light source; a position determination module 4552, configured to determine the target position in the virtual scene based on the light source position, wherein the line connecting the target position and the virtual light source coincides with the central virtual light, and the central virtual light is the central virtual light among the multiple virtual light rays emitted by the virtual light source. line; a size determination module 4553, configured to determine the target size of the virtual occluder in combination with the light source parameters and the target position, the virtual occluder being used to block the virtual light emitted by the virtual light source; a generation module 4554, configured to generate the virtual occluder with the target size at the target position in the virtual scene, the virtual occluder being provided with at least one transparent channel arranged according to an arrangement rule; a control module 4555, configured to control the virtual light source to illuminate the virtual occluder so that the virtual light emitted by the virtual light source passes through the transparent channel and forms a graphic satisfying the arrangement rule in the virtual scene.
[0235] In some embodiments, the above-mentioned position determination module is also configured to obtain multiple virtual light rays emitted by the virtual light source, and a target length, where the target length is smaller than the length of the central virtual light ray; determine the central virtual light ray from the multiple virtual light rays, and determine the position on the central virtual light ray where the distance between the central virtual light ray and the light source position is equal to the target length as the target position.
[0236] In some embodiments, the light source parameters include the illumination opening angle of the virtual light source, and the illumination opening angle is used to indicate the angle between the boundary virtual light emitted by the virtual light source and the center virtual light; the above-mentioned size determination module is also configured to obtain the target length between the target position and the light source position; the line connecting the target position and the light source position is determined as a reference line segment, and based on the boundary virtual light, a target line segment perpendicular to the reference line segment and intersecting with the boundary virtual light is determined; the length value of the target line segment is determined in combination with the illumination opening angle and the target length; based on the length value, the target size of the virtual occluder is determined.
[0237] In some embodiments, the size determination module is further configured to obtain a target line perpendicular to the reference line segment, and determine the intersection of the boundary virtual light and the target line; and determine the line segment between the intersection on the target line and the target position as the target line segment.
[0238] In some embodiments, the size determination module is further configured to obtain the angle between the boundary virtual light and the target line segment, and determine the cosine value of the angle; obtain the cosine value of the illumination opening angle, and determine the ratio of the cosine value of the illumination opening angle to the cosine value of the angle; and determine an integer multiple of the product of the target length and the ratio as the length value of the target line segment.
[0239] In some embodiments, the target size includes a two-dimensional target size or a three-dimensional target size; the above-mentioned size determination module is further configured to determine the dimension of the virtual occluder in response to a dimension selection operation for the virtual occluder; when the dimension of the virtual occluder is two-dimensional, the two-dimensional target size of the virtual occluder is determined based on the length value; when the dimension of the virtual occluder is three-dimensional, the three-dimensional target size of the virtual occluder is determined based on the length value.
[0240] In some embodiments, the above-mentioned size determination module is further configured to determine the shape of the virtual occluder in response to a shape selection operation for the virtual occluder; when the shape of the virtual occluder is a circle and the two-dimensional target size includes the radius of the circle, the length value is determined as the radius of the circle; when the shape of the virtual occluder is a rectangle and the two-dimensional target size includes the side length of the rectangle, the integer multiple of the length value is determined as the side length of the rectangle.
[0241] In some embodiments, when the virtual occluder is a cube, the three-dimensional target size includes the length, height and width of the cube. The above-mentioned size determination module is also configured to determine the first integer multiple of the length value of the target line segment as the length of the cube, and determine the second integer multiple of the length value of the target line segment as the width of the cube; obtain the light intensity of the virtual light source, and divide the light intensity by the reference light intensity, and determine the division result as the target multiple of the length value of the target line segment; determine the length value of the target multiple as the height of the cube.
[0242] In some embodiments, the above-mentioned generation module is further configured to obtain an initial virtual occluder of the target size, and set at least one transparent channel arranged according to the arrangement rule on the initial virtual occluder to obtain the virtual occluder; set the virtual occluder at the target position in the virtual scene, and the geometric center point of the virtual occluder coincides with the target position; set the orientation of the virtual occluder at the target position to a direction opposite to the direction of the central virtual light.
[0243] In some embodiments, the above-mentioned generation module is further configured to obtain the size type of the target size; when the size type is a two-dimensional target size, create a two-dimensional virtual occluder of the two-dimensional target size, and the virtual light emitted by the virtual light source cannot pass through the two-dimensional virtual occluder; determine the two-dimensional virtual occluder as the initial virtual occluder; when the size type is a three-dimensional target size, create a three-dimensional virtual occluder of the three-dimensional target size, and the three-dimensional virtual occluder is a polyhedron with multiple surfaces, and the virtual light emitted by the virtual light source cannot pass through each of the surfaces of the polyhedron; set any one of the surfaces of the three-dimensional virtual occluder as a transparent surface to obtain the initial virtual occluder, and the virtual light emitted by the virtual light source can pass through the transparent surface.
[0244] In some embodiments, the above-mentioned generation module is further configured to obtain a transparent channel map, wherein the transparent channel map is used to indicate the arrangement rules of the transparent channels and the channel shape of each transparent channel, and the map size of the transparent channel map is adapted to the target size of the virtual occluder; according to the arrangement rules indicated by the transparent channel map, the transparent channel is set on the initial virtual occluder to obtain the virtual occluder.
[0245] In some embodiments, when the initial virtual occluder is a two-dimensional virtual occluder, the above-mentioned generation module is further configured to layout the transparent channel map on the surface of the two-dimensional virtual occluder; determine the area on the surface of the two-dimensional virtual occluder that overlaps with the transparent channel of each channel shape in the transparent channel map as the target area; set each target area on the two-dimensional virtual occluder as a transparent area to obtain the virtual occluder, and the virtual light emitted by the virtual light source can pass through the transparent area.
[0246] In some embodiments, when the initial virtual occluder is a three-dimensional virtual occluder, the three-dimensional virtual occluder is a polyhedron, and the polyhedron includes a transparent surface, the above-mentioned generation module is further configured to determine the occluding surface in the three-dimensional virtual occluder that is farthest from the transparent surface as the target occluding surface; layout the transparent channel map on the target occluding surface; determine the area on the target occluding surface that overlaps with the transparent channel of each channel shape in the transparent channel map as the target area; set each target area on the target occluding surface in the three-dimensional virtual occluder as a transparent area, and obtain the virtual occluder, and the virtual light emitted by the virtual light source can pass through the transparent area.
[0247] A computer program product is provided, comprising a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the aforementioned virtual light processing method.
[0248] A computer-readable storage medium storing computer-executable instructions is provided, wherein the computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will execute a provided virtual light processing method, for example, the virtual light processing method shown in FIG. 3 .
[0249] In some embodiments, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disk, or a CD-ROM; or it may be various electronic devices including one or any combination of the above memories.
[0250] In some embodiments, computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0251] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).
[0252] By way of example, computer-executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.
[0253] In summary, the invention has the following beneficial effects:
[0254] (1) By obtaining the light source position and light source parameters of the virtual light source, and based on the light source position and light source parameters, determining the target size of the virtual occluder, generating a virtual occluder with the target size at the target position in the virtual scene, and controlling the virtual light source to illuminate the virtual occluder, so that the virtual light emitted by the virtual light source passes through the transparent channel, forming a graphic that meets the arrangement rule in the virtual scene. In this way, the virtual occluder of the target size is placed at the target position in the virtual scene by using the physical parameters of the virtual scene such as the light source position and light source parameters in the virtual scene. Since the virtual occluder is provided with a transparent channel arranged according to the arrangement rule, the virtual occluder placed at the target position can selectively block the virtual light, so as to form a graphic that meets the arrangement rule in the virtual scene. Since the placed virtual occluder can meet the occlusion requirements of the virtual light, and at the same time, the corresponding physical parameters of the virtual scene are unchanged under different operating environments, the placed virtual occluder can be applied to various operating environments, thereby effectively improving the universality of the operating environment for processing virtual light.
[0255] (2) By setting the virtual occluder as a three-dimensional virtual occluder and setting the height of the three-dimensional virtual occluder to a height that is positively correlated with the illumination intensity of the virtual light source, the diffusely reflected virtual light generated by the virtual light of the virtual light source can be blocked by the three-dimensional virtual occluder of appropriate height, thereby effectively improving the occlusion effect of the virtual occluder.
[0256] (3) When the dimension of the selected virtual occluder is three-dimensional, the corresponding virtual occluder is a three-dimensional virtual occluder. Since the three-dimensional virtual occluder occupies a larger memory space in the virtual scene, but the three-dimensional virtual occluder has more sides than the two-dimensional virtual occluder, it can more effectively block the virtual light emitted by the virtual light source and effectively block other virtual light caused by the diffuse reflection of the virtual light, thereby effectively improving the light blocking effect of the virtual occluder.
[0257] (4) When the dimension of the selected virtual occluder is two-dimensional, the corresponding virtual occluder is a two-dimensional virtual occluder. Since the memory space occupied by the two-dimensional virtual occluder in the virtual scene is smaller than that of the three-dimensional virtual occluder (when the bottom area of the three-dimensional virtual occluder is equal to the area of the two-dimensional virtual occluder), selecting the two-dimensional virtual occluder to block the virtual light emitted by the virtual light source can significantly reduce the memory space occupied by the virtual scene and effectively improve the processing efficiency of the virtual light.
[0258] (5) By determining the target position in the virtual scene based on the position of the light source, it is convenient to set a virtual occluder at the target position later so that the virtual occluder blocks the virtual light emitted by the virtual light source. By setting physical occlusion in the virtual scene, it can be applied to various application scenarios and effectively improve the scene universality of processing virtual light.
[0259] (6) The Mask projection method is used, which can make the projection of graphics completely based on the physical illumination method of the light in the Unreal Engine. It is applicable to all versions and can be used to present multiple pattern overlay effects, such as the effect of double pattern plates of stage moving head lights.
[0260] (7) Any surface of the three-dimensional virtual occluder is set as a transparent surface to obtain an initial virtual occluder, so that the virtual light can enter the internal space of the three-dimensional virtual occluder through the transparent surface. Since the virtual light emitted by the virtual light source cannot pass through other surfaces except the transparent surface, the virtual light emitted by the virtual light source can be more effectively blocked, and other virtual light caused by the diffuse reflection of the virtual light can be effectively blocked, thereby effectively improving the light blocking effect of the virtual occluder.
[0261] (8) When the initial virtual occluder is a three-dimensional virtual occluder, and the three-dimensional virtual occluder is a polyhedron, the occluding surface in the three-dimensional virtual occluder that is farthest from the transparent surface is determined as the target occluding surface; the transparent channel map is laid out on the target occluding surface; the area on the target occluding surface that overlaps with the transparent channels of each channel shape in the transparent channel map is determined as the target area; each target area on the target occluding surface in the three-dimensional virtual occluder is set as a transparent area, thereby obtaining a virtual occluder, so that the virtual light emitted by the virtual light source can pass through the transparent area. In this way, after passing through the transparent surface, the virtual light can pass through the transparent area of the occluding surface that is farthest from the transparent surface, thereby forming a pattern that meets the arrangement rule in the virtual scene, thereby effectively improving the light display effect of the virtual light.
[0262] (9) By controlling the virtual light source to illuminate the virtual occluder at the target position, the virtual light emitted by the virtual light source can pass through the transparent channel on the virtual occluder, but cannot pass through other areas of the virtual occluder except the transparent channel, so that the virtual light passing through the transparent channel illuminates the corresponding position in the virtual scene. Different transparent channels can pass through the virtual light, so that the virtual light illuminates the corresponding position in the virtual scene. Since the transparent channels meet the arrangement rules, the positions of the virtual light passing through each transparent channel in the virtual scene also meet the arrangement rules. Therefore, by setting the arrangement rules, a lighting effect that meets the arrangement rules can be formed.
[0263] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.
Claims
1. A method for processing virtual light, the method comprising: Acquire a light source position of a virtual light source used to form a virtual light ray in a virtual scene, and light source parameters of the virtual light source; Based on the light source position, determining a target position in the virtual scene, wherein a line connecting the target position and the virtual light source coincides with a central virtual light ray, and the central virtual light ray is a central virtual light ray among multiple virtual light rays emitted by the virtual light source; Determining a target size of a virtual occluder in combination with the light source parameters and the target position, wherein the virtual occluder is used to block the virtual light emitted by the virtual light source; At the target position in the virtual scene, generating the virtual occluder having the target size, wherein the virtual occluder is provided with at least one transparent channel arranged according to an arrangement rule; The virtual light source is controlled to illuminate the virtual obstruction, so that the virtual light emitted by the virtual light source passes through the transparent channel and forms a pattern satisfying the arrangement rule in the virtual scene.
2. The method according to claim 1, wherein: The step of determining the target position in the virtual scene based on the light source position includes: Acquire multiple virtual light rays emitted by the virtual light source and a target length, wherein the target length is less than the length of the central virtual light ray; The central virtual light ray is determined from the multiple virtual light rays, and the position on the central virtual light ray where the distance to the light source position is equal to the target length is determined as the target position.
3. The method according to any one of claims 1 to 2, wherein: The light source parameters include an illumination opening angle of the virtual light source, and the illumination opening angle is used to indicate an angle between a boundary virtual light emitted by the virtual light source and the center virtual light; The determining the target size of the virtual occluder by combining the light source parameters and the target position includes: Acquire a target length between the target position and the light source position; Determine a line connecting the target position and the light source position as a reference line segment, and determine a target line segment perpendicular to the reference line segment and intersecting with the boundary virtual light ray based on the boundary virtual light ray; Determine the length value of the target line segment by combining the illumination opening angle and the target length; Based on the length value, a target size of the virtual occluder is determined.
4. The method according to any one of claims 1 to 3, wherein: The step of determining, based on the boundary virtual light, a target line segment that is perpendicular to the reference line segment and intersects the boundary virtual light includes: Acquire a target line perpendicular to the reference line segment, and determine an intersection point between the boundary virtual light ray and the target line; The line segment between the intersection point on the target line and the target position is determined as the target line segment.
5. The method according to any one of claims 1 to 3, wherein: The step of determining the length value of the target line segment by combining the illumination opening angle and the target length includes: Obtaining the angle between the boundary virtual light and the target line segment, and determining the cosine value of the angle; Obtaining a cosine value of the illumination opening angle, and determining a ratio of the cosine value of the illumination opening angle to the cosine value of the included angle; An integer multiple of the product of the target length and the ratio is determined as the length value of the target line segment.
6. The method according to any one of claims 1 to 3, wherein: The target size includes a two-dimensional target size or a three-dimensional target size; The determining, based on the length value, a target size of the virtual occluder includes: In response to a dimension selection operation for the virtual occluder, determining a dimension of the virtual occluder; When the dimension of the virtual occluder is two-dimensional, determining a two-dimensional target size of the virtual occluder based on the length value; When the dimension of the virtual occluder is three-dimensional, based on the length value, determine the three-dimensional target of the virtual occluder size.
7. The method according to any one of claims 1 to 6, wherein: The determining, based on the length value, a two-dimensional target size of the virtual occluder includes: In response to a shape selection operation for the virtual occluder, determining a shape of the virtual occluder; When the shape of the virtual occluder is a circle and the two-dimensional target size includes the radius of the circle, determining the length value as the radius of the circle; When the shape of the virtual occluder is a rectangle and the two-dimensional target size includes the side length of the rectangle, an integer multiple of the length value is determined as the side length of the rectangle.
8. The method according to any one of claims 1 to 6, wherein: When the virtual occluder is a cube, the three-dimensional target size includes the length, height and width of the cube, and determining the three-dimensional target size of the virtual occluder based on the length value includes: Determine a first integer multiple of the length of the target line segment as the length of the cube, and determine a second integer multiple of the length of the target line segment as the width of the cube; Acquire the illumination intensity of the virtual light source, and divide the illumination intensity by a reference illumination intensity, and determine the division result as a target multiple of the length value of the target line segment; The length value of the target multiple is determined as the height of the cube.
9. The method according to any one of claims 1 to 8, wherein: Generating the virtual occluder having the target size at the target position in the virtual scene includes: Acquire an initial virtual occluder of the target size, and set at least one transparent channel arranged according to the arrangement rule on the initial virtual occluder to obtain the virtual occluder; Setting the virtual occluder at the target position in the virtual scene, so that the geometric center point of the virtual occluder coincides with the target position; The direction of the virtual occluder at the target position is set to be opposite to the direction of the central virtual light.
10. The method according to any one of claims 1 to 9, wherein: The obtaining of the initial virtual occluder of the target size includes: Get the size type of the target size; When the size type is a two-dimensional target size, creating a two-dimensional virtual occluder of the two-dimensional target size, and the virtual light emitted by the virtual light source cannot pass through the two-dimensional virtual occluder; Determining the two-dimensional virtual occluder as the initial virtual occluder; When the size type is a three-dimensional target size, creating a three-dimensional virtual occluder of the three-dimensional target size, wherein the three-dimensional virtual occluder is a polyhedron having multiple surfaces, and the virtual light emitted by the virtual light source cannot pass through each of the surfaces of the polyhedron; The initial virtual occluder is obtained by setting any one of the surfaces of the three-dimensional virtual occluder as a transparent surface, and the virtual light emitted by the virtual light source can pass through the transparent surface.
11. The method according to any one of claims 1 to 9, wherein: The step of setting at least one transparent channel arranged according to the arrangement rule on the initial virtual occluder to obtain the virtual occluder comprises: Acquire a transparent channel map, wherein the transparent channel map is used to indicate the arrangement rule of the transparent channels and the channel shape of each transparent channel, and the map size of the transparent channel map is adapted to the target size of the virtual occluder; According to the arrangement rule indicated by the transparent channel map, the transparent channel is set on the initial virtual occluder to obtain the virtual occluder.
12. The method according to any one of claims 1 to 11, wherein: When the initial virtual occluder is a two-dimensional virtual occluder, setting the transparent channel on the initial virtual occluder according to the arrangement rule indicated by the transparent channel map to obtain the virtual occluder includes: Arranging the transparent channel map on the surface of the two-dimensional virtual occluder; The surface of the two-dimensional virtual occluder is aligned with the transparent channel shape of each channel in the transparent channel map. The area where the channels overlap is determined as the target area; The virtual occluder is obtained by setting each target area on the two-dimensional virtual occluder as a transparent area, and the virtual light emitted by the virtual light source can pass through the transparent area.
13. The method according to any one of claims 1 to 11, wherein: When the initial virtual occluder is a three-dimensional virtual occluder, the three-dimensional virtual occluder is a polyhedron, and the polyhedron includes a transparent surface, setting the transparent channel on the initial virtual occluder according to the arrangement rule indicated by the transparent channel map to obtain the virtual occluder includes: Determine the occluding surface, which is the farthest from the transparent surface in the three-dimensional virtual occluding object, as the target occluding surface; Laying out the transparent channel map on the target occlusion surface; Determine an area on the target occlusion surface that overlaps with the transparent channel of each channel shape in the transparent channel map as a target area; The target areas on the target occluding surface in the three-dimensional virtual occluding object are set as transparent areas to obtain the virtual occluding object, and the virtual light emitted by the virtual light source can pass through the transparent areas.
14. A virtual light processing device, the device comprising: An acquisition module, configured to acquire a light source position of a virtual light source used to form a virtual light ray in a virtual scene, and light source parameters of the virtual light source; a position determination module, configured to determine a target position in the virtual scene based on the position of the light source, wherein a line connecting the target position and the virtual light source coincides with a central virtual light ray, and the central virtual light ray is a central virtual light ray among a plurality of virtual light rays emitted by the virtual light source; a size determination module configured to determine a target size of a virtual occluder in combination with the light source parameters and the target position, wherein the virtual occluder is used to block the virtual light emitted by the virtual light source; A generating module, configured to generate the virtual occluder having the target size at the target position in the virtual scene, wherein the virtual occluder is provided with at least one transparent channel arranged according to an arrangement rule; The control module is configured to control the virtual light source to illuminate the virtual obstruction, so that the virtual light emitted by the virtual light source passes through the transparent channel and forms a pattern that meets the arrangement rule in the virtual scene.
15. An electronic device, comprising: a memory configured to store computer executable instructions or computer programs; The processor is configured to implement the virtual light processing method according to any one of claims 1 to 13 when executing the computer executable instructions or computer programs stored in the memory.
16. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the virtual light processing method according to any one of claims 1 to 13.
17. A computer program product, comprising a computer program or a computer executable instruction, wherein the computer program or the computer executable instruction, when executed by a processor, implements the virtual light processing method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Illumination rendering method and device, computer equipment and storage medium
CN112927341A
Illumination map data generation method, device and equipment, medium and program product
CN114299220A
Shadow generation method and device of model, equipment and medium
CN115375828A
Virtual light processing method and device, equipment, storage medium and program product
CN116597069A
Perspective based green screening
US11245889B1
