Method, device and computer equipment for processing lighting effects of trees in billboards

By building a tree grid in the billboard and converting normals between the cut space and the world space, and calculating lighting parameters based on the target perspective, the problem of fixed tree lighting effects is solved, and the natural and real display of tree lighting effects is achieved.

CN114419232BActive Publication Date: 2025-09-02BEIJING PIXEL SOFTWARE TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111643467.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-09-02
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

When the existing billboard is made, the lighting effect of the tree cannot naturally fit the real display with the change of viewing angle, resulting in the fixed lighting effect and the real and natural effects of the tree cannot be expressed.

Method used

Build a tree-shaped mesh corresponding to the trees in the billboard, transfer the normal of the tree-shaped mesh in the cut space to the world space, and rotate the normal according to the target viewing angle, calculate the target lighting parameters, and control the tree to display the corresponding lighting effect.

Benefits of technology

The lighting effect of trees in the billboard is realized and the natural and realistic display is displayed with the change of viewing angle, enhancing the visual authenticity of trees.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114419232B_ABST
    Figure CN114419232B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, and computer equipment for processing the lighting effects of trees on a billboard. The method pre-constructs a tree mesh corresponding to the trees on the billboard, transfers the normals of the tree mesh in tangent space to world space, and then offsets and stretches the vertices and connected areas of the tree mesh to correspond to the trees. Next, based on the target viewing angle for displaying the lighting effect, the normals of the tree mesh are rotated and stretched to a position corresponding to the target viewing angle. The target lighting parameters of the tree mesh at the target viewing angle can then be calculated based on the rotated normals. By determining the target lighting parameters corresponding to the target viewing angle during the rotation process, controlling the display of the lighting effects corresponding to the target lighting parameters allows the trees on the billboard to exhibit natural, realistic lighting effects that change with viewing angles.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular to a method, device, and computer equipment for processing the lighting effects of trees on a billboard. Background Art

[0002] Existing billboards typically use a rectangular grid that corresponds to the entire billboard. This grid has only one diffuse texture representing its color, and the normals of the grid can only calculate lighting in a fixed direction. Since the billboard's display angle rotates continuously, a fixed normal is typically used when calculating lighting and other display parameters. This results in fixed lighting effects on trees within the billboard during rotation, failing to achieve a realistic, natural display of the trees. Summary of the Invention

[0003] In order to solve the above technical problems, the embodiments of the present application provide a method, device and computer equipment for processing the lighting effects of trees in a billboard.

[0004] In a first aspect, an embodiment of the present application provides a method for processing the lighting effect of trees in a billboard, the method comprising:

[0005] Construct tree grids corresponding to the trees in the billboard;

[0006] Transferring the normal of the tree mesh in tangent space to world space;

[0007] offset and stretch the vertices of the tree mesh and its connected areas according to the initial positions of the vertices of the tree mesh in the world space;

[0008] Rotating the normal of the tree mesh to a direction corresponding to the target viewing angle of the billboard in the world space, and calculating target lighting parameters of the tree mesh based on the rotated normal;

[0009] When the billboard is at the target viewing angle, the trees are controlled to display the lighting effects corresponding to the target lighting parameters.

[0010] According to a specific embodiment of the present application, the step of transferring the normal of the tree mesh in the tangent space to the world space includes:

[0011] Constructing a tangent space corresponding to the tree grid;

[0012] storing coordinate data of each normal of the tree mesh using a first data type in the tangent space;

[0013] Each normal in the tangent space is converted to the world space according to the coordinate data of each normal.

[0014] According to a specific embodiment of the present application, the step of rotating the normal of the tree grid in the world space to a direction corresponding to the target viewing angle of the billboard includes:

[0015] Normalizing the direction data of the target perspective in the world space;

[0016] Using a second data type to store the tangent data of the tangent space, the normal data of the target view in the tangent space, and the coordinate data of the target view in the tangent space;

[0017] The tangent data of the tangent space, the normal data of the target view in the tangent space, and the coordinate data of the target view in the tangent space are adjusted so that the normal is rotated to a direction corresponding to the target view of the billboard.

[0018] According to a specific embodiment of the present application, the first data type is Float3; and / or,

[0019] The second data type is Half3.

[0020] According to a specific embodiment of the present application, the step of storing the coordinate data of each normal of the tree mesh using the first data type in the tangent space includes:

[0021] The coordinate data of each normal is stored according to the formula float3x3 TBN=float3x3(float3(0,1,0),float3(1,0,0),float3(0,0,1)).

[0022] The step of converting each normal in the tangent space to the world space according to the coordinate data of each normal includes:

[0023] According to the formula tangentNormal=TransformWorldToTangent(worldnormal, TBN), and the formula tangentNormal*0.5+0.5, each normal is mapped to the world space, where tangentNormal is the tangent space normal, TBN is the tangent space, World is the world space, and Worldnormal is the world space normal.

[0024] According to a specific embodiment of the present application, the step of normalizing the direction data of the target perspective in the world space includes:

[0025] Normalize the direction data of the target view in the world space according to the formula cameraVectorWS=normalize(cameraVectorWS*float3(1,0,1)), where cameraVectorWS represents the direction data of the target view and normalize is a normalization function;

[0026] The storage formula of the tangent data in the tangent space is half3 T=half3(0, 1, 0), the storage formula of the normal data of the target view in the tangent space is half3 N=cameraVectorWS, and the coordinate data of the target view in the tangent space is half3 B=cross(N, T)*-1.0;

[0027] The step of adjusting the tangent data of the tangent space, the normal data of the target view in the tangent space, and the coordinate data of the target view in the tangent space so that the normal is rotated to a direction corresponding to the target view of the billboard includes:

[0028] The tangent data, normal data of the tangent space and the coordinate data of the target viewing angle are adjusted according to the formula Worldnormal=mul(tangentNormal, half3x3(T, B, N)).

[0029] According to a specific embodiment of the present application, the step of offsetting and stretching the vertices of the tree mesh and the connected areas thereof according to the initial positions of the vertices of the tree mesh in the world space includes:

[0030] Determine the target position of each vertex and each point in its connected domain according to the formula VertexPosition = abs(UV.x-0.5)*OffsetBase;

[0031] Each vertex and each point in its connected domain is offset and stretched from its initial position to the corresponding target position;

[0032] VertexPosition represents the target position, UV.x represents the initial position, abs(UV.x-0.5) represents the lateral offset distance of each point from the center line of the tree grid, and OffsetBase represents the offset base.

[0033] In a second aspect, an embodiment of the present application provides a device for processing lighting effects of trees in a billboard, the device comprising:

[0034] A construction module, used to construct the tree grid corresponding to the trees in the billboard;

[0035] A transfer module, configured to transfer the normal of the tree mesh in the tangent space to the world space;

[0036] a stretching module, configured to offset and stretch the vertices of the tree mesh and its connected areas according to the initial positions of the vertices of the tree mesh in the world space;

[0037] a calculation module, configured to rotate the normal of the tree grid to a direction corresponding to the target viewing angle of the billboard in the world space, and calculate target lighting parameters of the tree grid based on the rotated normal;

[0038] The display module is configured to control the trees to display lighting effects corresponding to the target lighting parameters when the billboard is in the target viewing angle.

[0039] In a third aspect, an embodiment of the present application provides a computer device including a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is run by the processor, the method for processing the lighting effect of trees in the billboard provided in the first aspect is executed.

[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed on a processor, executes the method for processing the lighting effect of trees in a billboard provided in the first aspect.

[0041] The method, device, and computer equipment for processing the lighting effects of trees on a billboard provided by the present application pre-construct a tree mesh corresponding to the trees on the billboard. The normals of the tree mesh in the tangent space are transferred to the world space, and then the vertices and connected areas of the tree mesh are offset and stretched to correspond to the trees. Next, based on the target viewing angle for displaying the lighting effect, the normals of the tree mesh are rotated and stretched to the position corresponding to the target viewing angle. The target lighting parameters of the tree mesh at the target viewing angle can then be calculated based on the rotated normals. By determining the target lighting parameters corresponding to the target viewing angle during the rotation process, controlling the display of the lighting effects corresponding to the target lighting parameters can allow the trees on the billboard to present natural, realistic lighting effects that change with the angle. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solution of this application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of this application and should not be regarded as limiting the scope of protection of this application. In each of the drawings, similar components are numbered similarly.

[0043] Figure 1 A schematic diagram illustrating the processing of the lighting effect of trees in a billboard provided by an embodiment of the present application is shown;

[0044] Figure 2 A schematic diagram showing the structure of a tree grid under different stretching conditions involved in the method for processing the lighting effect of trees in a billboard provided by an embodiment of the present application is shown;

[0045] Figure 3 A schematic diagram showing the display effect of a tree grid involved in the method for processing the lighting effect of trees in a billboard provided by an embodiment of the present application is shown;

[0046] Figure 4 A schematic diagram showing the lighting effects of trees under different lighting directions involved in the method for processing the lighting effects of trees in a billboard provided by an embodiment of the present application is shown;

[0047] Figure 5 A schematic diagram showing the structure of a device for processing lighting effects of trees in a billboard provided by an embodiment of the present application is shown;

[0048] Figure 6 A structural diagram of a computer device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0049] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments.

[0050] The components of the embodiments of the present application generally described and illustrated in the drawings herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed application, but rather merely represents selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative effort are within the scope of protection of the present application.

[0051] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present application, are intended only to indicate specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items or the possibility of adding one or more features, numbers, steps, operations, elements, components or combinations of the foregoing items.

[0052] Furthermore, the terms “first,” “second,” “third,” etc., are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.

[0053] Unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meaning as in the context of the relevant technical field and will not be interpreted as having an idealized meaning or an overly formal meaning unless clearly defined in the various embodiments of the present application.

[0054] Example 1

[0055] See also Figure 1 , is a flow chart of a method for processing the lighting effect of trees in a billboard provided by an embodiment of the present application. Figure 1 As shown, the method mainly includes the following steps:

[0056] Step S101, constructing a tree grid corresponding to the trees in the billboard;

[0057] This embodiment provides a method for processing the lighting effects of trees on billboards, applying billboard technology. Billboards contain objects such as trees and characters. The trees are affected by lighting at different angles, resulting in different colors, shadows, and other lighting effects. The primary purpose of this solution is to process the lighting effects of trees on billboards regardless of viewing angle, resulting in a natural and realistic display. The billboarding technology employed involves rotating a polygonal billboard according to the viewing angle, so that the polygonal display changes continuously with the camera's perspective, creating the illusion of facing the camera directly.

[0058] In this solution, a tree grid corresponding to the trees in the billboard is pre-built, and the rotation and calculation of the relevant geometric parameters of the trees are realized through the tree grid. Figure 2 The diagram shows the structure of the tree mesh. The constructed tree mesh usually includes 8 vertices and 6 triangle planes. Figure 2 a, b and c in Figure 3 show the tree mesh at different offset stretching levels. Figure 2 The c in the figure clearly shows the eight vertices and six triangle planes of the tree mesh. This type of attributed mesh will be used for subsequent lighting verification and processing. Of course, in actual production, the tree mesh can also be set as a structured mesh with other characteristics. The subsequent lighting verification and processing steps may also need to be adjusted accordingly, so I will not elaborate on this here.

[0059] Step S102, transferring the normal of the tree mesh in the tangent space to the world space;

[0060] When performing rotation calculations on a tree mesh, the normals of the tree mesh in tangent space are transferred to world space. During this process, the TBN rotation matrix is ​​applied to convert the normals between tangent space and world space.

[0061] According to a specific embodiment of the present application, the step of transferring the normal of the tree mesh in the tangent space to the world space may specifically include:

[0062] Constructing a tangent space corresponding to the tree grid;

[0063] storing coordinate data of each normal of the tree mesh using a first data type in the tangent space;

[0064] Each normal in the tangent space is converted to the world space according to the coordinate data of each normal.

[0065] In a specific implementation, the first data type may be Float3. The step of storing the coordinate data of each normal of the tree mesh using the first data type in the tangent space specifically includes:

[0066] The coordinate data of each normal is stored according to the formula float3x3 TBN=float3x3(float3(0,1,0),float3(1,0,0),float3(0,0,1)).

[0067] The step of converting each normal in the tangent space to the world space according to the coordinate data of each normal includes:

[0068] According to the formula tangentNormal=TransformWorldToTangent(worldnormal, TBN), and the formula tangentNormal*0.5+0.5, each normal is mapped to the world space, where tangentNormal is the tangent space normal, TBN is the tangent space, World is the world space, and Worldnormal is the world space normal.

[0069] First, a TBN space is constructed, in which the normal T (Tangent) can be freely set according to the specific situation. It is necessary to limit the normal T in the rendering stage to be consistent with the specified T. When processing data, float3 can be selected as the first data type to obtain higher precision data.

[0070] float3x3 TBN=float3x3(float3(0,1,0), float3(1,0,0), float3(0,0,1));

[0071] tangentNormal=TransformWorldToTangent(worldnormal, TBN);

[0072] In the above formula, TransformWorldToTangent is the product of the vector worldnormal and the matrix TBN. Since the three components of the normal vector xyz are in the range of (-1, 1), when stored in a pixel, the corresponding color range is (0, 1). The mapping formula (-1, 1) × 0.5 + 0.5 = > (0, 1) saves the obtained normal tangentNormal * 0.5 + 0.5 to the image, and the display effect is as follows Figure 3 shown.

[0073] Step S103, offsetting and stretching the vertices of the tree mesh and the connected areas thereof according to the initial positions of the vertices of the tree mesh in the world space;

[0074] After constructing the tree mesh, the vertex shader needs to perform an offset and stretching based on the initial position of each vertex. The offset degree corresponds to the width of the tree, thereby adjusting the shape of the tree. According to a specific embodiment of the present application, the step of offsetting and stretching the vertices and connected areas of the tree mesh based on the initial position of each vertex in the world space may include:

[0075] Determine the target position of each vertex and each point in its connected domain according to the formula VertexPosition = abs(UV.x-0.5)*OffsetBase;

[0076] Each vertex and each point in its connected domain is offset and stretched from its initial position to the corresponding target position;

[0077] VertexPosition represents the target position, UV.x represents the initial position, abs(UV.x-0.5) represents the lateral offset distance of each point from the center line of the tree grid, and OffsetBase represents the offset base.

[0078] like Figure 2 As shown, a, b and c are the stretching effects corresponding to different offset bases, where a corresponds to an offset base of 0.01, b corresponds to an offset base of 0.03, and c corresponds to an offset base of 0.3. It can be clearly seen that the display range of the tree grid increases with the increase of the offset base.

[0079] Step S104, rotating the normal of the tree grid to a direction corresponding to the target viewing angle of the billboard in the world space, and calculating the target lighting parameters of the tree grid based on the rotated normal;

[0080] After completing the transfer of the tree mesh's normals between tangent space and world space according to the above steps, the next steps are to rotate the normals based on the viewpoint and determine the lighting parameters. The viewpoint to be determined is defined as the target viewpoint, and the lighting parameters corresponding to the target viewpoint are defined as the target lighting parameters. It should be noted that the target viewpoint is any viewpoint within the entire visible range of the billboard and can be based on the camera's viewpoint without limitation.

[0081] According to a specific embodiment of the present application, the step of rotating the normal of the tree grid in the world space to a direction corresponding to the target viewing angle of the billboard may specifically include:

[0082] Normalizing the direction data of the target perspective in the world space;

[0083] Using a second data type to store the tangent data of the tangent space, the normal data of the target view in the tangent space, and the coordinate data of the target view in the tangent space;

[0084] The tangent data of the tangent space, the normal data of the target view in the tangent space, and the coordinate data of the target view in the tangent space are adjusted so that the normal is rotated to a direction corresponding to the target view of the billboard.

[0085] In a specific implementation, the second data type is Half3. According to a specific implementation of the present application, the step of normalizing the direction data of the target perspective in the world space includes:

[0086] Normalize the direction data of the target view in the world space according to the formula cameraVectorWS=normalize(cameraVectorWS*float3(1,0,1)), where cameraVectorWS represents the direction data of the target view and normalize is a normalization function;

[0087] The storage formula of the tangent data in the tangent space is half3 T=half3(0, 1, 0), the storage formula of the normal data of the target view in the tangent space is half3 N=cameraVectorWS, and the coordinate data of the target view in the tangent space is half3 B=cross(N, T)*-1.0;

[0088] The step of adjusting the tangent data of the tangent space, the normal data of the target view in the tangent space, and the coordinate data of the target view in the tangent space so that the normal is rotated to a direction corresponding to the target view of the billboard includes:

[0089] The tangent data, normal data of the tangent space and the coordinate data of the target viewing angle are adjusted according to the formula Worldnormal=mul(tangentNormal, half3x3(T, B, N)).

[0090] In the above formula, N in TBN represents the viewpoint (cameraVectorWS, where WS represents world space). T is the same as the (0, 1, 0) direction used when generating the normal direction. B is obtained by taking the cross product of T and N to obtain cross(N, T)*-1.0. This creates a TBN that can transform the normal in tangent space (T) to world space.

[0091] Step S105 , when the billboard is in the target viewing angle, controlling the trees to display the lighting effects corresponding to the target lighting parameters.

[0092] The target lighting parameters are calculated according to the formula nl=saturate(dot(Normal, LightDir)), where Saturate means limiting the numerical range to (0, 1). dot represents the dot product between two vectors, specifically how much light falls on the surface, i.e., the brightness. Figure 4 Shown are different lighting effects at different viewing angles.

[0093] The method for processing the lighting effects of trees on a billboard, as provided in the present application, pre-constructs a tree mesh corresponding to the trees on the billboard. By transferring the normals of the tree mesh in tangent space to world space, the vertices and connected areas of the tree mesh are offset and stretched to correspond to the trees. Next, based on the target viewing angle at which the lighting effect is to be displayed, the normals of the tree mesh are rotated and stretched to a position corresponding to the target viewing angle. The target lighting parameters of the tree mesh at the target viewing angle can then be calculated based on the rotated normals. By determining the target lighting parameters corresponding to the target viewing angle during the rotation process, controlling the display of the lighting effects corresponding to the target lighting parameters allows the trees on the billboard to present a natural, realistic lighting effect that changes with the angle.

[0094] Example 2

[0095] Corresponding to the above method embodiment, see Figure 5 , is a block diagram of a module of a device for processing lighting effects of trees in a billboard provided by an embodiment of the present disclosure. Figure 5As shown, the processing device 500 for the lighting effect of trees in the billboard mainly includes:

[0096] Construction module 501, for constructing tree grids corresponding to trees in the billboard;

[0097] A transfer module 502, configured to transfer the normal of the tree mesh in the tangent space to the world space;

[0098] A stretching module 503 is configured to offset and stretch the vertices of the tree mesh and the connected areas thereof according to the initial positions of the vertices of the tree mesh in the world space;

[0099] a calculation module 504 for rotating the normal of the tree grid to a direction corresponding to the target viewing angle of the billboard in the world space, and calculating target lighting parameters of the tree grid based on the rotated normal;

[0100] The display module 505 is configured to control the trees to display the lighting effects corresponding to the target lighting parameters when the billboard is in the target viewing angle.

[0101] The device for processing the lighting effects of trees on a billboard provided by the present application pre-constructs a tree mesh corresponding to the trees on the billboard. By transferring the normals of the tree mesh in the tangent space to the world space, the vertices and connected areas of the tree mesh are offset and stretched to correspond to the trees. Next, based on the target viewing angle for displaying the lighting effect, the normals of the tree mesh are rotated and stretched to the position corresponding to the target viewing angle. The target lighting parameters of the tree mesh at the target viewing angle can be calculated based on the rotated normals. By determining the target lighting parameters corresponding to the target viewing angle during the rotation process, the lighting effects corresponding to the target lighting parameters are controlled and displayed, so that the trees on the billboard can present natural and realistic lighting effects that change with the angle.

[0102] Example 3

[0103] In addition, an embodiment of the present disclosure provides a computer device including a memory and a processor, wherein the memory stores a computer program, and when the computer program runs on the processor, the method for processing the lighting effect of trees in a billboard provided in the above-mentioned method embodiment 1 is executed.

[0104] Specifically, such as Figure 6 As shown, the computer device 600 provided in this embodiment includes:

[0105] Components include a radio frequency unit 601, a network module 602, an audio output unit 603, an input unit 604, a sensor 605, a display unit 606, a user input unit 607, an interface unit 608, a memory 609, a processor 610, and a power supply 611. Those skilled in the art will appreciate that Figure 6 The computer device structure shown in the figure does not constitute a limitation on the computer device. The computer device may include more or fewer components than shown, or combine certain components, or arrange the components differently. In the embodiments of the present application, the computer device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle computer device, a wearable device, and a pedometer.

[0106] The processor 610 is configured to:

[0107] Construct tree grids corresponding to the trees in the billboard;

[0108] Transferring the normal of the tree mesh in tangent space to world space;

[0109] offset and stretch the vertices of the tree mesh and its connected areas according to the initial positions of the vertices of the tree mesh in the world space;

[0110] Rotating the normal of the tree mesh to a direction corresponding to the target viewing angle of the billboard in the world space, and calculating target lighting parameters of the tree mesh based on the rotated normal;

[0111] When the billboard is at the target viewing angle, the trees are controlled to display the lighting effects corresponding to the target lighting parameters.

[0112] Optionally, the processor 610 is further configured to:

[0113] Constructing a tangent space corresponding to the tree grid;

[0114] storing coordinate data of each normal of the tree mesh using a first data type in the tangent space;

[0115] Each normal in the tangent space is converted to the world space according to the coordinate data of each normal.

[0116] Optionally, the processor 610 is further configured to:

[0117] Normalizing the direction data of the target viewing angle in the world space;

[0118] Using a second data type to store the tangent data of the tangent space, the normal data of the target view in the tangent space, and the coordinate data of the target view in the tangent space;

[0119] The tangent data of the tangent space, the normal data of the target view in the tangent space, and the coordinate data of the target view in the tangent space are adjusted so that the normal is rotated to a direction corresponding to the target view of the billboard.

[0120] According to a specific embodiment of the present application, the first data type is Float3; and / or,

[0121] The second data type is Half3.

[0122] Optionally, the processor 610 is further configured to:

[0123] The coordinate data of each normal is stored according to the formula float3x3 TBN=float3x3(float3(0,1,0),float3(1,0,0),float3(0,0,1)).

[0124] The step of converting each normal in the tangent space to the world space according to the coordinate data of each normal includes:

[0125] According to the formula tangentNormal=TransformWorldToTangent(worldnormal, TBN), and the formula tangentNormal*0.5+0.5, each normal is mapped to the world space, where tangentNormal is the tangent space normal, TBN is the tangent space, World is the world space, and Worldnormal is the world space normal.

[0126] According to a specific embodiment of the present application, the step of normalizing the direction data of the target perspective in the world space includes:

[0127] Normalize the direction data of the target view in the world space according to the formula cameraVectorWS=normalize(cameraVectorWS*float3(1,0,1)), where cameraVectorWS represents the direction data of the target view and normalize is a normalization function;

[0128] The storage formula of the tangent data in the tangent space is half3 T=half3(0, 1, 0), the storage formula of the normal data of the target view in the tangent space is half3 N=cameraVectorWS, and the coordinate data of the target view in the tangent space is half3 B=cross(N, T)*-1.0;

[0129] The step of adjusting the tangent data of the tangent space, the normal data of the target view in the tangent space, and the coordinate data of the target view in the tangent space so that the normal is rotated to a direction corresponding to the target view of the billboard includes:

[0130] The tangent data, normal data of the tangent space and the coordinate data of the target viewing angle are adjusted according to the formula Worldnormal=mul(tangentNormal, half3x3(T, B, N)).

[0131] Optionally, the processor 610 is further configured to:

[0132] Determine the target position of each vertex and each point in its connected domain according to the formula VertexPosition = abs(UV.x-0.5)*OffsetBase;

[0133] Each vertex and each point in its connected domain is offset and stretched from its initial position to the corresponding target position;

[0134] VertexPosition represents the target position, UV.x represents the initial position, abs(UV.x-0.5) represents the lateral offset distance of each point from the center line of the tree grid, and OffsetBase represents the offset base.

[0135] It should be understood that in the embodiments of the present application, the RF unit 601 may be used to receive and transmit signals during information transmission or calls. Specifically, it receives downlink data from the base station and transmits it to the processor 610 for processing; in addition, it transmits uplink data to the base station. Typically, the RF unit 601 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, a duplexer, and the like. Furthermore, the RF unit 601 may communicate with the network and other devices via a wireless communication system.

[0136] The computer device provides users with wireless broadband Internet access through the network module 602, such as helping users to send and receive emails, browse web pages, and access streaming media.

[0137] The audio output unit 603 can convert audio data received by the RF unit 601 or the network module 602 or stored in the memory 609 into an audio signal and output it as sound. In addition, the audio output unit 603 can also provide audio output related to specific functions performed by the computer device 600 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 603 includes a speaker, a buzzer, a receiver, etc.

[0138] The input unit 604 is used to receive audio or video signals. The input unit 604 may include a graphics processing unit (GPU) 6041 and a microphone 6042. The GPU 6041 processes image data of still images or videos obtained by an image capture computer device (such as a camera) in video capture mode or image capture mode. The processed image frames can be played as a video on the display unit 606. The image frames processed by the GPU 6041 can be stored in the memory 609 (or other storage medium) or transmitted via the RF unit 601 or the network module 602. The microphone 6042 can receive sound and process such sound into audio data. In the case of a telephone call mode, the processed audio data can be converted into a format that can be sent to a mobile communication base station via the RF unit 601 for output.

[0139] The computer device 600 also includes at least one sensor 605, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 6061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 6061 and / or the backlight when the computer device 600 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used to identify the posture of the computer device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 605 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.

[0140] The display unit 606 is used to play information input by the user or information provided to the user. The display unit 606 may include a display panel 6061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.

[0141] The user input unit 607 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the computer device. Specifically, the user input unit 607 includes a touch panel 6071 and other input devices 6072. The touch panel 6071, also known as a touch screen, can collect user touch operations on or near it (such as operations performed by the user using any suitable object or accessory such as a finger, stylus, etc. on or near the touch panel 6071). The touch panel 6071 may include two parts: a touch detection computer device and a touch controller. Among them, the touch detection computer device detects the user's touch direction and detects the signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection computer device and converts it into touch point coordinates, which are then sent to the processor 610, which receives and executes the command sent by the processor 610. In addition, the touch panel 6071 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 6071, the user input unit 607 may also include other input devices 6072. Specifically, other input devices 6072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.

[0142] Furthermore, the touch panel 6071 may be overlaid on the display panel 6061. When the touch panel 6071 detects a touch operation on or near it, it transmits the information to the processor 610 to determine the type of touch event. Subsequently, the processor 610 provides corresponding visual output on the display panel 6061 according to the type of touch event. Figure 5 In the figure, the touch panel 6071 and the display panel 6061 are two independent components to realize the input and output functions of the computer device. However, in some embodiments, the touch panel 6071 and the display panel 6061 can be integrated to realize the input and output functions of the computer device, which is not limited here.

[0143] The interface unit 608 is an interface for connecting an external computer device to the computer device 600. For example, the external computer device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting to a computer device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 608 may be used to receive input (e.g., data information, power, etc.) from the external computer device and transmit the received input to one or more components within the computer device 600, or may be used to transmit data between the computer device 600 and the external computer device.

[0144] Memory 609 can be used to store software programs and various data. Memory 609 may primarily include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function (such as a sound playback function or an image playback function); the data storage area may store data generated based on the use of the mobile phone (such as audio data, a phone book, etc.). Furthermore, memory 609 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0145] Processor 610 is the control center of the computer device. It connects the various components of the entire computer device using various interfaces and lines. By running or executing software programs and / or modules stored in memory 609 and accessing data stored in memory 609, it performs various functions of the computer device and processes data, thereby providing overall monitoring of the computer device. Processor 610 may include one or more processing units; preferably, processor 610 may integrate an application processor and a modem processor. The application processor primarily processes the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 610.

[0146] The computer device 600 may also include a power supply 611 (such as a battery) to supply power to each component. Preferably, the power supply 611 may be logically connected to the processor 610 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.

[0147] In addition, the computer device 600 includes some functional modules not shown, which will not be described in detail here.

[0148] In addition, the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the method for processing the tree lighting effect of the billboard provided in the above embodiment.

[0149] In this embodiment, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0150] The computer-readable storage medium of this embodiment can be used to process the lighting effect of trees in the billboard shown in Example 1. To avoid repetition, it will not be described here.

[0151] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or terminal comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or terminal comprising the element.

[0152] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0153] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.

Claims

1. A method for processing the lighting effect of trees in a billboard, characterized in that: The method comprises: Construct tree grids corresponding to the trees in the billboard; Transferring the normal of the tree mesh in tangent space to world space; offset and stretch the vertices of the tree mesh and its connected areas according to the initial positions of the vertices of the tree mesh in the world space; Rotating the normal of the tree mesh to a direction corresponding to the target viewing angle of the billboard in the world space, and calculating target lighting parameters of the tree mesh based on the rotated normal; When the billboard is at the target viewing angle, controlling the trees to display a lighting effect corresponding to the target lighting parameter; The step of transferring the normal of the tree mesh in the tangent space to the world space comprises: Constructing a tangent space corresponding to the tree grid; storing coordinate data of each normal of the tree mesh using a first data type in the tangent space; Each normal in the tangent space is converted to the world space according to the coordinate data of each normal.

2. The method according to claim 1, characterized in that The step of rotating the normal of the tree grid in the world space to a direction corresponding to the target viewing angle of the billboard comprises: Normalizing the direction data of the target viewing angle in the world space; Using a second data type to store the tangent data of the tangent space, the normal data of the target view in the tangent space, and the coordinate data of the target view in the tangent space; The tangent data of the tangent space, the normal data of the target view in the tangent space, and the coordinate data of the target view in the tangent space are adjusted so that the normal is rotated to a direction corresponding to the target view of the billboard.

3. The method according to claim 2, characterized in that The first data type is Float3; and / or, The second data type is Half3.

4. The method according to claim 3, characterized in that The step of storing coordinate data of each normal of the tree mesh using a first data type in the tangent space comprises: The coordinate data of each normal is stored according to the formula float3x3 TBN=float3x3(float3(0,1,0),float3(1,0,0),float3(0,0,1)). The step of converting each normal in the tangent space to the world space according to the coordinate data of each normal includes: According to the formula tangentNormal=TransformWorldToTangent(worldnormal, TBN), and the formula tangentNormal*0.5+0.5, each normal is mapped to the world space, where tangentNormal is the tangent space normal, TBN is the tangent space, World is the world space, and Worldnormal is the world space normal.

5. The method according to claim 4, characterized in that The step of normalizing the direction data of the target viewing angle in the world space includes: Normalize the direction data of the target view in the world space according to the formula cameraVectorWS=normalize(cameraVectorWS*float3(1,0,1)), where cameraVectorWS represents the direction data of the target view and normalize is a normalization function; The storage formula of the tangent data in the tangent space is half3 T=half3(0, 1, 0), the storage formula of the normal data of the target view in the tangent space is half3 N=cameraVectorWS, and the coordinate data of the target view in the tangent space is half3 B=cross(N, T)*-1.0; The step of adjusting the tangent data of the tangent space, the normal data of the target view in the tangent space, and the coordinate data of the target view in the tangent space so that the normal is rotated to a direction corresponding to the target view of the billboard includes: The tangent data, normal data of the tangent space and the coordinate data of the target viewing angle are adjusted according to the formula Worldnormal=mul(tangentNormal, half3x3(T, B, N)).

6. The method according to claim 1, wherein The step of offsetting and stretching the vertices of the tree mesh and the connected areas thereof according to the initial positions of the vertices of the tree mesh in the world space comprises: Determine the target position of each vertex and each point in its connected domain according to the formula VertexPosition = abs(UV.x-0.5)*OffsetBase; Each vertex and each point in its connected domain is offset and stretched from its initial position to the corresponding target position; VertexPosition represents the target position, UV.x represents the initial position, abs(UV.x-0.5) represents the lateral offset distance of each point from the center line of the tree grid, and OffsetBase represents the offset base.

7. A device for processing the lighting effect of trees in a billboard, characterized in that: The device comprises: A construction module, used to construct the tree grid corresponding to the trees in the billboard; A transfer module, configured to transfer the normal of the tree mesh in the tangent space to the world space; a stretching module, configured to offset and stretch the vertices of the tree mesh and the connected areas thereof according to the initial positions of the vertices of the tree mesh in the world space; a calculation module, configured to rotate the normal of the tree grid to a direction corresponding to the target viewing angle of the billboard in the world space, and calculate target lighting parameters of the tree grid based on the rotated normal; a display module, configured to control the trees to display a lighting effect corresponding to the target lighting parameters when the billboard is at the target viewing angle; The step of transferring the normal of the tree mesh in the tangent space to the world space comprises: Constructing a tangent space corresponding to the tree grid; storing coordinate data of each normal of the tree mesh using a first data type in the tangent space; Each normal in the tangent space is converted to the world space according to the coordinate data of each normal.

8. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the processor runs the computer program, the method for processing the lighting effect of trees in a billboard according to any one of claims 1 to 6 is executed.

9. A computer-readable storage medium, characterized in that The computer program is stored therein, and when the computer program is run on a processor, the method for processing the lighting effect of trees in a billboard according to any one of claims 1 to 6 is executed.

Citation Information

Patent Citations

  • Rendering optimization method and system for stroking effect, electronic device and storage medium

    CN112270726A

  • Method and device for rendering water body surface, equipment and computer readable storage medium

    CN112819941A