Virtual asset processing method and apparatus, storage medium, and electronic device
Patent Information
- Application Number
- CN202310968972.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-02
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2043-08-02
AI Technical Summary
[0004]本公开至少部分实施例提供了一种虚拟资产的处理方法、装置、存储介质及电子装置,以至少解决相关技术中对虚拟资产进行处理的效率较低的技术问题
[0009] In at least some embodiments of this disclosure, the method involves obtaining an original virtual asset sequence; mapping the center points of any two original virtual assets in the original virtual asset sequence based on the origin information of the original virtual asset sequence to obtain mapping data for any two original virtual assets; and modifying multiple original virtual assets based on the mapping data to obtain multiple target virtual assets. It should be noted that the origin information is used to characterize the position information obtained by mapping the origin of the world coordinate system to the screen coordinate system. The mapping data includes one or more of the following: scaling data for scaling multiple original virtual assets, offset data for offsetting multiple original virtual assets, and clipping data for clipping multiple original virtual assets. When modifying virtual assets, there is no need to use content production tools; multiple original virtual assets can be modified directly based on the above mapping data to obtain multiple target virtual assets. This achieves the technical effect of simplifying the virtual asset processing flow and improving processing efficiency by using content production tools only when generating the original virtual asset sequence, without needing to re-enter the content production tool for virtual asset processing and output. This solves the technical problem of low efficiency in processing virtual assets in related technologies.
Smart Images

Figure CN117224963B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computers, and more specifically, to a method, apparatus, storage medium, and electronic device for processing virtual assets. Background Technology
[0002] Currently, in game production that uses frame-by-frame animation as its art medium, there is often a need to map the center points of multiple sets of frame-by-frame assets to each other. The main approach to address this is to develop a toolchain within the digital content production tools used for baking frame-by-frame assets, and then modify the rendering environment for baking these assets in batches. However, this method is cumbersome and inefficient for processing virtual assets.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] This disclosure provides at least some embodiments of a method, apparatus, storage medium, and electronic device for processing virtual assets, in order to at least solve the technical problem of low efficiency in processing virtual assets in the related art.
[0005] According to one embodiment of this disclosure, a method for processing virtual assets is provided, comprising: acquiring an original virtual asset sequence, wherein multiple original virtual assets in the original virtual asset sequence are used to generate a video; mapping the center points of any two original virtual assets in the original virtual asset sequence based on the origin information of the original virtual asset sequence to obtain mapping data of any two original virtual assets, wherein the origin information is used to characterize the position information obtained by mapping the origin of the world coordinate system to the screen coordinate system, and the mapping data includes one or more of the following: scaling data for scaling multiple original virtual assets, offset data for offsetting multiple original virtual assets, and cropping data for cropping multiple original virtual assets; modifying multiple original virtual assets based on the mapping data to obtain multiple target virtual assets.
[0006] According to one embodiment of this disclosure, a virtual asset processing apparatus is also provided, comprising: a sequence acquisition module for acquiring an original virtual asset sequence, wherein multiple original virtual assets in the original virtual asset sequence are used to generate a video; an asset mapping module for mapping the center points of any two original virtual assets in the original virtual asset sequence based on the origin information of the original virtual asset sequence, thereby obtaining mapping data of any two original virtual assets, wherein the origin information is used to characterize the position information obtained by mapping the origin of the world coordinate system to the screen coordinate system, and the mapping data includes one or more of the following: scaling data for scaling multiple original virtual assets, offset data for offsetting multiple original virtual assets, and cropping data for cropping multiple original virtual assets; and an asset modification module for modifying multiple original virtual assets based on the mapping data to obtain multiple target virtual assets.
[0007] According to one embodiment of the present disclosure, a computer-readable storage medium is also provided, which stores a computer program, wherein the computer program is configured to execute the virtual asset processing method described in any of the preceding claims when running.
[0008] According to one embodiment of this disclosure, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the virtual asset processing method of any of the above claims.
[0009] In at least some embodiments of this disclosure, the method involves obtaining an original virtual asset sequence; mapping the center points of any two original virtual assets in the original virtual asset sequence based on the origin information of the original virtual asset sequence to obtain mapping data for any two original virtual assets; and modifying multiple original virtual assets based on the mapping data to obtain multiple target virtual assets. It should be noted that the origin information is used to characterize the position information obtained by mapping the origin of the world coordinate system to the screen coordinate system. The mapping data includes one or more of the following: scaling data for scaling multiple original virtual assets, offset data for offsetting multiple original virtual assets, and clipping data for clipping multiple original virtual assets. When modifying virtual assets, there is no need to use content production tools; multiple original virtual assets can be modified directly based on the above mapping data to obtain multiple target virtual assets. This achieves the technical effect of simplifying the virtual asset processing flow and improving processing efficiency by using content production tools only when generating the original virtual asset sequence, without needing to re-enter the content production tool for virtual asset processing and output. This solves the technical problem of low efficiency in processing virtual assets in related technologies. Attached Figure Description
[0010] The accompanying drawings, which are included to provide a further understanding of this disclosure and form part of this application, illustrate exemplary embodiments of this disclosure and are used to explain this disclosure, but do not constitute an undue limitation of this disclosure. In the drawings:
[0011] Figure 1 This is a hardware structure block diagram of a mobile terminal for a virtual asset processing method according to an embodiment of this disclosure.
[0012] Figure 2 This is a flowchart of a method for processing virtual assets according to one embodiment of the present disclosure;
[0013] Figure 3a This is a schematic diagram of a virtual asset according to one embodiment of the present disclosure;
[0014] Figure 3b This is a schematic diagram of a scaled-up virtual asset according to one embodiment of the present disclosure;
[0015] Figure 3c This is a schematic diagram of a successfully modified virtual asset according to one embodiment of the present disclosure;
[0016] Figure 4a This is a schematic diagram of a virtual asset with texture boundary overflow according to one embodiment of the present disclosure;
[0017] Figure 4b This is a schematic diagram of a cropped virtual asset according to one embodiment of the present disclosure;
[0018] Figure 5 This is a structural block diagram of a virtual asset processing apparatus according to one embodiment of the present disclosure;
[0019] Figure 6 This is a schematic diagram of an electronic device according to an embodiment of the present disclosure. Detailed Implementation
[0020] To enable those skilled in the art to better understand the present disclosure, the technical solutions of the present disclosure will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of the present disclosure, and not all embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present disclosure.
[0021] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this disclosure 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 disclosure described herein can be implemented 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.
[0022] In one possible implementation, addressing the technical problem of low efficiency in processing virtual assets, which is commonly used in the field of virtual asset processing despite the inventor's practical experience and careful research, this disclosure proposes a method for processing virtual assets. This method involves obtaining an original virtual asset sequence; mapping the center points of any two original virtual assets in the original sequence based on the origin information of the original virtual asset sequence to obtain mapping data for any two original virtual assets; and modifying multiple original virtual assets based on the mapping data to obtain multiple target virtual assets. It should be noted that the origin information is used to characterize the origin of the world coordinate system. The position information obtained by mapping points to the screen coordinate system includes one or more of the following: scaling data for scaling multiple original virtual assets, offset data for offsetting multiple original virtual assets, and clipping data for clipping multiple original virtual assets. When modifying virtual assets, there is no need to use content production tools. Multiple original virtual assets can be modified directly based on the above mapping data to obtain multiple target virtual assets. This achieves the goal of using content production tools only when generating the original virtual asset sequence, without having to re-enter the content production tools for virtual asset processing and output. This simplifies the virtual asset processing flow and improves processing efficiency, thereby solving the technical problem of low efficiency in processing virtual assets in related technologies.
[0023] The methods and embodiments described above in this disclosure can be executed on a mobile terminal, a computer terminal, or a similar computing device. Taking a mobile terminal as an example, the mobile terminal can be a smartphone, tablet computer, PDA, mobile internet device, game console, or other terminal device. Figure 1 This is a hardware structure block diagram of a mobile terminal for a virtual asset processing method according to an embodiment of this disclosure. Figure 1As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. Processor 102 (processor 102 may include, but is not limited to, a central processing unit (CPU), graphics processing unit (GPU), digital signal processing (DSP) chip, microprocessor (MCU), programmable logic device (FPGA), neural network processor (NPU), tensor processor (TPU), artificial intelligence (AI) type processor, etc.) and memory 104 for storing data. In one embodiment of this disclosure, it may also include: input / output device 108 and display device 110.
[0024] In some optional embodiments primarily focused on gaming scenarios, the aforementioned device may also provide a human-computer interaction interface with a touch-sensitive surface. This interface can sense finger contact and / or gestures to interact with a graphical user interface (GUI). The human-computer interaction functions may include the following: creating web pages, drawing, word processing, creating electronic documents, playing games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music, and / or web browsing, etc. Executable instructions for performing the aforementioned human-computer interaction functions are configured / stored in one or more processor-executable computer program products or readable storage media.
[0025] Those skilled in the art will understand that Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0026] According to one embodiment of this disclosure, an embodiment of a method for processing virtual assets is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0027] Figure 2 This is a flowchart of a method for processing virtual assets according to one embodiment of this disclosure, such as... Figure 2 As shown, the method includes the following steps:
[0028] Step S202: Obtain the original virtual asset sequence, wherein multiple original virtual assets in the original virtual asset sequence are used to generate a video.
[0029] The original virtual asset sequence can be understood as a sequence containing multiple original virtual assets directly generated by the content production tool. Virtual assets can be understood as a collection of digital assets existing in the virtual world, including but not limited to virtual currency, virtual props, virtual real estate, virtual identity, etc. Virtual assets can be traded, transferred and used in the virtual world. In this embodiment of the disclosure, multiple original virtual assets can be multiple frame images used to generate video.
[0030] Understandably, since each virtual asset is produced individually using content production tools, there will be differences between each virtual asset; that is, different virtual assets correspond to different spaces and resolutions.
[0031] It should be noted that since all virtual assets correspond to the same virtual space, only the rendering and display on the screen are different, the aforementioned space can be understood as the display space after rendering and display.
[0032] In one alternative embodiment, multiple original virtual assets can be used to generate a video using video editing software.
[0033] Step S204: Based on the origin information of the original virtual asset sequence, perform center point mapping on any two original virtual assets in the original virtual asset sequence to obtain the mapping data of any two original virtual assets. The origin information is used to represent the position information obtained by mapping the origin of the world coordinate system to the screen coordinate system. The mapping data includes one or more of the following: scaling data for scaling multiple original virtual assets, offset data for offsetting multiple original virtual assets, and clipping data for clipping multiple original virtual assets.
[0034] In this context, origin information can be understood as the coordinate information of the origin of the virtual space corresponding to the original virtual asset sequence, that is, the world coordinate origin of the virtual space. Center point mapping can be understood as mapping the center point of one original virtual asset to another point, so that the other point coincides with the center point of another original virtual asset. Mapping data can be understood as data that can fulfill the center point mapping requirement, that is, data that can map the center points of one original virtual asset to the center points of another original virtual asset. This can include, but is not limited to, scaling data, offset data, and clipping data. The world coordinate system can be understood as a coordinate system used to describe the position and orientation of objects in a virtual scene. It is usually a three-dimensional coordinate system that uses three coordinate axes (usually X, Y, and Z axes) to represent the position in space. In a virtual scene, each object has a position and orientation relative to the world coordinate system. The screen coordinate system can be understood as the camera's screen coordinate system. Scaling data can be understood as data used to scale virtual assets. Offset data can be understood as data used to offset virtual assets. Clipping data can be understood as data used to clip virtual assets.
[0035] In an alternative embodiment, the origin of the world coordinate system can be represented by float3(0,0,0).
[0036] It should be noted that recording the origin information of the original virtual asset sequence facilitates subsequent mapping between multiple other original virtual assets. Without recording the origin information, subsequent processes cannot be supported.
[0037] It is understandable that center point mapping of any two original virtual assets in the original virtual asset sequence can achieve alignment and matching between these two original virtual assets. This process is very important for animation compositing, special effects production, and scene building.
[0038] Specifically, in a virtual scene, center point mapping between any two original virtual assets in a sequence of virtual assets can have the following benefits: Different virtual assets in a sequence may come from different sources, and their center point positions may differ. By mapping the center points, they can be aligned to the same position, making animation transitions smoother. Some special effects may need to interact with the virtual asset sequence; for example, an explosion effect requires precise matching of the explosion's center point position. By mapping the center points, the position of the special effect and the virtual asset sequence can be ensured to be consistent, making the effect more realistic. In scene building, it may be necessary to combine different virtual assets, such as compositing characters and backgrounds. By mapping the center points, the positions of multiple virtual assets can be easily aligned, improving building efficiency. In short, mapping the center points of different virtual assets in a sequence can improve the alignment and matching degree between assets, making animation production, special effects production, and scene building more accurate and efficient.
[0039] Step S206: Modify multiple original virtual assets based on the mapping data to obtain multiple target virtual assets.
[0040] Among them, multiple target virtual assets can be understood as virtual assets obtained by modifying multiple original virtual assets based on mapping data.
[0041] Understandably, through the above process, a tool independent of digital content production tools can be created to accurately map the center points of multiple sets of sequence frame assets to each other, while also having strong versatility, significantly improving the efficiency of modifying such assets and reducing game development costs.
[0042] Through the above steps, the process involves obtaining an original virtual asset sequence; mapping the center points of any two original virtual assets in the sequence based on their origin information to obtain mapping data; and modifying multiple original virtual assets based on this mapping data to obtain multiple target virtual assets. It should be noted that the origin information represents the position information obtained by mapping the origin of the world coordinate system to the screen coordinate system. The mapping data includes one or more of the following: scaling data for scaling multiple original virtual assets, offset data for offsetting multiple original virtual assets, and clipping data for clipping multiple original virtual assets. When modifying virtual assets, there is no need to use content production tools; multiple target virtual assets can be modified directly based on the above mapping data. This achieves the goal of using content production tools only when generating the original virtual asset sequence, eliminating the need to re-enter the content production tools for virtual asset processing and output. This simplifies the virtual asset processing flow, improves processing efficiency, and solves the technical problem of low efficiency in virtual asset processing in related technologies.
[0043] Optionally, based on the origin information of the original virtual asset sequence, center point mapping is performed on any two original virtual assets in the original virtual asset sequence to obtain mapping data for any two original virtual assets. This includes: obtaining attribute information of any two original virtual assets, wherein the attribute information includes at least pixel size and coordinate system information; determining the virtual asset to be mapped and the standard virtual asset among the two virtual assets based on the pixel size; mapping the coordinate system information of the virtual asset to be mapped based on the standard coordinate system information of the standard virtual asset to obtain scaling data; restoring the coordinate system information to be mapped based on the origin information to obtain offset data; and mapping the pixel size of the virtual asset to be mapped based on the standard coordinate system information to obtain cropping data.
[0044] Among them, attribute information can be understood as information that reflects the specific characteristics of virtual assets, which may include, but is not limited to, pixel size and coordinate system information. The virtual asset to be mapped can be understood as the virtual asset that needs to be mapped from any two original virtual assets mentioned above. The standard virtual asset can be understood as the virtual asset that serves as the mapping standard from any two original virtual assets mentioned above. The standard coordinate system information can be understood as the coordinate system information corresponding to the standard virtual asset. The coordinate system information to be mapped can be understood as the coordinate system information corresponding to the virtual asset to be mapped. The pixel size to be mapped can be understood as the pixel size of the virtual asset to be mapped.
[0045] Understandably, since multiple sets of assets may have different pixel precision, it is necessary to unify the pixel unit. That is, it is necessary to unify the unit for assets with lower pixel precision. Therefore, based on the pixel size, determine the virtual asset to be mapped and the standard virtual asset among any two virtual assets. For example, the virtual asset with smaller pixel size can be used as the standard virtual asset, and the virtual asset with larger pixel size can be used as the virtual asset to be mapped. The virtual asset to be mapped needs to be modified according to the pixel size of the standard virtual asset.
[0046] Specifically, by using the above methods to obtain scaling data, offset data, and cropping data, multiple original virtual assets can be modified based on the above data to obtain multiple target virtual assets. This achieves the goal of using the content production tool only when generating the original virtual asset sequence, without having to re-enter the content production tool to process and output virtual assets. This simplifies the virtual asset processing flow and improves processing efficiency, thereby solving the technical problem of low efficiency in processing virtual assets in related technologies.
[0047] In an alternative embodiment, the attribute information of any two original virtual assets can be obtained by using computer graphics tools.
[0048] Optionally, based on the standard coordinate system information of the standard virtual asset, the coordinate system information of the virtual asset to be mapped is mapped to obtain scaling data, including: determining the unit length in the standard coordinate system based on the first coordinate axis information in the coordinate system information to be mapped and the standard coordinate axis information in the standard coordinate system; determining the scaling data based on the second coordinate axis information and the unit length, wherein the second coordinate axis information is used to characterize the coordinate axis information in the coordinate system information to be mapped other than the first coordinate axis information.
[0049] The first coordinate axis information can be understood as the relevant information of the coordinate axes in the coordinate system to be mapped, including but not limited to the width and height of the first coordinate axis. The standard coordinate axis information can be understood as the relevant information of the coordinate axes in the standard coordinate system, including but not limited to the width and height of the standard coordinate axis. The unit length can be understood as the actual length or value corresponding to one unit length on the standard coordinate axis. The second coordinate axis information can be understood as the relevant information of the other coordinate axes in the coordinate system to be mapped, excluding the first coordinate axis information.
[0050] Specifically, the above process can be represented using pseudocode, as shown below:
[0051] ReScale=new Vector4(width / standardPixel.x,height / standardPixel.y,0,0),
[0052] This pseudocode demonstrates the creation of a Vector4 object named ReScale, containing four elements. The first element is the width of the coordinate system to be mapped, divided by the unit length of the standard coordinate system's x-axis (standardPixel.x), representing the width scaling ratio. The second element is the height, divided by the unit length of the standard coordinate system's y-axis (standardPixel.y), representing the height scaling ratio. The third and fourth elements are both 0, indicating scaling without changing the depth and position. The purpose of this pseudocode is to calculate the scaling ratio of the width and height relative to standardPixel and store the results in ReScale. Using this scaling ratio, the width and height can be scaled proportionally in subsequent operations.
[0053] Optionally, the offset data is obtained by restoring the coordinate system information to be mapped based on the origin information, including: determining the unit length in the standard coordinate system based on the first coordinate axis information in the coordinate system to be mapped and the standard coordinate axis information in the standard coordinate system; determining the first origin coordinates of the origin of the standard coordinate system in the coordinate system to be mapped; determining the second origin coordinates of the origin information in the standard coordinate system; and determining the offset data based on the first origin coordinates, the second origin coordinates, the coordinate system information to be mapped, and the unit length in the standard coordinate system.
[0054] The first origin coordinates can be understood as the coordinates of the origin of the standard coordinate system in the coordinate system to be mapped, and the second origin coordinates can be understood as the coordinates of the origin to be transformed in the standard coordinate system.
[0055] Understandably, performing pixel precision unification will cause the virtual asset's position in the canvas to shift. Therefore, the origin reset algorithm is needed to correct this. By calculating the offset value, the point in the scaled coordinate system to be mapped can be translated to the standard coordinate system.
[0056] Specifically, the process for determining the offset data can be represented by the following pseudocode:
[0057] OriginPointOffset=new Vector4(-((standardOx-((standardPixel.x-width) / 2+Ox)) / standardPixel.x / (width / standardPixel.x)),((standardOy-((standardPixel.y-height) / 2+Oy)) / standardPixel.y / (height / standardPixel.y)),0,0),
[0058] Wherein, standardOx and standardOy represent the coordinates of the origin of the standard coordinate system in the coordinate system to be mapped, i.e., the first origin coordinates mentioned above; standardPixel.x and standardPixel.y represent the length of a unit length in the standard coordinate system in the coordinate system to be mapped; width and height represent the width and height of the coordinate system to be mapped; and Ox and Oy represent the coordinates of the origin to be transformed in the standard coordinate system, i.e., the second origin coordinates mentioned above.
[0059] The purpose of this pseudocode is to calculate the offset of the origin of the coordinate system to be mapped relative to the origin of the standard coordinate system. The specific calculation process is as follows:
[0060] First, calculate the offset along the X-axis: Subtract half the width of the coordinate system to be mapped from the X-coordinate of the origin, and add the X-coordinate of the standard coordinate system origin to obtain the X-coordinate value in the standard coordinate system. Then, subtract the X-coordinate of the standard coordinate system origin from this value, divide by the X-size of a standard pixel, and finally divide by the ratio of the width of the coordinate system to the standard pixel. This result is the offset along the X-axis. Next, calculate the offset along the Y-axis: Subtract half the height of the coordinate system to be mapped from the Y-coordinate of the origin, and add the Y-coordinate of the standard coordinate system origin to obtain the Y-coordinate value in the standard coordinate system. Then, subtract the Y-coordinate of the standard coordinate system origin from this value, divide by the Y-size of a standard pixel, and finally divide by the ratio of the height of the coordinate system to the standard pixel. This result is the offset along the Y-axis. Finally, combine the X-axis and Y-axis offsets into a vector, where the Z-axis and W-axis values are both 0. The resulting vector is OriginPointOffset. In other words, this pseudocode calculates the offset of the origin of the coordinate system to be mapped relative to the origin of the standard coordinate system and stores the result in a vector. The calculation of this offset takes into account the size and position of the coordinate system to be mapped, as well as the origin and pixel size of the standard coordinate system.
[0061] Figure 3a This is a schematic diagram of a virtual asset according to one embodiment of the present disclosure, such as... Figure 3a As shown, hollow rectangles represent virtual assets to be mapped, solid rectangles represent standard virtual assets, and solid elliptical lines represent the area where the virtual assets are located. Figure 3a It can be seen that there may be a difference in pixel precision between two virtual assets, which can be reflected in the different pixel sizes of the two virtual assets.
[0062] Figure 3b This is a schematic diagram of a scaled-down virtual asset according to one embodiment of the present disclosure, such as... Figure 3bAs shown, hollow rectangles represent virtual assets to be mapped, solid rectangles represent standard virtual assets, and solid elliptical lines represent the area where the virtual assets are located. Figure 3b It is known that a virtual asset with a smaller pixel size can be used as a standard to reduce the size of a virtual asset with a larger pixel size, i.e., the virtual asset to be mapped. In this way, the pixel precision of the two virtual assets can be unified, but it will cause the position of the virtual asset in the canvas to be offset.
[0063] Figure 3c This is a schematic diagram of a successfully modified virtual asset according to one embodiment of this disclosure, such as... Figure 3c As shown, the dashed rectangle represents the virtual asset after successful correction, and the solid ellipse represents the range of the virtual asset. At this point, the effect of the virtual asset's position shift in the canvas caused by scaling has been eliminated.
[0064] Optionally, the pixel size of the virtual asset to be mapped is mapped to obtain clipping data, including: determining the unit length in the standard coordinate system based on the first coordinate axis information in the coordinate system to be mapped and the standard coordinate axis information in the standard coordinate system; and determining the clipping data based on the pixel size to be mapped, the standard coordinate system information, and the unit length in the standard coordinate system.
[0065] Understandably, by calculating the clipping value through an algorithm, the extended portion of the virtual asset boundary that is repeatedly drawn using this pixel due to the texture addressing mode can be clipped.
[0066] Specifically, the process for determining the data to be cropped can be represented by the following pseudocode:
[0067] cutValue=new Vector4((standardPixel.x-bodyImages[0].width) / 2 / standardPixel.x,(standardPixel.y-bodyImages[0].height) / 2 / standardPixel.y,0,0),
[0068] cutTerm=(saturate((uv.x-cutValue.x)*10000000)*(1-saturate((uv.x-(1-cutvalue.x)))*10000000 )))*(saturate((uv.y-cutValue.y)*10000000)*(1-saturate((uv.y-(1-cutvalue.y))*10000000))),
[0069] final=lerp(float4(0,0,0,0),final,cutTerm),
[0070] Here, `cutValue` is a four-dimensional vector representing the cropping data. The x and y components of this vector represent the texture coordinates of the top-left corner of the image in the standard coordinate system. The calculation process of `cutTerm` and `final` can be understood as the process of cropping the virtual asset based on the cropping data. This pseudocode calculates the width and height of the image by subtracting them from the width and height of the standard coordinate system, then divides by 2. The `cutValue` is then passed into the shader. The texture coordinates are compared with `cutValue`, and the `saturate` function is used to limit the calculation result to 0 and 1. It then determines whether a pixel region has been cropped. If it is within the cropping range, the cropping coefficient `cutTerm` is 1; otherwise, it is 0. `cutTerm` is then used to interpolate the image and background colors to achieve the cropping effect. The purpose is to calculate a cropping coefficient (`cutTerm`) and apply it to the final result (`final`).
[0071] The specific process is as follows: First, by calculating the difference between the original image (bodyImages[0]) and the standard pixel (standardPixel) and dividing it by twice the value of the standard pixel, a new vector (cutValue) is obtained. This vector represents the cropping amount of the image on the x and y axes, i.e., the cropping data mentioned above. Then, by calculating the difference between the uv coordinates and cutValue, and multiplying the result by a large number (10000000), the result is restricted to between 0 and 1 by the saturate function to obtain a cropping coefficient (cutTerm). The cropping coefficient is calculated by restricting the offset of the uv coordinates on the x and y axes, so that the value within the cutValue range is 1, and the value outside the cutValue range is 0. Finally, the cropping coefficient is applied to the final result (final) by the lerp function, setting the pixel values outside the cutValue range to 0, and keeping the pixel values within the cutValue range unchanged. In short, the purpose of this pseudocode is to calculate the cropping coefficient and set the pixel values outside the specified range to 0 to achieve the image cropping effect.
[0072] Figure 4a This is a schematic diagram of a virtual asset with texture boundary overflow according to one embodiment of this disclosure, such as... Figure 4a As shown, the diagonally filled area indicates a texture boundary overflow error, the hollow rectangle represents a virtual asset, the dashed rectangle represents the projection of the virtual asset onto the canvas, and the solid ellipse represents the area where the virtual asset is located. Figure 4a As can be seen, texture addressing mode can cause texture boundary overflow errors.
[0073] Figure 4b This is a schematic diagram of a cropped virtual asset according to one embodiment of the present disclosure, such as... Figure 4b As shown, hollow rectangles represent virtual assets, dashed rectangles represent the projection of virtual assets onto the canvas, and solid ellipses represent the area where the virtual assets are located. Figure 4b It can be seen that the texture boundary overflow error caused by the texture addressing mode can be eliminated after clipping.
[0074] Optionally, obtaining the original virtual asset sequence includes: obtaining the file directory corresponding to the original virtual asset sequence through a script; reading the virtual assets corresponding to the file directory to obtain multiple first virtual assets; unifying the texture format of the multiple first virtual assets to obtain multiple second virtual assets; and storing the multiple second virtual assets into a preset texture list to obtain the original virtual asset sequence.
[0075] Here, a script can be understood as a piece of computer program code used to perform a specific task; a file directory can be understood as a structured way of organizing and storing files; by writing a script, the file directory corresponding to the original virtual asset sequence can be obtained, and various operations can be performed on these file directories; multiple first virtual assets can be understood as all virtual assets under the file directory; multiple second virtual assets can be understood as multiple virtual assets after the texture format is unified; and the preset texture list can be understood as a list that is preset in advance for batch texture processing.
[0076] Understandably, obtaining the file directories corresponding to the original virtual asset sequence can be achieved by writing a script. This script can read the data of the virtual asset sequence and parse it according to specific rules to determine the structure and paths of the file directories. The script can then process and manipulate these file directories as needed, such as creating, deleting, moving, copying, or renaming files and folders. This process can be implemented within a real-time 3D development platform and editor (Unity 3D, or Unity for short) engine.
[0077] In an optional embodiment, the local sequence frame asset file directory can be obtained through an application programming interface, and all sequence frame assets in the file directory, namely the aforementioned multiple first virtual assets, can be read.
[0078] Specifically, the above process can be understood as follows: obtain the local sequence frame asset file directory, read all sequence frame assets in the file directory, and then add the processed assets to the two-dimensional texture list through a loop algorithm.
[0079] Understandably, loop algorithms can merge multiple assets into a single texture, reducing the number of rendering calls and thus improving rendering performance. Therefore, by adding processed assets to a 2D texture list using loop algorithms, multiple small assets can be merged into a large texture, reducing the load on the graphics processing unit (GPU) and improving rendering efficiency.
[0080] It should be noted that storing multiple second virtual assets into a preset texture list to obtain the original virtual asset sequence facilitates batch processing of all two-dimensional textures in the future. If this operation is not performed, all textures need to be processed one by one, which results in low processing efficiency.
[0081] Optionally, the texture formats of multiple first virtual assets are unified to obtain multiple second virtual assets, including: adjusting the texture linear interpolation mode of the multiple first virtual assets to a preset mode, wherein the preset mode is used to indicate that linear interpolation of the textures of the multiple first virtual assets is prohibited; and adjusting the texture addressing mode of the multiple first virtual assets to a clamping mode.
[0082] Among them, texture linear interpolation mode can be understood as an interpolation mode used for texture mapping. In texture mapping, texture coordinates are usually non-integer, and texture linear interpolation mode obtains the color value of the middle point of the texture by interpolating the texture coordinates. Preset mode can be understood as a pre-set mode that does not perform linear interpolation. Texture addressing mode can be understood as a method used in computer graphics to determine the position of texture coordinates in a texture image. It determines how to handle texture sampling when the texture coordinates exceed the boundary of the texture image. Clamping mode can be understood as a mode that can restrict the part that exceeds the range of texture coordinates to the boundary of the texture.
[0083] It is understandable that the texture linear interpolation mode can provide a smooth texture mapping effect, especially suitable for situations where the texture coordinates change greatly. However, in the texture linear interpolation mode, interpolation calculations are performed between pixels, resulting in inaccurate values and image blurring. Therefore, in this embodiment of the disclosure, the texture linear interpolation mode can be adjusted to a mode that does not perform linear interpolation.
[0084] It's important to note that in clamp mode, portions exceeding the texture coordinate range are confined to the texture boundaries and are not duplicated or mirrored. For example, the texture coordinate range can be limited to [0,1], and portions exceeding this range will be clipped. Using clamp mode avoids boundary duplication or mirroring in texture mapping, ensuring that the texture is displayed correctly even when the texture coordinates are out of range.
[0085] Besides clamping mode, common texture addressing modes include: Repeat, which maps texture coordinates outside the range [0,1] back to the range [0,1], essentially filling the excess portion by repeating the texture image; Mirror Repeat, which maps texture coordinates outside the range [0,1] back to the range [0,1] but fills the excess portion using a mirror-symmetric method; Mirror Clamp, which restricts texture coordinates outside the range [0,1] to the range [0,1] but truncates the excess portion using a mirror-symmetric method; and Border, which maps texture coordinates outside the range [0,1] to a specified border color. Different texture addressing modes are suitable for different application scenarios, and the appropriate mode can be selected to handle the excess portion of the texture according to actual needs.
[0086] Optionally, multiple original virtual assets are modified based on the mapping data to obtain multiple target virtual assets, including: modifying multiple original virtual assets based on the mapping data through a preset interface of the content production tool to obtain multiple modified virtual assets; drawing the multiple modified virtual assets onto a rendering texture target; and converting the format of the rendering texture target to obtain multiple target virtual assets.
[0087] The preset interface can be understood as a pre-set application programming interface. The rendering texture target can be used to capture, store and reuse rendering results in graphics rendering. It can store the rendered image data in a texture object for use in subsequent rendering processes.
[0088] In one alternative embodiment, format conversion of the rendered texture target can be performed by converting the rendered texture target to Portable Network Graphics (PNG) format.
[0089] Specifically, the above process can be understood as applying the calculated bias, scaling, and clipping values to the virtual asset through the application programming interface, then drawing the applied asset onto the rendering texture target and storing it in memory, and finally converting the rendering texture target in memory to PNG format and storing it locally through a loop. In this way, the calculated data can be applied to the asset and the modified asset can be saved locally, completing the tool loop.
[0090] Optionally, multiple original virtual assets are modified based on mapping data to obtain multiple modified virtual assets, including: scaling the original texture coordinates of multiple original virtual assets based on scaling data to obtain first texture coordinates; offsetting the first texture coordinates based on offset data to obtain second texture coordinates; and cropping the multiple original virtual assets based on clipping data and second texture coordinates to obtain multiple modified virtual assets.
[0091] Here, the original texture coordinates can be understood as the texture coordinates of multiple original virtual assets, the first texture coordinates can be understood as the coordinates obtained after scaling the original texture coordinates, and the second texture coordinates can be understood as the coordinates obtained after offsetting the first texture coordinates.
[0092] Understandably, the above process first involves scaling the original texture coordinates. Since pixel precision needs to be standardized during scaling, the virtual assets' positions on the canvas may shift. Therefore, after scaling, offset processing is required to obtain the second texture coordinates. Finally, multiple original virtual assets are clipped based on the clipping data and the second texture coordinates. This can correct texture boundary overflow errors caused by texture addressing mode, ultimately resulting in multiple modified virtual assets.
[0093] Optionally, scaling the original texture coordinates of multiple original virtual assets based on scaling data to obtain the first texture coordinates includes: determining scaling coefficients and translation coefficients based on scaling data; obtaining the product of the scaling coefficients and the original texture coordinates to obtain the scaled texture coordinates; and obtaining the sum of the scaled texture coordinates and the translation coefficients to obtain the first texture coordinates.
[0094] The scaling factor can be understood as a coefficient describing the size change of the graphic, for example, it can be -0.5. The translation factor can be understood as a coefficient describing the position movement of the graphic. The scaling texture coordinates can be understood as the coordinates that need to be scaled on the original texture coordinates of multiple original virtual assets.
[0095] Specifically, the above process can be represented by pseudocode as follows:
[0096] uvScale=1 / ReScale.xy*uv+(1 / ReScale.xy*-0.5)+0.5,
[0097] This pseudocode demonstrates scaling and translating texture coordinates to fit a new size. First, `uvScale` is a new texture coordinate system, equal to the original texture coordinates multiplied by 1 / ReScale.xy. This scaling operation scales the x and y components of the original texture coordinates to fit the new size. Then, `uvScale` needs to be translated by adding 1 / ReScale.xy * -0.5 to it. This translates the origin (0,0) of the texture coordinate system to the new position. Finally, to ensure the texture coordinates remain within the range [0,1], `uvScale` needs to be offset by adding 0.5. This mapping shifts the texture coordinate range from [-0.5, 0.5] to [0,1]. Through these operations, we can scale, translate, and map the original texture coordinates to the new size to fit the new texture coordinate range. In other words, after calculating the scaling value required to convert the pixel coordinate system to the standard coordinate system, the assets to be modified are operated on within the standard coordinate system in the shader. The scaled texture coordinates are translated by (1 / ReScale.xy*-0.5) to align the texture center with the center point of the standard coordinate system. Finally, the texture coordinates are adjusted by +0.5 to change the range of texture coordinates from -0.5 to 0.5 to 0 to 1.
[0098] Optionally, multiple original virtual assets are cropped based on the cropping data and the second texture coordinates to obtain multiple modified virtual assets, including: comparing the second texture coordinates with the cropping data to determine the cropping range; comparing the pixels of the multiple original virtual assets with the cropping range to obtain the cropping coefficient of the pixels; and interpolating the colors of the multiple original virtual assets based on the cropping coefficient of the pixels to obtain multiple modified virtual assets.
[0099] Here, the clipping range can be understood as a reasonable range for clipping a pixel region based on the second texture coordinates and the clipping data, and the clipping coefficient can be understood as a coefficient describing the clipping of the pixel region.
[0100] The above method compares the pixels of multiple original virtual assets with the cropping range to obtain the cropping coefficient of the pixels. This can be understood as follows: if the pixels of multiple original virtual assets are within the cropping range, the cropping coefficient can be considered to be 1; if the pixels of multiple original virtual assets are outside the cropping range, the cropping coefficient can be considered to be 0.
[0101] Specifically, the above process can be understood as follows: comparing the texture coordinates with the clipping range, limiting the calculation result to 0 and 1, determining whether the pixel area is clipped, if it is within the clipping range, the clipping coefficient is 1, if it is outside the clipping range, it is 0, and the clipping coefficient is used to interpolate the image color and background color to achieve the clipping effect.
[0102] Optionally, the above method also includes: obtaining origin information from the content production tool through a preset interface of the content production tool.
[0103] Content production tools can be understood as software, applications, or platforms used to create, edit, and publish digital content. These can include, but are not limited to, image editing software, video editing software, audio editing software, web design software, and social media management tools, such as Microsoft Office and Adobe Creative Cloud. Content production tools can help users easily create and modify digital content to meet different creative needs.
[0104] Specifically, the above process can be understood as follows: within the digital content production tool, the position of the world coordinate origin float3(0,0,0) is mapped to the camera's screen coordinates through the application programming interface, recorded, and output as a JS object notation (JSON) file.
[0105] Understandably, through the above process, the origin can be recorded within the digital content production tool via a programmable interface, preparing for the subsequent mapping of multiple virtual assets.
[0106] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this disclosure.
[0107] This embodiment also provides a virtual asset processing apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the terms "sub-unit," "unit," and "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0108] Figure 5 This is a structural block diagram of a virtual asset processing apparatus according to one embodiment of the present disclosure. As shown in the figure, the apparatus includes: a sequence acquisition module 502, used to acquire an original virtual asset sequence, wherein multiple original virtual assets in the original virtual asset sequence are used to generate a video; an asset mapping module 504, used to perform center point mapping on any two original virtual assets in the original virtual asset sequence based on the origin information of the original virtual asset sequence, to obtain mapping data of any two original virtual assets, wherein the origin information is used to characterize the position information obtained by mapping the origin of the world coordinate system to the screen coordinate system, and the mapping data includes one or more of the following: scaling data for scaling multiple original virtual assets, offset data for offsetting multiple original virtual assets, and cropping data for cropping multiple original virtual assets; and an asset modification module 506, used to modify multiple original virtual assets based on the mapping data to obtain multiple target virtual assets.
[0109] The asset mapping module 504 includes: an attribute acquisition unit for acquiring attribute information of any two original virtual assets, wherein the attribute information includes at least pixel size and coordinate system information; an asset determination unit for determining, based on pixel size, the virtual asset to be mapped and the standard virtual asset among any two virtual assets; a first mapping unit for mapping the coordinate system information of the virtual asset to be mapped based on the standard coordinate system information of the standard virtual asset to obtain scaling data; a restoration unit for restoring the coordinate system information to be mapped based on origin information to obtain offset data; and a second mapping unit for mapping the pixel size of the virtual asset to be mapped based on the standard coordinate system information to obtain clipping data.
[0110] The first mapping unit includes: a first length determination subunit, used to determine the unit length in the standard coordinate system based on the first coordinate axis information in the coordinate system to be mapped and the standard coordinate axis information in the standard coordinate system; and a scaling data determination subunit, used to determine scaling data based on the second coordinate axis information and the unit length, wherein the second coordinate axis information is used to characterize the coordinate axis information in the coordinate system to be mapped other than the first coordinate axis information.
[0111] The restoration unit includes: a second length determination subunit, used to determine the unit length in the standard coordinate system based on the first coordinate axis information in the coordinate system to be mapped and the standard coordinate axis information in the standard coordinate system; a first coordinate determination subunit, used to determine the first origin coordinates of the origin of the standard coordinate system in the coordinate system to be mapped; a second coordinate determination subunit, used to determine the second origin coordinates of the origin information in the standard coordinate system; and an offset data determination subunit, used to determine the offset data based on the first origin coordinates, the second origin coordinates, the coordinate system to be mapped, and the unit length in the standard coordinate system.
[0112] The second mapping unit includes: a third length determination subunit, used to determine the unit length in the standard coordinate system based on the first coordinate axis information in the coordinate system to be mapped and the standard coordinate axis information in the standard coordinate system; and a cropping data determination subunit, used to determine the cropping data based on the pixel size to be mapped, the standard coordinate system information, and the unit length in the standard coordinate system.
[0113] The sequence acquisition module 502 includes: a directory acquisition unit, used to acquire the file directory corresponding to the original virtual asset sequence through a script; a directory reading unit, used to read the virtual assets corresponding to the file directory to obtain multiple first virtual assets; a format unification unit, used to unify the texture format of multiple first virtual assets to obtain multiple second virtual assets; and an asset storage unit, used to store multiple second virtual assets into a preset texture list to obtain the original virtual asset sequence.
[0114] The format unification unit includes: a first mode adjustment subunit, used to adjust the texture linear interpolation mode of multiple first virtual assets to a preset mode, wherein the preset mode is used to indicate that linear interpolation of the textures of multiple first virtual assets is prohibited; and a second mode adjustment subunit, used to adjust the texture addressing mode of multiple first virtual assets to a clamping mode.
[0115] The asset modification module 506 includes: an asset modification unit, used to modify multiple original virtual assets based on mapping data through a preset interface of the content production tool to obtain multiple modified virtual assets; a drawing unit, used to draw the multiple modified virtual assets onto a rendering texture target; and a format conversion unit, used to convert the format of the rendering texture target to obtain multiple target virtual assets.
[0116] The asset modification unit includes: a scaling subunit, used to scale the original texture coordinates of multiple original virtual assets based on scaling data to obtain the first texture coordinates; an offset subunit, used to offset the first texture coordinates based on offset data to obtain the second texture coordinates; and a clipping subunit, used to clip the multiple original virtual assets based on clipping data and the second texture coordinates to obtain multiple modified virtual assets.
[0117] The scaling subunit can be implemented through the following process: determine the scaling factor and translation factor based on the scaling data; obtain the product of the scaling factor and the original texture coordinates to obtain the scaled texture coordinates; obtain the sum of the scaled texture coordinates and the translation factor to obtain the first texture coordinates.
[0118] The cropping subunit can be implemented through the following process: comparing the second texture coordinates with the cropping data to determine the cropping range; comparing the pixels of multiple original virtual assets with the cropping range to obtain the cropping coefficients of the pixels; and interpolating the colors of multiple original virtual assets based on the cropping coefficients of the pixels to obtain multiple modified virtual assets.
[0119] The aforementioned device also includes: an information acquisition module, used to acquire origin information from the content production tool through a preset interface of the content production tool.
[0120] It should be noted that the above-mentioned sub-units, units, and modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to these: the above-mentioned sub-units, units, and modules are all located in the same processor; or, the above-mentioned sub-units, units, and modules are located in different processors in any combination.
[0121] Embodiments of this disclosure also provide a computer-readable storage medium storing a computer program configured to perform the steps in any of the above method embodiments when executed.
[0122] Optionally, in this embodiment, the computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0123] Optionally, in this embodiment, the computer-readable storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0124] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0125] Obtain the original virtual asset sequence, where multiple original virtual assets in the original virtual asset sequence are used to generate the video;
[0126] Based on the origin information of the original virtual asset sequence, center point mapping is performed on any two original virtual assets in the original virtual asset sequence to obtain the mapping data of any two original virtual assets. The origin information is used to represent the position information obtained by mapping the origin of the world coordinate system to the screen coordinate system. The mapping data includes one or more of the following: scaling data for scaling multiple original virtual assets, offset data for offsetting multiple original virtual assets, and clipping data for clipping multiple original virtual assets.
[0127] Multiple target virtual assets are obtained by modifying multiple original virtual assets based on the mapping data.
[0128] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: obtaining attribute information of any two original virtual assets, wherein the attribute information includes at least: pixel size and coordinate system information; determining the virtual asset to be mapped and the standard virtual asset among the two virtual assets based on the pixel size; mapping the coordinate system information of the virtual asset to be mapped based on the standard coordinate system information of the standard virtual asset to obtain scaling data; restoring the coordinate system information to be mapped based on the origin information to obtain offset data; and mapping the pixel size of the virtual asset to be mapped based on the standard coordinate system information to obtain clipping data.
[0129] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining a unit length in a standard coordinate system based on first coordinate axis information in the coordinate system to be mapped and standard coordinate axis information in a standard coordinate system; determining scaling data based on second coordinate axis information and the unit length, wherein the second coordinate axis information is used to characterize coordinate axis information in the coordinate system to be mapped other than the first coordinate axis information.
[0130] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining the unit length in the standard coordinate system based on the first coordinate axis information in the coordinate system to be mapped and the standard coordinate axis information in the standard coordinate system; determining the coordinates of the first origin of the standard coordinate system in the coordinate system to be mapped; determining the coordinates of the second origin of the origin information in the standard coordinate system; and determining offset data based on the first origin coordinates, the second origin coordinates, the coordinate system to be mapped, and the unit length in the standard coordinate system.
[0131] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining the unit length in the standard coordinate system based on the first coordinate axis information in the coordinate system to be mapped and the standard coordinate axis information in the standard coordinate system; and determining the cropping data based on the pixel size to be mapped, the standard coordinate system information, and the unit length in the standard coordinate system.
[0132] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: obtaining the file directory corresponding to the original virtual asset sequence via a script; reading the virtual assets corresponding to the file directory to obtain multiple first virtual assets; unifying the texture format of the multiple first virtual assets to obtain multiple second virtual assets; and storing the multiple second virtual assets into a preset texture list to obtain the original virtual asset sequence.
[0133] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: adjusting the texture linear interpolation mode of the plurality of first virtual assets to a preset mode, wherein the preset mode is used to characterize prohibiting linear interpolation of the textures of the plurality of first virtual assets; adjusting the texture addressing mode of the plurality of first virtual assets to a clamping mode.
[0134] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: modifying multiple original virtual assets based on mapping data through a preset interface of a content production tool to obtain multiple modified virtual assets; drawing the multiple modified virtual assets onto a rendering texture target; and converting the format of the rendering texture target to obtain multiple target virtual assets.
[0135] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: scaling the original texture coordinates of multiple original virtual assets based on scaling data to obtain first texture coordinates; offsetting the first texture coordinates based on offset data to obtain second texture coordinates; and cropping the multiple original virtual assets based on clipping data and the second texture coordinates to obtain multiple modified virtual assets.
[0136] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining a scaling factor and a translation factor based on scaling data; obtaining the product of the scaling factor and the original texture coordinates to obtain scaled texture coordinates; and obtaining the sum of the scaled texture coordinates and the translation factor to obtain first texture coordinates.
[0137] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: comparing second texture coordinates with clipping data to determine a clipping range; comparing pixels of multiple original virtual assets with the clipping range to obtain clipping coefficients for the pixels; and interpolating the colors of multiple original virtual assets based on the clipping coefficients for the pixels to obtain multiple modified virtual assets.
[0138] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: obtaining origin information from the content production tool through a preset interface of the content production tool.
[0139] This embodiment provides a technical solution for processing virtual assets in a computer-readable storage medium. The solution involves acquiring an original virtual asset sequence; mapping the center points of any two original virtual assets in the original virtual asset sequence based on the origin information of the original virtual asset sequence to obtain mapping data for the two original virtual assets; and modifying multiple original virtual assets based on the mapping data to obtain multiple target virtual assets. It should be noted that the origin information represents the position information obtained by mapping the origin of the world coordinate system to the screen coordinate system. The mapping data includes one or more of the following: scaling data for scaling multiple original virtual assets, offset data for offsetting multiple original virtual assets, and clipping data for clipping multiple original virtual assets. When modifying virtual assets, there is no need to use content production tools; multiple original virtual assets can be modified directly based on the above mapping data to obtain multiple target virtual assets. This achieves the technical effect of simplifying the virtual asset processing flow and improving processing efficiency by using content production tools only when generating the original virtual asset sequence, without needing to re-enter the content production tool for virtual asset processing and output. This solves the technical problem of low efficiency in processing virtual assets in related technologies.
[0140] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0141] In exemplary embodiments of this application, a computer-readable storage medium stores a program product capable of implementing the methods described above in this embodiment. In some possible implementations, various aspects of the embodiments of this disclosure may also be implemented as a program product including program code, which, when the program product is run on a terminal device, causes the terminal device to perform the steps according to various exemplary embodiments of this disclosure described in the "Exemplary Methods" section above.
[0142] The program product for implementing the above-described method according to embodiments of the present disclosure may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the embodiments of the present disclosure is not limited thereto. In the embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0143] The aforementioned program product may take the form of any combination of one or more computer-readable media. Such computer-readable storage media may be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples (not exhaustive) of computer-readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0144] It should be noted that the program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, radio frequency (RF), or any suitable combination thereof.
[0145] Embodiments of this disclosure also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0146] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0147] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0148] Obtain the original virtual asset sequence, where multiple original virtual assets in the original virtual asset sequence are used to generate the video;
[0149] Based on the origin information of the original virtual asset sequence, center point mapping is performed on any two original virtual assets in the original virtual asset sequence to obtain the mapping data of any two original virtual assets. The origin information is used to represent the position information obtained by mapping the origin of the world coordinate system to the screen coordinate system. The mapping data includes one or more of the following: scaling data for scaling multiple original virtual assets, offset data for offsetting multiple original virtual assets, and clipping data for clipping multiple original virtual assets.
[0150] Multiple target virtual assets are obtained by modifying multiple original virtual assets based on the mapping data.
[0151] Optionally, the processor described above can also be configured to perform the following steps via a computer program: obtaining attribute information of any two original virtual assets, wherein the attribute information includes at least: pixel size and coordinate system information; determining the virtual asset to be mapped and the standard virtual asset among the two virtual assets based on the pixel size; mapping the coordinate system information of the virtual asset to be mapped based on the standard coordinate system information of the standard virtual asset to obtain scaling data; restoring the coordinate system information to be mapped based on the origin information to obtain offset data; and mapping the pixel size of the virtual asset to be mapped based on the standard coordinate system information to obtain clipping data.
[0152] Optionally, the processor may also be configured to perform the following steps via a computer program: determining the unit length in the standard coordinate system based on the first coordinate axis information in the coordinate system to be mapped and the standard coordinate axis information in the standard coordinate system; determining scaling data based on the second coordinate axis information and the unit length, wherein the second coordinate axis information is used to characterize the coordinate axis information in the coordinate system to be mapped other than the first coordinate axis information.
[0153] Optionally, the processor may also be configured to perform the following steps via a computer program: determining the unit length in the standard coordinate system based on the first coordinate axis information in the coordinate system to be mapped and the standard coordinate axis information in the standard coordinate system; determining the coordinates of the first origin of the standard coordinate system in the coordinate system to be mapped; determining the coordinates of the second origin of the origin information in the standard coordinate system; and determining the offset data based on the first origin coordinates, the second origin coordinates, the coordinate system to be mapped, and the unit length in the standard coordinate system.
[0154] Optionally, the processor may also be configured to perform the following steps via a computer program: determining the unit length in the standard coordinate system based on the first coordinate axis information in the coordinate system to be mapped and the standard coordinate axis information in the standard coordinate system; and determining the cropping data based on the pixel size to be mapped, the standard coordinate system information, and the unit length in the standard coordinate system.
[0155] Optionally, the processor may also be configured to perform the following steps via a computer program: obtain the file directory corresponding to the original virtual asset sequence via a script; read the virtual assets corresponding to the file directory to obtain multiple first virtual assets; unify the texture format of the multiple first virtual assets to obtain multiple second virtual assets; and store the multiple second virtual assets into a preset texture list to obtain the original virtual asset sequence.
[0156] Optionally, the processor may also be configured to perform the following steps via a computer program: adjusting the texture linear interpolation mode of the plurality of first virtual assets to a preset mode, wherein the preset mode is used to indicate that linear interpolation of the textures of the plurality of first virtual assets is prohibited; and adjusting the texture addressing mode of the plurality of first virtual assets to a clamping mode.
[0157] Optionally, the processor described above can also be configured to perform the following steps via a computer program: modifying multiple original virtual assets based on mapping data through a preset interface of the content production tool to obtain multiple modified virtual assets; drawing the multiple modified virtual assets onto a rendering texture target; and converting the format of the rendering texture target to obtain multiple target virtual assets.
[0158] Optionally, the processor may also be configured to perform the following steps via a computer program: scaling the original texture coordinates of multiple original virtual assets based on scaling data to obtain first texture coordinates; offsetting the first texture coordinates based on offset data to obtain second texture coordinates; and cropping the multiple original virtual assets based on clipping data and second texture coordinates to obtain multiple modified virtual assets.
[0159] Optionally, the processor may also be configured to perform the following steps via a computer program: determining scaling and translation coefficients based on scaling data; obtaining the product of the scaling coefficients and the original texture coordinates to obtain scaled texture coordinates; and obtaining the sum of the scaled texture coordinates and the translation coefficients to obtain first texture coordinates.
[0160] Optionally, the processor may also be configured to perform the following steps via a computer program: comparing the second texture coordinates with the clipping data to determine the clipping range; comparing the pixels of multiple original virtual assets with the clipping range to obtain the clipping coefficients of the pixels; and interpolating the colors of multiple original virtual assets based on the pixel clipping coefficients to obtain multiple modified virtual assets.
[0161] Optionally, the processor may also be configured to perform the following steps via a computer program: obtaining origin information from the content production tool through a preset interface of the content production tool.
[0162] In this embodiment of the electronic device, a technical solution for processing virtual assets is provided. The method involves acquiring an original virtual asset sequence; mapping the center points of any two original virtual assets in the original virtual asset sequence based on the origin information of the original virtual asset sequence to obtain mapping data for any two original virtual assets; and modifying multiple original virtual assets based on the mapping data to obtain multiple target virtual assets. It should be noted that the origin information is used to characterize the position information obtained by mapping the origin of the world coordinate system to the screen coordinate system. The mapping data includes one or more of the following: scaling data for scaling multiple original virtual assets, offset data for offsetting multiple original virtual assets, and clipping data for clipping multiple original virtual assets. When modifying virtual assets, there is no need to use content production tools; multiple original virtual assets can be modified directly based on the above mapping data to obtain multiple target virtual assets. This achieves the technical effect of simplifying the virtual asset processing flow and improving processing efficiency by using content production tools only when generating the original virtual asset sequence, without needing to re-enter the content production tool for virtual asset processing and output. This solves the technical problem of low efficiency in processing virtual assets in related technologies.
[0163] Figure 6 This is a schematic diagram of an electronic device according to an embodiment of the present disclosure. Figure 6 As shown, the electronic device 600 is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0164] like Figure 6 As shown, the electronic device 600 is presented in the form of a general-purpose computing device. The components of the electronic device 600 may include, but are not limited to: at least one processor 610, at least one memory 620, a bus 630 connecting different system components (including memory 620 and processor 610), and a display 640.
[0165] The memory 620 stores program code that can be executed by the processor 610, causing the processor 610 to perform the steps described in the method section of the embodiments of this application according to various exemplary implementations of this disclosure.
[0166] The memory 620 may include a readable medium in the form of volatile memory cells, such as random access memory (RAM) 6201 and / or cache memory 6202, and may further include a read-only memory (ROM) 6203, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
[0167] In some instances, memory 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, including but not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Memory 620 may further include memory remotely located relative to processor 610, which can be connected to electronic device 600 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0168] Bus 630 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, peripheral bus, graphics acceleration port, processor 610, or a local bus using any of the various bus structures.
[0169] The display 640 may be, for example, a touchscreen liquid crystal display (LCD) that allows a user to interact with the user interface of the electronic device 600.
[0170] Optionally, the electronic device 600 can also communicate with one or more external devices 700 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 600, and / or any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via the input / output (I / O) interface 650. Furthermore, the electronic device 600 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via a network adapter 660. Figure 6 As shown, network adapter 660 communicates with other modules of electronic device 600 via bus 630. It should be understood that, although... Figure 6As not shown in the diagram, other hardware and / or software modules may be used in conjunction with electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk array (RAID) systems, tape drives, and data backup storage systems.
[0171] The aforementioned electronic device 600 may further include: a keyboard, a cursor control device (such as a mouse), an input / output interface (I / O interface), a network interface, a power supply, and / or a camera.
[0172] Those skilled in the art will understand that Figure 6 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, electronic device 600 may also include components that are more... Figure 6 The more or fewer components shown, or having the same Figure 1 Different configurations are shown. The memory 620 can be used to store computer programs and corresponding data, such as the computer program and corresponding data corresponding to the virtual asset processing method in this embodiment. The processor 610 executes various functional applications and data processing by running the computer program stored in the memory 620, thereby implementing the aforementioned virtual asset processing method.
[0173] In the above embodiments of this disclosure, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0174] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0175] 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 units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0176] Furthermore, the functional units in the various embodiments of this disclosure 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.
[0177] 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 disclosure, 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 (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0178] The above description is only a preferred embodiment of this disclosure. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principles of this disclosure, and these improvements and modifications should also be considered within the scope of protection of this disclosure.
Claims
1. A method for processing virtual assets, characterized in that, include: Obtain an original virtual asset sequence, wherein multiple original virtual assets in the original virtual asset sequence are used to generate a video; Based on the origin information of the original virtual asset sequence, center point mapping is performed on any two original virtual assets in the original virtual asset sequence to obtain the mapping data of the two original virtual assets. The origin information is used to characterize the position information obtained by mapping the origin of the world coordinate system to the screen coordinate system. The mapping data includes one or more of the following: scaling data for scaling the multiple original virtual assets, offset data for offsetting the multiple original virtual assets, and clipping data for clipping the multiple original virtual assets. Based on the mapping data, the multiple original virtual assets are modified to obtain multiple target virtual assets.
2. The method according to claim 1, characterized in that, Based on the origin information of the original virtual asset sequence, center point mapping is performed on any two original virtual assets in the original virtual asset sequence to obtain the mapping data of the any two original virtual assets, including: Obtain the attribute information of any two original virtual assets, wherein the attribute information includes at least: pixel size and coordinate system information; Based on the pixel size, determine the virtual asset to be mapped and the standard virtual asset among the arbitrary two virtual assets; Based on the standard coordinate system information of the standard virtual asset, the coordinate system information of the virtual asset to be mapped is mapped to obtain the scaling data; The offset data is obtained by restoring the coordinate system information to be mapped based on the origin information; Based on the standard coordinate system information, the pixel size of the virtual asset to be mapped is mapped to obtain the cropping data.
3. The method according to claim 2, characterized in that, Based on the standard coordinate system information of the standard virtual asset, the coordinate system information of the virtual asset to be mapped is mapped to obtain the scaling data, including: Based on the first coordinate axis information in the coordinate system to be mapped and the standard coordinate axis information in the standard coordinate system, the unit length in the standard coordinate system is determined; The scaling data is determined based on the second coordinate axis information and the unit length, wherein the second coordinate axis information is used to characterize the coordinate axis information in the coordinate system information to be mapped, excluding the first coordinate axis information.
4. The method according to claim 2, characterized in that, The offset data is obtained by restoring the coordinate system information to be mapped based on the origin information, including: Based on the first coordinate axis information in the coordinate system to be mapped and the standard coordinate axis information in the standard coordinate system, the unit length in the standard coordinate system is determined; Determine the coordinates of the first origin of the standard coordinate system in the coordinate system to be mapped; Determine the coordinates of the second origin in the standard coordinate system; The offset data is determined based on the first origin coordinates, the second origin coordinates, the coordinate system information to be mapped, and the unit length in the standard coordinate system.
5. The method according to claim 2, characterized in that, Based on the standard coordinate system information, the pixel dimensions of the virtual asset to be mapped are mapped to obtain the clipping data, including: Based on the first coordinate axis information in the coordinate system to be mapped and the standard coordinate axis information in the standard coordinate system, the unit length in the standard coordinate system is determined; The cropping data is determined based on the pixel size to be mapped, the standard coordinate system information, and the unit length in the standard coordinate system.
6. The method according to claim 1, characterized in that, Obtaining the original virtual asset sequence includes: The script retrieves the file directory corresponding to the original virtual asset sequence. Read the virtual assets corresponding to the file directory to obtain multiple first virtual assets; The texture format of the multiple first virtual assets is unified to obtain multiple second virtual assets; The multiple second virtual assets are stored in a preset texture list to obtain the original virtual asset sequence.
7. The method according to claim 6, characterized in that, The texture formats of the plurality of first virtual assets are unified to obtain the plurality of second virtual assets, including: The texture linear interpolation mode of the plurality of first virtual assets is adjusted to a preset mode, wherein the preset mode is used to indicate that linear interpolation of the textures of the plurality of first virtual assets is prohibited. Adjust the texture addressing mode of the plurality of first virtual assets to clamp mode.
8. The method according to claim 1, characterized in that, Based on the mapping data, the plurality of original virtual assets are modified to obtain the plurality of target virtual assets, including: By using the preset interface of the content production tool, the multiple original virtual assets are modified based on the mapping data to obtain multiple modified virtual assets; Draw the modified virtual assets onto the rendering texture target; The rendering texture target is format converted to obtain the multiple target virtual assets.
9. The method according to claim 8, characterized in that, Based on the mapping data, the plurality of original virtual assets are modified to obtain the plurality of modified virtual assets, including: The original texture coordinates of the plurality of original virtual assets are scaled based on the scaling data to obtain the first texture coordinates; The first texture coordinates are offset based on the offset data to obtain the second texture coordinates; The multiple original virtual assets are cropped based on the cropping data and the second texture coordinates to obtain the multiple modified virtual assets.
10. The method according to claim 9, characterized in that, Based on the scaling data, the original texture coordinates of the plurality of original virtual assets are scaled to obtain the first texture coordinates, including: The scaling factor and translation factor are determined based on the scaling data; The product of the scaling factor and the original texture coordinates is obtained to get the scaled texture coordinates; The first texture coordinates are obtained by summing the scaling texture coordinates and the translation coefficient.
11. The method according to claim 9, characterized in that, Based on the cropping data and the second texture coordinates, the plurality of original virtual assets are cropped to obtain the plurality of modified virtual assets, including: The second texture coordinates are compared with the cropping data to determine the cropping range; The pixels of the plurality of original virtual assets are compared with the cropping range to obtain the cropping coefficient of the pixels; The colors of the multiple original virtual assets are interpolated based on the cropping coefficient of the pixels to obtain the multiple modified virtual assets.
12. The method according to claim 1, characterized in that, The method further includes: The origin information is obtained from the content production tool through a preset interface.
13. A device for processing virtual assets, characterized in that, include: A sequence acquisition module is used to acquire an original virtual asset sequence, wherein multiple original virtual assets in the original virtual asset sequence are used to generate a video; The asset mapping module is used to map the center point of any two original virtual assets in the original virtual asset sequence based on the origin information of the original virtual asset sequence, so as to obtain the mapping data of the two original virtual assets. The origin information is used to represent the position information obtained by mapping the origin of the world coordinate system to the screen coordinate system. The mapping data includes one or more of the following: scaling data for scaling the multiple original virtual assets, offset data for offsetting the multiple original virtual assets, and clipping data for clipping the multiple original virtual assets. The asset modification module is used to modify the multiple original virtual assets based on the mapping data to obtain multiple target virtual assets.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 12 when run by a processor.
15. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method as described in any one of claims 1 to 12.
Citation Information
Patent Citations
Virtual object control method and device
CN110941974A
Image rendering method and related device
CN111292405A