A processing method for a texture image and a related device
By acquiring four-channel texture images and binding distance scaling parameters, the problem of the lack of depth in scene model texture images when the virtual camera moves back and forth was solved, and the depth of the texture images on the screen was realized when the virtual camera moves back and forth.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2026-04-28
- Publication Date
- 2026-05-29
Smart Images

Figure CN122115676A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a method and related apparatus for processing texture images. Background Technology
[0002] In virtual 3D space, the visual world is essentially a simulation of real visual laws through a virtual camera. When the virtual camera moves or rotates in a certain direction, objects in the visual world move or rotate in the opposite direction. However, there are simulated scenes that do not follow real visual laws; that is, when the virtual camera moves or rotates, the texture images on the scene model remain unchanged and are displayed on the screen.
[0003] In related technologies, for simulated scenes that do not conform to real visual patterns, texture images are obtained by sampling texture images based on two-dimensional coordinates on the screen. The material images are then mapped onto the scene model inside the model, including a virtual camera. The virtual camera can be moved or rotated at will, and the texture images on the scene model will not change on the screen.
[0004] However, simulated scenes that do not follow real visual rules mainly focus on the virtual camera moving up and down, left and right, or rotating, and the texture images on the scene model do not change on the screen. The above methods are difficult to meet the needs of real-world applications where the virtual camera moves back and forth and the texture images on the scene model have a sense of depth on the screen. Summary of the Invention
[0005] To address the aforementioned technical problems, this application provides a method and related apparatus for processing texture images, which completes texture mapping on a scene model. When the virtual camera moves up and down, left and right, or rotates, the texture image on the scene model will not change on the screen; thus satisfying the requirement that when the virtual camera moves back and forth, the texture image on the scene model has a sense of depth on the screen.
[0006] The embodiments of this application disclose the following technical solutions:
[0007] On one hand, embodiments of this application provide a method for processing texture images, the method comprising:
[0008] Acquire a four-channel texture image; the four-channel texture image includes a color channel texture image and a transparency channel texture image;
[0009] The four-channel texture image is sampled in a single channel according to the two-dimensional coordinates on the screen to obtain four material images; each material image is configured with a distance scaling parameter.
[0010] The four-layer material images are mapped onto the scene model; the scene model includes a virtual camera.
[0011] The distance scaling parameter is bound to the forward and backward axis of the virtual camera; each layer of material image is enlarged as the virtual camera moves forward and reduced as the virtual camera moves backward.
[0012] On the other hand, embodiments of this application provide a processing apparatus for texture images, the apparatus comprising: an acquisition unit, a sampling unit, a mapping unit, and a binding unit;
[0013] The acquisition unit is used to acquire a four-channel texture image; the four-channel texture image includes a color channel texture image and a transparency channel texture image;
[0014] The sampling unit is used to perform single-channel sampling on the four-channel texture image according to the two-dimensional coordinates of the screen to obtain four material images; each material image is configured with a distance scaling parameter.
[0015] The mapping unit is used to apply the four-layer material images to the scene model; the scene model includes a virtual camera.
[0016] The binding unit is used to bind the distance scaling parameter to the forward and backward axis of the virtual camera; when the virtual camera moves forward, the material image of each layer is enlarged, and when the virtual camera moves backward, the material image of each layer is reduced.
[0017] On the other hand, embodiments of this application provide a computer device, the computer device including a processor and a memory:
[0018] The memory is used to store computer programs and to transfer the computer programs to the processor;
[0019] The processor is configured to execute the method described in any of the foregoing aspects according to instructions in the computer program.
[0020] On the other hand, embodiments of this application provide a computer-readable storage medium for storing a computer program that, when run on a computer device, causes the computer device to perform the method described in any of the foregoing aspects.
[0021] On the other hand, embodiments of this application provide a computer program product, including a computer program that, when run on a computer device, causes the computer device to perform the method described in any of the foregoing aspects.
[0022] As can be seen from the above technical solution, a four-channel texture image, including a color channel texture image and a transparency channel texture image, is obtained. This four-channel texture image is the basic image for texture mapping of the scene model. Based on single-channel sampling of the four-channel texture image using screen two-dimensional coordinates, four layers of material images are obtained. This provides a basis for ensuring that after texture mapping is applied to the scene model, the texture images on the scene model will not change on the screen when the virtual camera moves or rotates arbitrarily. Distance scaling parameters are configured for each material image layer to provide implementation parameters for meeting the requirement that the texture images on the scene model have a sense of depth on the screen when the virtual camera moves forward or backward. The four layers of material images are then mapped onto the scene model, including the virtual camera. Texture mapping is completed on the scene model, and the texture images on the scene model will not change on the screen when the virtual camera moves up, down, left, or right or rotates. The distance scaling parameters are bound to the forward and backward axis of the virtual camera, so that each layer of material image after mapping is enlarged when the virtual camera moves forward and each layer of material image after mapping is reduced when the virtual camera moves backward, thus meeting the requirement that the texture images on the scene model have a sense of depth on the screen when the virtual camera moves forward or backward. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a schematic diagram illustrating how the texture image on a scene model remains unchanged on the screen even when a virtual camera is moved or rotated arbitrarily, as provided in an embodiment of this application.
[0025] Figure 2 A system schematic diagram illustrating a method for processing texture images provided in an embodiment of this application;
[0026] Figure 3 A flowchart illustrating a method for processing texture images provided in an embodiment of this application;
[0027] Figure 4 A schematic diagram illustrating the depth perception of texture images on a virtual camera moving back and forth scene model provided in this application embodiment;
[0028] Figure 5 This is a schematic diagram illustrating how texture changes in a scene model's texture image reflect a sense of depth on the screen, as provided in an embodiment of this application.
[0029] Figure 6This is a schematic diagram illustrating how the transparency of a texture image on a scene model reflects a sense of depth on the screen, as provided in an embodiment of this application.
[0030] Figure 7 This is a schematic diagram illustrating the configuration of initial scaling parameters, distance scaling parameters, time variation parameters, and opacity parameters for each material layer in a four-layer material image provided in an embodiment of this application.
[0031] Figure 8 A schematic diagram of different single-channel texture images and alpha channel texture images in a color channel texture image provided in an embodiment of this application;
[0032] Figure 9 A schematic diagram illustrating a storage of a color channel texture image, different single-channel texture images within the color channel texture image, and a transparency channel texture image, provided as an embodiment of this application;
[0033] Figure 10 A schematic diagram of a four-channel texture image provided in an embodiment of this application;
[0034] Figure 11 A schematic diagram of a sphere model provided in an embodiment of this application;
[0035] Figure 12 A schematic diagram of a single facet provided in an embodiment of this application;
[0036] Figure 13 A schematic diagram illustrating the spatial relationship between a scene model, virtual attack props, and a virtual camera, provided for an embodiment of this application;
[0037] Figure 14 A schematic diagram illustrating a processing step for a texture image provided in an embodiment of this application;
[0038] Figure 15 A structural diagram of a texture image processing apparatus provided in an embodiment of this application;
[0039] Figure 16 A structural diagram of a server provided in an embodiment of this application;
[0040] Figure 17 This is a structural diagram of a terminal provided in an embodiment of this application. Detailed Implementation
[0041] The embodiments of this application will now be described with reference to the accompanying drawings.
[0042] In virtual 3D space, simulated scenes exhibit non-realistic visual patterns. Material images are obtained by sampling texture images based on the screen's 2D coordinates. These material images are then mapped onto the scene model, including the virtual camera. Even when the virtual camera moves or rotates freely, the texture images on the scene model remain unchanged on the screen. However, research has revealed that in simulated scenes exhibiting non-realistic visual patterns, the focus is primarily on the virtual camera's vertical, horizontal, or rotational movements. The texture images on the scene model remain static, making the aforementioned method insufficient for practical applications where the virtual camera can move back and forth while the texture images on the scene model convey a sense of depth on the screen.
[0043] See Figure 1 ,Should Figure 1 This illustration demonstrates how the texture image on a scene model remains unchanged on the screen regardless of arbitrary movement or rotation of the virtual camera, as provided in this embodiment. Both the virtual attack props and the visual anchor points are objects in the visual world and are not subject to any special processing. When the virtual camera moves or rotates, the virtual attack props and the visual anchor points maintain the same visual world change characteristics. The background is a material image texture obtained by sampling texture images based on two-dimensional screen coordinates. Regardless of arbitrary movement or rotation of the virtual camera, the background texture image remains unchanged on the screen; specifically, the texture (e.g., lines) in the background texture image remains unchanged on the screen.
[0044] This application provides a method for processing texture images. It acquires a four-channel texture image, including a color channel texture image and a transparency channel texture image. This four-channel texture image serves as the base image for texture mapping of a scene model. Based on single-channel sampling of the four-channel texture image using screen two-dimensional coordinates, four material images are obtained. This provides a basis for ensuring that after texture mapping is applied to the scene model, the texture images on the scene model remain unchanged on the screen regardless of any movement or rotation of the virtual camera. Each material image is configured with a distance scaling parameter to provide implementation parameters for achieving a sense of depth on the screen when the virtual camera moves forward or backward. The four material images are then mapped onto the scene model, including the virtual camera. Texture mapping is completed on the scene model, and the texture images on the scene model remain unchanged when the virtual camera moves up, down, left, or right or rotates. The distance scaling parameter is bound to the forward / backward axis of the virtual camera, so that each material image after mapping is enlarged when the virtual camera moves forward and reduced when the virtual camera moves backward, thus satisfying the requirement that the texture images on the scene model have a sense of depth on the screen when the virtual camera moves forward or backward.
[0045] Next, the system architecture for processing texture images will be introduced. See [link / reference] Figure 1 ,Should Figure 2 This is a schematic diagram of a system for processing texture images according to an embodiment of this application. The system includes a terminal 201 and a server 202, which are used to execute the processing method for texture images.
[0046] Terminal 201 can be a smartphone, tablet, laptop, desktop computer, intelligent voice interaction device, vehicle terminal, extended reality device, or aircraft, but is not limited to these. The client is deployed on terminal 201. The client can run on terminal 201 through a browser, or through a standalone application (APP) or mini-program, etc.
[0047] Among them, server 202 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services, but it is not limited to these.
[0048] Furthermore, terminal 201 and server 202 communicate via a communication network. This communication network uses standard communication technologies and / or protocols, typically the Internet, but can also be any network, including but not limited to Bluetooth, a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), mobile, private networks, or any combination of virtual private networks. In some embodiments, customized or dedicated data communication technologies may be used to replace or supplement the aforementioned data communication technologies.
[0049] Terminal 201 creates a four-channel texture image for the scene model and sends the four-channel texture image to server 202; server 202 obtains the four-channel texture image; the four-channel texture image includes a color channel texture image and a transparency channel texture image.
[0050] As an example, terminal 201 creates a four-channel texture image, namely RGBA texture image, for the scene model, including color (RGB) channel texture image and transparency (A) channel texture image; and sends the RGBA texture image to server 202; server 202 obtains the RGBA texture image.
[0051] Server 202 performs single-channel sampling on the four-channel texture image based on the two-dimensional coordinates of the screen to obtain four material images; each material image is configured with distance scaling parameters.
[0052] As an example, based on the above example, server 202 samples RGBA texture images in a single channel based on screen two-dimensional coordinates (UV coordinates) to obtain four material images, namely R channel material image, G channel material image, B channel material image and A channel material image; wherein, the R channel material image is configured with distance scaling parameter ScalePosR, the G channel material image is configured with distance scaling parameter ScalePosG, the B channel material image is configured with distance scaling parameter ScalePosB, and the A channel material image is configured with distance scaling parameter ScalePosA.
[0053] Server 202 applies four layers of material images to the scene model; the scene model includes a virtual camera.
[0054] As an example, based on the above example, server 202 applies R-channel material images, G-channel material images, B-channel material images, and A-channel material images to the scene model inside the model, including the virtual camera.
[0055] Server 202 binds the distance scaling parameter to the forward and backward axis of the virtual camera; when the virtual camera moves forward, the texture image of each layer after the texture is enlarged, and when the virtual camera moves backward, the texture image of each layer after the texture is reduced.
[0056] As an example, based on the above example, server 202 binds the distance scaling parameter ScalePosR to the forward / backward axis (Y-axis) of the virtual camera, the distance scaling parameter ScalePosG to the Y-axis of the virtual camera, the distance scaling parameter ScalePosB to the Y-axis of the virtual camera, and the distance scaling parameter ScalePosA to the Y-axis of the virtual camera, so that when the virtual camera moves forward, the R-channel material image, G-channel material image, B-channel material image, and A-channel material image are all magnified, and when the virtual camera moves backward, the R-channel material image, G-channel material image, B-channel material image, and A-channel material image are all shrunk.
[0057] In other words, a four-channel texture image, including a color channel texture image and a alpha channel texture image, is acquired. This four-channel texture image serves as the foundation for texture mapping on the scene model. Based on screen 2D coordinates, the four-channel texture image is sampled single-channel to obtain four material images. This provides a basis for ensuring that after texture mapping is applied to the scene model, the texture images on the scene model remain unchanged on the screen regardless of the virtual camera's movement or rotation. Distance scaling parameters are configured for each material image to provide implementation parameters for achieving a sense of depth on the screen when the virtual camera moves forward or backward. The four material images are then mapped onto the scene model, including the virtual camera, to complete the texture mapping. When the virtual camera moves up, down, left, or right, the texture images on the scene model remain unchanged on the screen. The distance scaling parameters are bound to the virtual camera's forward and backward axis, causing each textured material image to enlarge when the virtual camera moves forward and shrink when the virtual camera moves backward, thus satisfying the requirement for a sense of depth on the screen when the virtual camera moves forward or backward.
[0058] It should be noted that, in the embodiments of this application, the execution device for the texture image processing method is a computer device, which can be a server or a terminal. The method provided in the embodiments of this application can be executed by the terminal or the server alone, or by the terminal and the server in cooperation. Specifically, when the method provided in the embodiments of this application is executed by the terminal or the server alone, its execution method is similar to... Figure 2 The corresponding embodiments are similar, mainly by merging the execution steps of terminal 201 and server 202 into the execution steps of the terminal, or merging the execution steps of terminal 201 and server 202 into the execution steps of the server.
[0059] Next, the processing method for texture images provided in the embodiments of this application will be described in detail using a computer device executing the method provided in the embodiments of this application as an example, in conjunction with the accompanying drawings.
[0060] See Figure 3 ,Should Figure 3 The flowchart of a method for processing texture images provided in the embodiments of this application includes the following steps S301-S304.
[0061] S301: Acquire a four-channel texture image; the four-channel texture image includes a color channel texture image and a transparency channel texture image.
[0062] S302: Perform single-channel sampling on the four-channel texture image based on the two-dimensional coordinates of the screen to obtain four material images; configure distance scaling parameters for each material image.
[0063] In related technologies, for simulated scenes in virtual 3D space that do not conform to realistic visual patterns, material images are typically obtained by sampling texture images from two-dimensional screen coordinates. These material images are then mapped onto the scene model, including the virtual camera. When the virtual camera moves or rotates, the texture images on the scene model remain unchanged on the screen. However, research has shown that in practical applications, simulating scenes that do not conform to realistic visual patterns primarily focuses on the virtual camera's vertical, horizontal, or rotational movements. While the texture images on the scene model remain unchanged on the screen, for the virtual camera's forward and backward movements, the texture images on the scene model need to convey a sense of depth on the screen. The aforementioned methods are insufficient to meet this requirement.
[0064] In this embodiment of the application, in order to solve the above-mentioned problems, for simulated scenes that do not conform to real visual rules, after obtaining a four-channel texture image composed of a color channel texture image and a transparency channel texture image, and obtaining four layers of material images by single-channel sampling of the four-channel texture images based on the two-dimensional coordinates of the screen, in order to meet the requirement that the texture images on the scene model have a sense of depth on the screen when the virtual camera moves back and forth, the distance between the virtual camera and each layer of material image changes when the virtual camera moves back and forth. Therefore, each layer of material image first needs to have an image scaling parameter, namely a distance scaling parameter, which is affected by the distance between the virtual camera and each layer of material image. This provides implementation parameters for the subsequent implementation of texture mapping on the scene model to meet the requirement that the texture images on the scene model have a sense of depth on the screen when the virtual camera moves back and forth.
[0065] Based on this, a four-channel texture image including a color channel texture image and a transparency channel texture image is obtained; the four-channel texture image is sampled by a single channel based on the two-dimensional coordinates of the screen to obtain four material images, and each material image is configured with a distance scaling parameter.
[0066] Among them, the four-channel texture image is a texture image composed of a color channel texture image and a transparency channel texture image, which are composed of three single-channel texture images (monochrome texture images); the color channel texture image is a texture image composed of three single-channel texture images (monochrome texture images); the transparency channel texture image is an image that stores the transparency information of pixels; the screen two-dimensional coordinates are the pixel position coordinates occupied by the texture image on the display device; the four-layer material image is a four independent material attribute image separated from the four-channel texture image by single-channel sampling according to the screen two-dimensional coordinates; the distance scaling parameter of each layer material image is an image scaling parameter affected by the distance between the virtual camera and each layer material image.
[0067] S301-S302 takes into account the implementation of texture mapping for scene models. First, it acquires a four-channel texture image, including a color channel texture image and a transparency channel texture image, laying the foundation for subsequent texture mapping for scene models. Then, it samples the four-channel texture image using a single channel based on the screen's two-dimensional coordinates to obtain four layers of material images. This ensures that after texture mapping is implemented for scene models, the texture images on the scene models will not change on the screen when the virtual camera moves or rotates arbitrarily. In addition, each layer of material image is configured with distance scaling parameters to meet the requirement that the texture images on the scene models have a sense of depth on the screen when the virtual camera moves back and forth.
[0068] As an example of S301-S302, the computer device acquires a four-channel texture image, namely an RGBA texture image, which includes a color (RGB) channel texture image and a transparency (A) channel texture image; the computer device samples the RGBA texture image in a single channel based on the screen's two-dimensional coordinates (UV coordinates) to obtain four layers of material images: an R-channel material image, a G-channel material image, a B-channel material image, and an A-channel material image; wherein, the R-channel material image is configured with a distance scaling parameter ScalePosR, the G-channel material image is configured with a distance scaling parameter ScalePosG, the B-channel material image is configured with a distance scaling parameter ScalePosB, and the A-channel material image is configured with a distance scaling parameter ScalePosA.
[0069] S303: Apply four layers of material images to the scene model; the scene model includes a virtual camera.
[0070] S304: Bind distance scaling parameters to the forward and backward axis of the virtual camera; when the virtual camera moves forward, the texture image of each layer after the texture is enlarged, and when the virtual camera moves backward, the texture image of each layer after the texture is reduced.
[0071] In this embodiment, after executing S301-S302 to obtain four-channel texture images and sampling the four-channel texture images using single-channel sampling based on screen two-dimensional coordinates to obtain four-layer material images, it is necessary to apply the four-layer material images to the scene model inside the model, including the virtual camera, to achieve texture mapping for the scene model. In order to meet the requirement that the texture images on the scene model have a sense of depth on the screen when the virtual camera moves forward and backward, based on the distance scaling parameters configured for each layer of material images, considering that the distance between the virtual camera and each layer of material images after mapping decreases when the virtual camera moves forward, it is necessary to enlarge each layer of material images after mapping based on the distance scaling parameters. Conversely, when the virtual camera moves backward, the distance between the virtual camera and each layer of material images after mapping increases, and it is necessary to shrink each layer of material images after mapping based on the distance scaling parameters. Therefore, it is necessary to associate the distance scaling parameters configured for each layer of material images with the forward and backward direction axis of the virtual camera so that when the virtual camera moves forward and backward, the texture images on the scene model show a sense of depth on the screen.
[0072] Based on this, four layers of material images are mapped onto the scene model inside the model, including the virtual camera; the distance scaling parameter is bound to the forward and backward direction axis of the virtual camera, so that each layer of material image after mapping is enlarged when the virtual camera moves forward and each layer of material image after mapping is reduced when the virtual camera moves backward.
[0073] The scene model is a 3D virtual model of the scene where the virtual camera is located; the virtual camera is a technical tool that uses software to simulate the function of a real physical camera; the forward and backward axis of the virtual camera is the axis by which the virtual camera moves forward and backward with the virtual camera as the origin.
[0074] Based on the principle that the texture mapping on the scene model is implemented for the four-layer material image, and the texture image on the scene model will not change on the screen when the virtual camera moves or rotates arbitrarily, the four-layer material image is applied to the scene model including the virtual camera. The texture mapping is completed for the scene model. The texture image on the scene model will not change on the screen when the virtual camera moves up, down, left, or right or rotates. Based on the distance scaling parameter configured for each layer of material image to realize the depth of the texture image on the scene model on the screen when the virtual camera moves forward or backward, the distance scaling parameter is bound to the forward and backward axis of the virtual camera. This makes each layer of material image after the texture mapping magnify when the virtual camera moves forward and each layer of material image after the texture mapping magnify when the virtual camera moves backward, so as to meet the requirement that the texture image on the scene model has a sense of depth on the screen when the virtual camera moves forward or backward.
[0075] As an example of S303-S304, based on the examples of S301-S302 above, the computer device maps the R-channel material image, G-channel material image, B-channel material image, and A-channel material image to the scene model inside the model, including the virtual camera; the computer device binds the distance scaling parameter ScalePosR to the forward / backward axis (Y-axis) of the virtual camera, the distance scaling parameter ScalePosG to the Y-axis of the virtual camera, the distance scaling parameter ScalePosB to the Y-axis of the virtual camera, and the distance scaling parameter ScalePosA to the Y-axis of the virtual camera, so that when the virtual camera moves forward, the R-channel material image, G-channel material image, B-channel material image, and A-channel material image are all enlarged, and when the virtual camera moves backward, the R-channel material image, G-channel material image, B-channel material image, and A-channel material image are all reduced.
[0076] As can be seen from the above technical solution, a four-channel texture image, including a color channel texture image and a transparency channel texture image, is obtained. This four-channel texture image is the basic image for texture mapping of the scene model. Based on single-channel sampling of the four-channel texture image using screen two-dimensional coordinates, four layers of material images are obtained. This provides a basis for ensuring that after texture mapping is applied to the scene model, the texture images on the scene model will not change on the screen when the virtual camera moves or rotates arbitrarily. Distance scaling parameters are configured for each material image layer to provide implementation parameters for meeting the requirement that the texture images on the scene model have a sense of depth on the screen when the virtual camera moves forward or backward. The four layers of material images are then mapped onto the scene model, including the virtual camera. Texture mapping is completed on the scene model, and the texture images on the scene model will not change on the screen when the virtual camera moves up, down, left, or right or rotates. The distance scaling parameters are bound to the forward and backward axis of the virtual camera, so that each layer of material image after mapping is enlarged when the virtual camera moves forward and each layer of material image after mapping is reduced when the virtual camera moves backward, thus meeting the requirement that the texture images on the scene model have a sense of depth on the screen when the virtual camera moves forward or backward.
[0077] In this embodiment, when specifically implementing the binding of the distance scaling parameter and the forward / backward axis of the virtual camera in S304, if the virtual camera moves forward, the distance between the virtual camera and each layer of textured material image decreases, requiring the textured material image to be enlarged based on the distance scaling parameter. In practice, moving the virtual camera forward represents an increase in the forward / backward movement parameter, and this increased forward / backward movement parameter is used as the scaling factor of the distance scaling parameter to enlarge each layer of textured material image. Conversely, if the virtual camera moves backward, the distance between the virtual camera and each layer of textured material image increases, requiring the textured material image to be reduced based on the distance scaling parameter. In practice, moving the virtual camera backward represents a decrease in the forward / backward movement parameter, and this decreased forward / backward movement parameter is used as the scaling factor of the distance scaling parameter to reduce each layer of textured material image. Based on this, this application provides a possible implementation, and S304 may include, for example, the following S304a-S304b (not shown in the figure).
[0078] S304a: Obtain the forward and backward movement parameters of the virtual camera.
[0079] S304b: The forward and backward movement parameters are determined as the scaling factor of the distance scaling parameters; the forward and backward movement parameters increase when the virtual camera moves forward and decrease when the virtual camera moves backward.
[0080] Among them, the forward and backward movement parameter of the virtual camera is the distance the virtual camera moves relative to the origin on the forward and backward axis; the scaling factor of the distance scaling parameter is the factor that enlarges or reduces the distance scaling parameter.
[0081] The above S304a-S304b addresses the requirement that when the virtual camera moves forward and backward, the texture images on the scene model have a sense of depth on the screen. Based on the change in the forward and backward movement parameters caused by the virtual camera moving forward and backward, the forward and backward movement parameters increase when the virtual camera moves forward. The increased forward and backward movement parameters are used as the scaling factor of the distance scaling parameter, making each layer of material image after texture magnification. Conversely, when the virtual camera moves backward, the forward and backward movement parameters decrease. The decreased forward and backward movement parameters are used as the scaling factor of the distance scaling parameter, making each layer of material image after texture magnification shrink. This achieves the effect of the virtual camera moving forward and backward, making the texture images on the scene model have a sense of depth on the screen.
[0082] As an example of S304a-S304b, based on the examples of S303-S304 above, the computer device obtains the forward and backward movement parameters of the virtual camera; the computer device determines the forward and backward movement parameters as scaling factors of distance scaling parameters ScalePosR, ScalePosG, ScalePosB, and ScalePosA; the forward and backward movement parameters increase when the virtual camera moves forward and decrease when the virtual camera moves backward.
[0083] See Figure 4 ,Should Figure 4 This is a schematic diagram illustrating the use of texture images on a virtual camera moving back and forth in a scene model to create a sense of depth on a screen, as provided in an embodiment of this application. Based on the above... Figure 1 In the visual world, ground and cubes are added as visual anchor points. These anchor points only observe spatial changes as the virtual camera moves and do not participate in calculations or processes. Both virtual attack props and visual anchor points are objects in the visual world and are not specially processed. When the virtual camera moves or rotates, the virtual attack props and visual anchor points maintain the same visual world change characteristics. The background is a material image texture obtained by sampling texture images based on two-dimensional coordinates of the screen. When the virtual camera moves up, down, left, right, or rotates, the background texture image will not change on the screen. Figure 4 In (a), it means that as the virtual camera moves forward, the thickness of textures (e.g., lines) in the background texture image increases proportionally to the overall image. Figure 4 In (b), it means that when the virtual camera moves backward, the texture (e.g., lines) in the background texture image becomes smaller in proportion to the overall image.
[0084] In this embodiment, by binding the distance scaling parameter to the forward and backward axis of the virtual camera, each layer of material image after the texture is enlarged when the virtual camera moves forward and reduced when the virtual camera moves backward. This satisfies the requirement that the texture images on the scene model have a sense of depth on the screen while the virtual camera moves forward and backward. The distance scaling parameters for the four material images are equal, so they do not affect the forward and backward movement of the virtual camera, and the texture images on the scene model still convey a sense of depth on the screen. Further considering the order of the four material images, based on the principle of near objects appearing larger and farther objects smaller, texture images closer to the virtual camera are more easily enlarged when intersecting with texture images farther away. Therefore, the distance scaling parameter corresponding to the material image with the earlier texture is larger than that corresponding to the material image with the later texture. Based on this, this application provides a possible implementation method, and the configuration steps for the distance scaling parameter may include, for example, the following S1 (not shown in the figure) or S2 (not shown in the figure).
[0085] S1: Configure the distance scaling parameters of the four material images to be equal.
[0086] S2: Based on the front and back mapping order of the four material images, configure the distance scaling parameters of the four material images to decrease sequentially from front to back.
[0087] The order in which the four material images are mapped is the order in which they are applied to the scene model; the distance scaling parameter of the material image mapped first is greater than that of the material image mapped later.
[0088] The above S1 takes into account that the distance scaling parameters corresponding to the four material images are all bound to the forward and backward axes of the virtual camera. When the virtual camera moves forward, each material image after the texture is enlarged, and when the virtual camera moves backward, each material image after the texture is shrunk. Moreover, the distance between each material image after the texture and the virtual camera is relatively small. Configuring the distance scaling parameters corresponding to the four material images to be equal can still meet the requirement that the texture images on the scene model have a sense of depth on the screen when the virtual camera moves forward and backward. This allows for quick and easy configuration of the distance scaling parameters corresponding to the four material images.
[0089] The above-mentioned S2 binds the distance scaling parameters corresponding to the four material images to the forward and backward axes of the virtual camera. When the virtual camera moves forward, each material image after the texture is enlarged, and when the virtual camera moves backward, each material image after the texture is reduced. Considering that the distance of each material image after the texture is different from the virtual camera, based on the front and back texture order of the four material images, the distance scaling parameters corresponding to the four material images are configured to decrease sequentially from front to back. This makes it easier for texture images closer to the virtual camera to intersect with texture images farther away from the virtual camera to be enlarged. When the virtual camera moves back and forth, the scaling of the four material images after the texture also satisfies the requirement that the closer the image is, the smaller the image is. This further satisfies the requirement that the texture images on the scene model have a sense of depth on the screen when the virtual camera moves back and forth.
[0090] As an example of S1, based on the above example, the computer device is configured with the distance scaling parameters ScalePosR, ScalePosG, ScalePosB, and ScalePosA being equal.
[0091] As an example of S2, based on the above example, the computer device configures the distance scaling parameters ScalePosR, ScalePosG, ScalePosB, and ScalePosA sequentially, decreasing from front to back, based on the previous and subsequent mapping order of the R-channel material image, G-channel material image, B-channel material image, and A-channel material image. When the previous and subsequent mapping order of the R-channel material image, G-channel material image, B-channel material image, and A-channel material image is: R-channel material image → G-channel material image → B-channel material image → A-channel material image, the distance scaling parameter ScalePosR can be 1, the distance scaling parameter ScalePosG can be 0.8, the distance scaling parameter ScalePosB can be 0.6, and the distance scaling parameter ScalePosA can be 0.4.
[0092] Furthermore, in this embodiment, to control the base scaling of each material image layer, each material image layer also needs to have an initial scaling parameter. Considering the mapping order of the four material images, based on the principle of near-large and far-small, the texture image closer to the virtual camera is larger, and the texture image farther from the virtual camera is smaller. Therefore, the initial scaling parameter corresponding to the material image with the first texture is larger than the initial scaling parameter corresponding to the material image with the last texture. Based on this, this application provides a possible implementation method in which each material image layer is also configured with an initial scaling parameter. The configuration step of the initial scaling parameter may include, for example, the following S3 (not shown in the figure): according to the mapping order of the four material images, the initial scaling parameters corresponding to the four material images are configured to decrease sequentially from front to back.
[0093] The order in which the four material images are mapped is the order in which they are applied to the scene model; the initial scaling parameters are the basic image scaling parameters.
[0094] Based on the initial scaling parameters that control the basic scaling size of each material image layer, the above-mentioned S3 takes into account that the distance between each material image layer and the virtual camera is different in the four material images after texturing. Based on the texturing order of the four material images, the initial scaling parameters corresponding to the four material images are configured to decrease sequentially from front to back. This makes the texture images closer to the virtual camera intersect more with the texture images farther away from the virtual camera, and the texture images farther away from the virtual camera intersect less with the texture images closer to the virtual camera. This simulates the visual effect of objects appearing larger when closer and smaller when farther away, and further makes the texture images on the scene model reflect a sense of depth on the screen.
[0095] As an example of S3, based on the above example, the R-channel material image is configured with an initial scaling parameter ScaleR, the G-channel material image with an initial scaling parameter ScaleG, the B-channel material image with an initial scaling parameter ScaleB, and the A-channel material image with an initial scaling parameter ScaleA. The computer device configures the initial scaling parameters ScaleR, ScaleG, ScaleB, and ScaleA sequentially from front to back, based on the previous and next mapping order of the R-channel, G-channel, B-channel, and A-channel material images. When the previous and next mapping order of the R-channel, G-channel, B-channel, and A-channel material images is: R-channel material image → G-channel material image → B-channel material image → A-channel material image, the initial scaling parameter ScaleR can be 0.8, the initial scaling parameter ScaleG can be 0.6, the initial scaling parameter ScaleB can be 0.4, and the initial scaling parameter ScaleA can be 0.2.
[0096] Furthermore, in this embodiment, based on the initial scaling parameters configured for each material image layer, to further satisfy the requirement that the texture images on the scene model have a sense of depth on the screen when the virtual camera moves forward and backward, considering that the distance between the virtual camera and each material image layer after texturing decreases when the virtual camera moves forward, each material image layer after texturing can be enlarged based on the initial scaling parameters. Conversely, when the virtual camera moves backward, the distance between the virtual camera and each material image layer after texturing increases, each material image layer after texturing can be reduced based on the initial scaling parameters. Therefore, it is necessary to associate the initial scaling parameters configured for each material image layer with the forward and backward axis of the virtual camera, so that when the virtual camera moves forward and backward, the texture images on the scene model further demonstrate a sense of depth on the screen. Based on this, this application provides a possible implementation method, which may further include S4 (not shown in the figure): binding the initial scaling parameters with the forward and backward axis of the virtual camera.
[0097] The S4 above configures initial scaling parameters for each layer of material image, which are also used for the virtual camera to move forward and backward. Based on the texture images on the scene model to show a sense of depth on the screen, the initial scaling parameters are bound to the forward and backward axis of the virtual camera. This makes each layer of material image after the texture magnify when the virtual camera moves forward and shrink when the virtual camera moves backward, thereby further satisfying the requirement that the image size of the texture images on the scene model has a sense of depth on the screen when the virtual camera moves forward and backward.
[0098] As an example of S4, based on the example of S3 above, the computer device binds the initial scaling parameter ScaleR to the Y-axis of the virtual camera, the initial scaling parameter ScaleG to the Y-axis of the virtual camera, the initial scaling parameter ScaleB to the Y-axis of the virtual camera, and the initial scaling parameter ScaleA to the Y-axis of the virtual camera.
[0099] Furthermore, in this embodiment, to control the texture change rate in each material image layer, each material image layer also needs to have a time variation parameter. Considering the mapping order of the four material images, based on the principle that textures change faster near the edge and slower far away, the texture image closer to the virtual camera has a larger texture change rate, and the texture image farther away from the virtual camera has a smaller texture change rate. Therefore, the time variation parameter corresponding to the material image with the first texture is larger than the time variation parameter corresponding to the material image with the second texture. Based on this, this application provides a possible implementation method in which each material image layer is also configured with a time variation parameter. The configuration step of the time variation parameter may include, for example, the following S5 (not shown in the figure): according to the mapping order of the four material images, the time variation parameters corresponding to the four material images are configured to decrease sequentially from front to back.
[0100] Among them, the order of the four material images being applied to the scene model is the order in which the four material images are applied; the time variation parameter is a parameter that represents the rate of change over time.
[0101] Based on the time-varying parameters that control the texture change speed in each material image layer, the above-mentioned S5 takes into account the different distances of each material image layer from the virtual camera after mapping. Based on the mapping order of the four material images, the time-varying parameters corresponding to the four material images are configured to decrease sequentially from front to back. This makes the texture changes in the texture images closer to the virtual camera intersect with the texture changes in the texture images farther away from the virtual camera faster, and the texture changes in the texture images farther away from the virtual camera intersect with the texture changes in the texture images closer to the virtual camera slower. This simulates the visual effect that the texture changes faster at close range and slower at far range, further making the texture images on the scene model reflect a sense of depth on the screen.
[0102] As an example of S5, based on the above example, the R-channel material image is configured with a time-varying parameter TimeR, the G-channel material image with a time-varying parameter TimeG, the B-channel material image with a time-varying parameter TimeB, and the A-channel material image with a time-varying parameter TimeA. The computer device configures the time-varying parameters TimeR, TimeG, TimeB, and TimeA sequentially from front to back, based on the preceding and following mapping order of the R-channel, G-channel, B-channel, and A-channel material images. When the preceding and following mapping order of the R-channel, G-channel, B-channel, and A-channel material images is: R-channel material image → G-channel material image → B-channel material image → A-channel material image, the time-varying parameter TimeR can be 1, TimeG can be 0.8, TimeB can be 0.6, and TimeA can be 0.4.
[0103] See Figure 5 ,Should Figure 5 This is a schematic diagram illustrating how texture changes in a scene model's texture image reflect a sense of depth on the screen, as provided in an embodiment of this application. In the above... Figure 4 On this basis, Figure 5 Texture changes (e.g., line flow rates represented by solid lines) in texture images closer to the virtual camera intersect with texture changes (e.g., line flow rates represented by dashed lines) in texture images farther from the virtual camera; texture changes (e.g., line flow rates represented by dashed lines) in texture images farther from the virtual camera intersect with texture changes (e.g., line flow rates represented by solid lines) in texture images closer to the virtual camera.
[0104] Furthermore, in this embodiment, to control the visual effect of atmospheric influence on the color of each material image layer, each material image layer also needs to have an opacity parameter. To further meet the requirement of depth perception on the screen when the virtual camera moves forward and backward, considering that the distance between the virtual camera and each material image layer decreases as the virtual camera moves forward, the opacity parameter can be used to make each material image layer clearer. Conversely, when the virtual camera moves backward, the distance between the virtual camera and each material image layer increases, and the opacity parameter can be used to blur each material image layer. Therefore, it is necessary to associate the opacity parameter configured for each material image layer with the forward and backward axis of the virtual camera, so that the transparency of the material image layer on the scene model reflects depth perception on the screen when the virtual camera moves forward and backward. Based on this, this application provides a possible implementation method, where each material image layer is also configured with an opacity parameter. The method may also include, for example, S6 (not shown in the figure): binding the opacity parameter with the forward and backward axis of the virtual camera; each material image layer becomes clearer when the virtual camera moves forward, and becomes blurrier when the virtual camera moves backward.
[0105] Among them, the opacity parameter is the parameter whose color is affected by the atmosphere.
[0106] The opacity parameter configured in S6 for each material image layer is also used for the virtual camera to move back and forth. Based on the depth feeling of the texture images on the scene model on the screen, the opacity parameter is bound to the forward and backward axis of the virtual camera. This makes each material image layer after the texture layer clearer when the virtual camera moves forward and blurrier when the virtual camera moves backward. Thus, the transparency of the texture images on the scene model reflects the depth feeling on the screen when the virtual camera moves back and forth.
[0107] As an example of S6, based on the above example, the R channel material image is configured with the opacity parameter OpacityR, the G channel material image with the opacity parameter OpacityG, the B channel material image with the opacity parameter OpacityB, and the A channel material image with the opacity parameter OpacityA. The computer device binds the opacity parameter OpacityR to the forward / backward Y-axis of the virtual camera, the opacity parameter OpacityG to the Y-axis of the virtual camera, the opacity parameter OpacityB to the Y-axis of the virtual camera, and the opacity parameter OpacityA to the Y-axis of the virtual camera. This makes the R channel material image, G channel material image, B channel material image, and A channel material image clearer when the virtual camera moves forward, and the R channel material image, G channel material image, B channel material image, and A channel material image blurrier when the virtual camera moves backward.
[0108] In this embodiment, by binding the opacity parameter to the forward and backward axis of the virtual camera, each layer of material image after the texture becomes clearer when the virtual camera moves forward and becomes blurry when the virtual camera moves backward. This further allows the virtual camera to move forward and backward, and the transparency of the texture images on the scene model to reflect depth on the screen. Since the opacity parameters of the four material images are equal, they do not affect the forward and backward movement of the virtual camera. Furthermore, considering the order of the four material images, based on the principle that colors closer to the camera are less affected by the atmosphere and have clearer textures, while colors farther away are more affected by the atmosphere and have blurrier textures, texture images closer to the virtual camera are easier to become clearer than texture images farther away. Therefore, the opacity parameter corresponding to the material image with the texture at the front is larger than the opacity parameter corresponding to the material image with the texture at the back. Based on this, this application provides a possible implementation, where the opacity parameter configuration step may include, for example, S7 (not shown in the figure) or S8 (not shown in the figure).
[0109] S7: Configure the opacity parameters of the four material images to be equal.
[0110] S8: Based on the front and back mapping order of the four material images, configure the opacity parameters of the four material images to decrease sequentially from front to back.
[0111] The order in which the four material images are applied is the order in which they are applied to the scene model; the opacity parameter of the material image applied first is greater than the opacity parameter of the material image applied later.
[0112] The above-mentioned S7 takes into account that the opacity parameters of the four material images are all bound to the forward and backward axes of the virtual camera. When the virtual camera moves forward, each material image after the texture becomes clearer, and when the virtual camera moves backward, each material image after the texture becomes blurry. Moreover, the distance between each material image and the virtual camera in the four material images after the texture is relatively small. By configuring the opacity parameters of the four material images to be equal, the transparency of the texture images on the scene model can still reflect the sense of depth on the screen when the virtual camera moves forward and backward. The configuration of the opacity parameters of the four material images can be completed quickly and easily.
[0113] The aforementioned S8 binds the opacity parameters of the four material images to the forward and backward axes of the virtual camera. When the virtual camera moves forward, each material image after the texture becomes clearer, and when the virtual camera moves backward, each material image after the texture becomes blurry. Considering that each material image in the four material images after the texture is at a different distance from the virtual camera, based on the forward and backward texture order of the four material images, the opacity parameters of the four material images are configured to decrease sequentially from front to back. This makes it easier for texture images closer to the virtual camera to intersect with texture images farther away from the virtual camera to become clearer. The change in clarity of the four material images after the texture as the virtual camera moves forward and backward also satisfies the requirement of clear near objects and blurry far objects. Thus, as the virtual camera moves forward and backward, the transparency of the texture images on the scene model further reflects the sense of depth on the screen.
[0114] As an example of S7, based on the example of S6 above, the computer device is configured with the same opacity parameters OpacityR, OpacityG, OpacityB, and OpacityA.
[0115] As an example of S8, based on the example of S6 above, the computer device configures the opacity parameters OpacityR, OpacityG, OpacityB, and OpacityA in a sequentially decreasing order based on the preceding and following mapping sequence of the R-channel material image, G-channel material image, B-channel material image, and A-channel material image. When the preceding and following mapping sequence of the R-channel material image, G-channel material image, B-channel material image, and A-channel material image is: R-channel material image → G-channel material image → B-channel material image → A-channel material image, the opacity parameter OpacityR can be 0.8, the opacity parameter OpacityG can be 0.65, the opacity parameter OpacityB can be 0.5, and the opacity parameter OpacityA can be 0.3.
[0116] See Figure 6 ,Should Figure 6 This is a schematic diagram illustrating how the transparency of a texture image on a scene model, as provided in an embodiment of this application, creates a sense of depth on the screen. In the above... Figure 4 On this basis, Figure 6 In (a), the textures (e.g., lines) in the texture image become sharper as the virtual camera moves forward. Figure 6 In (b), textures (e.g., lines) in a texture image become blurred as the virtual camera moves backward; textures (e.g., lines) in a texture image closer to the virtual camera become sharper than textures (e.g., lines) in a texture image farther away from the virtual camera.
[0117] See Figure 7 ,Should Figure 7 This illustration shows the configuration of initial scaling parameters, distance scaling parameters, time variation parameters, and opacity parameters for each layer of a four-layer material image, as provided in an embodiment of this application. Based on the above example, the R channel material image of the RGBA material image is configured with initial scaling parameter ScaleR, distance scaling parameter ScalePosR, time variation parameter TimeR, and opacity parameter OpacityR; the G channel material image is configured with initial scaling parameter ScaleG, distance scaling parameter ScalePosG, time variation parameter TimeG, and opacity parameter OpacityG; the B channel material image is configured with initial scaling parameter ScaleB, distance scaling parameter ScalePosB, time variation parameter TimeB, and opacity parameter OpacityB; and the A channel material image is configured with initial scaling parameter ScaleA, distance scaling parameter ScalePosA, time variation parameter TimeA, and opacity parameter OpacityA.
[0118] In this embodiment of the application, when performing the above-described S301 to obtain a four-channel texture image, considering that the four-channel texture image is a texture image composed of a color channel texture image (composed of three single-channel texture images, monochrome texture images) and a transparency channel texture image, it is necessary to superimpose different single-channel texture images and transparency channel texture images on top of the different single-channel texture images and transparency channel texture images drawn in the color channel texture image to obtain a four-channel texture image. Based on this, this application provides a possible implementation method, and the above-described S301 may include, for example, the following S301a-S301b (not shown in the figure).
[0119] S301a: Draw different single-channel texture images in the color channel texture image, and draw the transparency channel texture image.
[0120] S301b: Overlay different single-channel texture images and alpha channel texture images to obtain a four-channel texture image.
[0121] Among them, the different single-channel texture images in the color channel texture image include the red channel texture image, the green channel texture image and the blue channel texture image; the red channel texture image is the image that stores the red component of the pixel; the green channel texture image is the image that stores the green component of the pixel; and the blue channel texture image is the image that stores the blue component of the pixel.
[0122] The above S301a-S301b addresses the case where a four-channel texture image is composed of a color channel texture image (i.e., a three-monochrome texture image) and a alpha channel texture image. Different single-channel texture images and alpha channel texture images are drawn in the color channel texture image to provide a base image for obtaining the four-channel texture image. Different single-channel texture images and alpha channel texture images are superimposed to obtain the four-channel texture image, thus accurately constructing the four-channel texture image to obtain the four-channel texture image.
[0123] As an example of S301a-S301b, based on the examples of S301-S302 above, the computer device draws an R-channel texture image, a G-channel texture image, a B-channel texture image, and an A-channel texture image; the computer device overlays the R-channel texture image, the G-channel texture image, the B-channel texture image, and the A-channel texture image to obtain an RGBA texture image.
[0124] See Figure 8 ,Should Figure 8 This is a schematic diagram illustrating different single-channel texture images and alpha channel texture images in a color channel texture image provided in an embodiment of this application. Based on the examples in S301a-S301b above, Figure 8 (a) represents the R channel texture image, where white represents the texture; Figure 8 (b) represents the G channel texture image, where white represents the texture; Figure 8 (c) represents the B channel texture image, where white represents the texture; Figure 8 In the image, (d) represents the texture image of the A channel, where white represents the texture.
[0125] See Figure 9 ,Should Figure 9 This is a schematic diagram illustrating the storage of a color channel texture image, different single-channel texture images within the color channel texture image, and a transparency channel texture image, as provided in an embodiment of this application. In the above... Figure 8 Based on this, the color channel texture image is stored in the RGB channel, the R channel texture image is stored in the R channel, the G channel texture image is stored in the G channel, the B channel texture image is stored in the B channel, and the A channel texture image is stored in the A channel.
[0126] See Figure 10 ,Should Figure 10 This is a schematic diagram of a four-channel texture image provided in an embodiment of this application. In the above... Figure 8 and the above Figure 9 Based on this, Figure 10 The four-channel texture image is obtained by overlaying the R-channel texture image, G-channel texture image, B-channel texture image, and A-channel texture image.
[0127] In this embodiment of the application, when performing the above-described S301a to draw different single-channel texture images in the color channel texture image and to draw the alpha channel texture image, considering that the different single-channel texture images and alpha channel texture images in the color channel texture image need to be sampled and scaled, it is necessary to draw different single-channel texture images and alpha channel texture images based on reserving non-texture areas at the image edges. Based on this, this application provides a possible implementation method, and the above-described S301a may include, for example, drawing different single-channel texture images and alpha channel texture images after reserving non-texture areas at the image edges.
[0128] Among them, the edges of different single-channel texture images and alpha channel texture images all have non-texture areas.
[0129] The premise of this method for drawing different single-channel texture images and alpha channel texture images is to reserve non-textured areas at the image edges. These non-textured areas at the image edges can avoid boundary overflow and interpolation errors when subsequently sampled and scaled, thereby ensuring the processing stability and visual integrity of different single-channel texture images and alpha channel texture images.
[0130] As an example, based on the example of S301a above, the computer device draws an R-channel texture image, a G-channel texture image, a B-channel texture image, and an A-channel texture image by reserving a non-textured area at the edge of the image.
[0131] In this embodiment, based on the inclusion of a virtual camera within the scene model, and considering that the virtual camera can move or rotate arbitrarily, a spherical model is constructed and defined as the scene model. The virtual camera can move or rotate freely within the model while maintaining a continuous, symmetrical, and stable view of the model's interior. Based on this, this application provides a possible implementation method. The scene model construction steps may include, for example, the following S9 (not shown in the figure): constructing a spherical model as the scene model; the virtual camera moving or rotating within the spherical model.
[0132] The sphere model is a model composed of multiple facets, each of which is equidistant from the center of the sphere.
[0133] The above-mentioned S9 constructs a spherical model as the scene model. The model includes a virtual camera. The virtual camera moves or rotates inside the spherical model, so that the virtual camera can see the continuous, symmetrical and stable interior of the model no matter how it moves or rotates. This avoids the virtual camera seeing the stretched or compressed interior of the model when it moves or rotates, thus avoiding affecting the visual effect.
[0134] See Figure 11 ,Should Figure 11This is a schematic diagram of a sphere model provided in an embodiment of this application. Wherein, Figure 11 In the middle (a), a sphere model is composed of countless facets. The facet with normals is the front, which displays the model, and the facet without normals is the back, which does not display the model and is visually transparent. The normals of each facet of the sphere model face inward. The inner wall of the sphere is rendered, and the outer wall of the sphere is transparent. Figure 11 In the middle (b), another sphere model is composed of countless facets. The side with normals is the front and displays the model, while the side without normals is the back and does not display the model. It is visually transparent. The normals of each facet of the sphere model face outwards. The outer wall of the sphere model is rendered, while the inner wall of the sphere is transparent.
[0135] See Figure 12 ,Should Figure 12 This is a schematic diagram of a single facet provided in an embodiment of this application. Wherein, Figure 12 In the middle (a), there is a single face, each vertex of which has a normal, which is shown on the face (white-filled face) where the face is rendered. Figure 12 (b) indicates Figure 12 The side of the face shown in (a) has a normal, which is the side that is rendered (the white-filled side). Figure 12 (c) represents Figure 12 The other side of the face shown in (a) has no normal, that is, the side that is not rendered (the black-filled side), and is visually transparent.
[0136] See Figure 13 ,Should Figure 13 This is a schematic diagram illustrating the spatial relationship between a scene model, virtual attack props, and a virtual camera, provided in an embodiment of this application. Based on the above... Figure 4 , Figure 5 and Figure 6 The scene model is a sphere model, and the interior of this sphere model contains virtual attack props. Figure 13 The model consists of a rectangular prism and a virtual camera. The virtual camera can capture virtual attack props inside the spherical model. The virtual camera can move or rotate freely inside the model to see the continuous, symmetrical, and stable interior of the model.
[0137] See Figure 14 ,Should Figure 14 This is a schematic diagram illustrating a processing step for a textured image provided in an embodiment of this application. The step includes the following steps: S1401-S1407.
[0138] S1401: After reserving non-textured areas at the image edges, draw different single-channel texture images and alpha channel texture images.
[0139] S1402: Overlay different single-channel texture images and alpha channel texture images to obtain a four-channel texture image.
[0140] S1403: Perform single-channel sampling on the four-channel texture image based on the two-dimensional coordinates of the screen to obtain four material images. Each material image is configured with initial scaling parameters, distance scaling parameters, time variation parameters, and opacity parameters.
[0141] S1404: Construct a sphere model as a scene model, and the virtual camera moves or rotates inside the sphere model.
[0142] S1405: Apply four layers of material images to the scene model.
[0143] S1406: Obtain the forward and backward movement parameters of the virtual camera.
[0144] S1407: The forward and backward movement parameters are determined as the scaling factor of the distance scaling parameters. When the virtual camera moves forward, the forward and backward movement parameters increase, and when the virtual camera moves backward, the forward and backward movement parameters decrease. When the virtual camera moves forward, the material image of each layer after the texture is enlarged, and when the virtual camera moves backward, the material image of each layer after the texture is reduced.
[0145] Specifically, the initial scaling parameter decreases sequentially from front to back according to the order of the four material images; the distance scaling parameter decreases sequentially from front to back according to the order of the four material images; the time variation parameter decreases sequentially from front to back according to the order of the four material images; and the opacity parameter decreases sequentially from front to back according to the order of the four material images.
[0146] It should be noted that, based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods.
[0147] The texture image processing method provided in this application embodiment obtains four layers of material images by sampling four-channel texture images from a single channel of screen two-dimensional coordinates. The four layers of material images are then mapped onto the scene model inside the model, including a virtual camera. The distance scaling parameters configured for each layer of material image are bound to the front-back axis of the virtual camera. When the virtual camera moves up and down, left and right, or rotates, the texture images on the scene model do not change on the screen. When the virtual camera moves back and forth, the texture images on the scene model can move with the virtual camera. When the virtual camera moves forward, the texture images on the scene model are enlarged, and when the virtual camera moves backward, the texture images on the scene model are shrunk to simulate a sense of depth, thereby simulating a pseudo-three-dimensional feel on a two-dimensional plane in a three-dimensional scene.
[0148] based on Figure 2Corresponding to the processing method for texture images provided in the embodiments, this application also provides a processing apparatus for texture images, see below. Figure 15 ,Should Figure 15 This is a structural diagram of a texture image processing apparatus 1500 provided in an embodiment of this application. The texture image processing apparatus 1500 includes: an acquisition unit 1501, a sampling unit 1502, a mapping unit 1503, and a binding unit 1504.
[0149] Acquisition unit 1501 is used to acquire a four-channel texture image; the four-channel texture image includes a color channel texture image and a transparency channel texture image;
[0150] The sampling unit 1502 is used to perform single-channel sampling on the four-channel texture image according to the two-dimensional coordinates of the screen to obtain four-layer material images; each layer of material image is configured with distance scaling parameters.
[0151] Texture unit 1503 is used to apply four layers of material images to the scene model; the scene model includes a virtual camera.
[0152] Binding unit 1504 is used to bind the distance scaling parameter to the forward and backward axis of the virtual camera; when the virtual camera moves forward, the texture image of each layer after the texture is enlarged, and when the virtual camera moves backward, the texture image of each layer after the texture is reduced.
[0153] In one possible implementation, binding unit 1504 is specifically used for:
[0154] Obtain the forward and backward movement parameters of the virtual camera;
[0155] The forward and backward movement parameters are determined as the scaling factor of the distance scaling parameters; the forward and backward movement parameters increase when the virtual camera moves forward and decrease when the virtual camera moves backward.
[0156] In one possible implementation, the device 1500 further includes: a first configuration unit;
[0157] The first configuration unit is used for:
[0158] Configure the distance scaling parameters for the four material layers to be equal; or,
[0159] Based on the front and back mapping order of the four material images, the distance scaling parameters corresponding to the four material images are configured to decrease sequentially from front to back.
[0160] In one possible implementation, each material image is also configured with initial scaling parameters, and the device 1500 further includes: a second configuration unit;
[0161] The second configuration unit is used to configure the initial scaling parameters of the four material images to decrease sequentially from front to back, according to the front and back mapping order of the four material images.
[0162] In one possible implementation, binding unit 1504 is also used for:
[0163] Bind the initial scaling parameters to the forward and backward axes of the virtual camera.
[0164] In one possible implementation, each layer of material image is also configured with time-varying parameters, and the device 1500 further includes: a third configuration unit;
[0165] The third configuration unit is used to configure the time change parameters corresponding to the four material images to decrease sequentially from front to back, according to the front and back mapping order of the four material images.
[0166] In one possible implementation, each material image is also configured with an opacity parameter, and the binding unit 1504 is further used for:
[0167] Bind the opacity parameter to the forward and backward axis of the virtual camera; when the virtual camera moves forward, the image of each material layer after the texture becomes clearer, and when the virtual camera moves backward, the image of each material layer after the texture becomes blurry.
[0168] In one possible implementation, the device 1500 further includes: a fourth configuration unit;
[0169] The fourth configuration unit is used for:
[0170] Configure the opacity parameters of the four material images to be equal; or,
[0171] Based on the order of the four material images being mapped, the opacity parameters of the four material images are configured to decrease sequentially from front to back.
[0172] In one possible implementation, the acquisition unit 1501 is specifically used for:
[0173] Draw different single-channel texture images in the color channel texture image, and draw the alpha channel texture image;
[0174] Different single-channel texture images and alpha channel texture images are overlaid to obtain a four-channel texture image.
[0175] In one possible implementation, the acquisition unit 1501 is specifically used for:
[0176] After reserving non-textured areas at the edges of the image, different single-channel texture images and alpha channel texture images are drawn.
[0177] In one possible implementation, the device 1500 further includes: a building unit;
[0178] The building block is used to construct a sphere model as a scene model; the virtual camera moves or rotates inside the sphere model.
[0179] As can be seen from the above technical solution, the texture image processing device includes an acquisition unit, a sampling unit, a mapping unit, and a binding unit. The acquisition unit acquires a four-channel texture image, including a color channel texture image and a transparency channel texture image. This four-channel texture image is the base image for texture mapping of the scene model. The sampling unit samples the four-channel texture image using a single channel based on the screen's two-dimensional coordinates, obtaining four layers of material images. This provides a basis for ensuring that after texture mapping of the scene model is implemented, the texture images on the scene model will not change on the screen even if the virtual camera moves or rotates arbitrarily. Each material image layer is configured with distance scaling parameters, providing implementation parameters to meet the requirement that the texture images on the scene model have a sense of depth on the screen when the virtual camera moves forward or backward. The texturing unit maps four layers of material images onto the scene model, including the virtual camera, and completes the texture mapping for the scene model. When the virtual camera moves up and down, left and right, or rotates, the texture images on the scene model will not change on the screen. The binding unit binds the distance scaling parameters to the forward and backward axis of the virtual camera, so that each layer of material image after the texture is enlarged when the virtual camera moves forward and each layer of material image after the texture is enlarged when the virtual camera moves backward, so as to meet the requirement that the texture images on the scene model have a sense of depth on the screen when the virtual camera moves forward and backward.
[0180] This application also provides a computer device, which may be a server, see [link to previous document]. Figure 16 ,Should Figure 16 This application provides a structural diagram of a server 1600. The server 1600 can vary significantly due to different configurations or performance. It may include one or more processors, such as a central processing unit (CPU) 1622, and a memory 1632, as well as one or more storage media 1630 (e.g., one or more mass storage devices) for storing application programs 1642 or data 1644. The memory 1632 and storage media 1630 can be temporary or persistent storage. The program stored in the storage media 1630 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server. Furthermore, the CPU 1622 may be configured to communicate with the storage media 1630 and execute the series of instruction operations stored in the storage media 1630 on the server 1600.
[0181] Server 1600 may also include one or more power supplies 1626, one or more wired or wireless network interfaces 1650, one or more input / output interfaces 1658, and / or one or more operating systems 1641, such as Windows Server. TM Mac OS X TM Unix TM Linux TM FreeBSD TM etc.
[0182] In this embodiment, the central processing unit 1622 in the server 1600 can execute the methods provided in the various optional implementations of the above embodiments.
[0183] The computer device provided in this application embodiment can also be a terminal, see [link to relevant documentation]. Figure 17 ,Should Figure 17 This is a structural diagram of a terminal provided in an embodiment of this application. Taking a smartphone as an example, the smartphone includes: a radio frequency (RF) circuit 1710, a memory 1720, an input unit 1730, a display unit 1740, a sensor 1750, an audio circuit 1760, a wireless Fidelity (WiFi) module 1770, a processor 1780, and a power supply 1790, etc. The input unit 1730 may include a touch panel 1731 and other input devices 1732, the display unit 1740 may include a display panel 1741, and the audio circuit 1760 may include a speaker 1761 and a microphone 1762. Those skilled in the art will understand that... Figure 17 The smartphone structure shown does not constitute a limitation on smartphones and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0184] The memory 1720 can be used to store software programs and modules. The processor 1780 executes various functions and data processing of the smartphone by running the software programs and modules stored in the memory 1720. The memory 1720 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the smartphone (such as audio data, phonebook, etc.). In addition, the memory 1720 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0185] The processor 1780 is the control center of the smartphone, connecting various parts of the smartphone via various interfaces and lines. It performs various functions and processes data by running or executing software programs and / or modules stored in the memory 1720 and by accessing data stored in the memory 1720. Optionally, the processor 1780 may include one or more processing units; preferably, the processor 1780 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1780.
[0186] In this embodiment, the processor 1780 in the smartphone can execute the methods provided in the various optional implementations of the above embodiments.
[0187] According to one aspect of this application, a computer-readable storage medium is provided for storing a computer program that, when run on a computer device, causes the computer device to perform the methods provided in various optional implementations of the above embodiments.
[0188] According to one aspect of this application, a computer program product is provided, comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the methods provided in various optional implementations of the above embodiments.
[0189] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.
[0190] The terms "first," "second," etc., used in this application's specification and the foregoing drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0191] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0192] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0193] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0194] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing computer programs, such as USB flash drives, portable hard drives, read-only memory (ROM), RAM, magnetic disks, or optical disks.
[0195] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0196] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for processing texture images, characterized in that, The method includes: Acquire a four-channel texture image; the four-channel texture image includes a color channel texture image and a transparency channel texture image; The four-channel texture image is sampled in a single channel according to the two-dimensional coordinates on the screen to obtain four material images; each material image is configured with a distance scaling parameter. The four-layer material images are mapped onto the scene model; the scene model includes a virtual camera. The distance scaling parameter is bound to the forward and backward axis of the virtual camera; when the virtual camera moves forward, the texture image of each layer after the texture is enlarged, and when the virtual camera moves backward, the texture image of each layer after the texture is reduced; Wherein, binding the distance scaling parameter to the forward and backward axis of the virtual camera includes: Obtain the forward and backward movement parameters of the virtual camera; The forward and backward movement parameters are determined as the scaling factor of the distance scaling parameters; the forward and backward movement parameters increase when the virtual camera moves forward and decrease when the virtual camera moves backward.
2. The method according to claim 1, characterized in that, The configuration steps for the distance scaling parameters include: Configure the distance scaling parameters corresponding to the four material images to be equal; or, Based on the front-to-back mapping order of the four material layers, the distance scaling parameters corresponding to the four material layers are configured to decrease sequentially from front to back.
3. The method according to claim 1, characterized in that, Each material image layer is also configured with initial scaling parameters, and the configuration steps for the initial scaling parameters include: Based on the front-to-back mapping order of the four material images, the initial scaling parameters corresponding to the four material images are configured to decrease sequentially from front to back.
4. The method according to claim 3, characterized in that, The method further includes: Bind the initial scaling parameters to the forward and backward axis of the virtual camera.
5. The method according to claim 1, characterized in that, Each material image layer is also configured with a time variation parameter, and the configuration steps for the time variation parameter include: Based on the front-to-back mapping order of the four material layers, the time variation parameters corresponding to the four material layers are configured to decrease sequentially from front to back.
6. The method according to claim 1, characterized in that, Each material image layer is also configured with an opacity parameter, and the method further includes: The opacity parameter is bound to the forward and backward axis of the virtual camera; when the virtual camera moves forward, the material image of each layer after the texture becomes clearer, and when the virtual camera moves backward, the material image of each layer after the texture becomes blurry.
7. The method according to claim 6, characterized in that, The steps for configuring the opacity parameter include: Configure the opacity parameters corresponding to the four material images to be equal; or, Based on the front-to-back mapping order of the four material images, the opacity parameters corresponding to the four material images are configured to decrease sequentially from front to back.
8. The method according to claim 1, characterized in that, The acquisition of the four-channel texture image includes: Draw different single-channel texture images in the color channel texture image, and draw the transparency channel texture image; The different single-channel texture images and the alpha channel texture image are overlaid to obtain the four-channel texture image.
9. The method according to claim 8, characterized in that, The step of drawing different single-channel texture images in the color channel texture image and drawing the transparency channel texture image includes: After reserving non-textured areas at the image edges, different single-channel texture images and transparent channel texture images are drawn.
10. The method according to claim 1, characterized in that, The steps for constructing the scene model include: A spherical model is constructed as the scene model; the virtual camera moves or rotates inside the spherical model.
11. A processing apparatus for texture images, characterized in that, The device includes: an acquisition unit, a sampling unit, a mapping unit, and a binding unit; The acquisition unit is used to acquire a four-channel texture image; the four-channel texture image includes a color channel texture image and a transparency channel texture image; The sampling unit is used to perform single-channel sampling on the four-channel texture image according to the two-dimensional coordinates of the screen to obtain four material images; each material image is configured with a distance scaling parameter. The mapping unit is used to apply the four-layer material images to the scene model; the scene model includes a virtual camera. The binding unit is used to bind the distance scaling parameter to the forward and backward axis of the virtual camera; when the virtual camera moves forward, the texture image of each layer after the texture is enlarged, and when the virtual camera moves backward, the texture image of each layer after the texture is reduced.
12. A computer device, characterized in that, The computer device includes a processor and memory: The memory is used to store computer programs and to transfer the computer programs to the processor; The processor is configured to execute the method according to any one of claims 1-10 according to instructions in the computer program.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program that, when run on a computer device, causes the computer device to perform the method according to any one of claims 1-10.
14. A computer program product, comprising a computer program, characterized in that, When the computer program is run on a computer device, it causes the computer device to perform the method according to any one of claims 1-10.