Texture sampling method and device, storage medium and electronic device
By generating controllable random adjustment parameters to rotate, scale, and shift texture coordinates, the problem of unnatural resampling of texture maps on large-area objects or terrains and performance consumption is solved, achieving an infinite non-repeating texture sampling effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2023-08-09
- Publication Date
- 2026-06-19
Smart Images

Figure CN117058207B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data, and more specifically, to a texture sampling method, apparatus, storage medium, and electronic device. Background Technology
[0002] Currently, texture mapping comes in two forms: two-dimensional continuous and four-dimensional continuous. If a single four-dimensional continuous texture is used on a large object or terrain, the texture map needs to be repeated multiple times to obtain sufficient texture resolution to cover the entire object at a great distance. However, repeating the texture over and over again makes the covered object look unnatural and leads to certain performance consumption, thus posing a technical problem of not being able to effectively perform texture sampling.
[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 texture sampling method, apparatus, storage medium, and electronic device to at least solve the technical problem of ineffective texture sampling.
[0005] According to one embodiment of this disclosure, a texture sampling method is provided. The method may include: obtaining the original texture coordinates to be sampled from an original texture map; generating at least one set of target random adjustment parameters based on the original texture coordinates; adjusting the original texture coordinates based on the target random adjustment parameters to obtain target texture coordinates; and sampling the original texture map based on the target texture coordinates to obtain a target texture map.
[0006] According to one embodiment of this disclosure, a texture sampling device is also provided. The device may include: an acquisition unit for acquiring original texture coordinates to be sampled from an original texture map; a generation unit for generating at least one set of target random adjustment parameters based on the original texture coordinates; an adjustment unit for adjusting the original texture coordinates based on the target random adjustment parameters to obtain target texture coordinates; and a sampling unit for sampling the original texture map based on the target texture coordinates to obtain a target texture map.
[0007] According to one embodiment of the present disclosure, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to execute the texture sampling method of any of the above claims at runtime.
[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 texture sampling method described in any of the preceding claims.
[0009] In this embodiment, the original texture coordinates to be sampled in the original texture map are obtained; at least one set of target random adjustment parameters are generated based on the original texture coordinates; the original texture coordinates are adjusted based on the target random adjustment parameters to obtain the target texture coordinates; and the original texture map is sampled based on the target texture coordinates to obtain the target texture map. In other words, this embodiment generates controllable random adjustment parameters based on an original texture map, thereby rapidly and randomly changing the texture. This achieves the goal of infinitely non-repeating texture sampling using only one original texture map, thus achieving an effective texture sampling effect and solving the technical problem of ineffective texture sampling. Attached Figure Description
[0010] The accompanying drawings, which are included to provide a further understanding of this disclosure and form part of this disclosure, illustrate exemplary embodiments of the present disclosure and are used to explain the disclosure, but do not constitute an undue limitation of the disclosure. In the drawings:
[0011] Figure 1 This is a hardware structure block diagram of a mobile terminal for a texture sampling method according to an embodiment of the present disclosure;
[0012] Figure 2 This is a flowchart of a texture sampling method according to one embodiment of the present disclosure;
[0013] Figure 3 This is a schematic diagram of an ultra-large texture according to one embodiment of the present disclosure;
[0014] Figure 4 This is a schematic diagram of a special mountain texture according to one embodiment of the present disclosure;
[0015] Figure 5 This is a schematic diagram illustrating the writing of a random noise logic function according to one embodiment of the present disclosure;
[0016] Figure 6 This is a schematic diagram of obtaining a random noise logic function according to one embodiment of the present disclosure;
[0017] Figure 7 This is a schematic diagram illustrating the writing of a function that combines rotation, scaling, and translation logic according to one embodiment of this disclosure;
[0018] Figure 8 This is a schematic diagram illustrating the acquisition of a scaling logic function according to one embodiment of the present disclosure;
[0019] Figure 9 This is a schematic diagram of obtaining a displacement logic function according to one embodiment of the present disclosure;
[0020] Figure 10This is a schematic diagram of a move variable to be added according to one embodiment of the present disclosure;
[0021] Figure 11 This is a schematic diagram showing the addition of a movement variable according to one embodiment of this disclosure;
[0022] Figure 12 This is a schematic diagram of a combined random noise function and a rotation-scaling displacement function according to one embodiment of the present disclosure;
[0023] Figure 13 This is a schematic diagram illustrating the construction of a random position function according to one embodiment of the present disclosure;
[0024] Figure 14 This is a schematic diagram illustrating the determination of a default value according to one embodiment of the present disclosure;
[0025] Figure 15 This is a schematic diagram illustrating the effect of random transformation according to one embodiment of the present disclosure;
[0026] Figure 16 This is a schematic diagram of a black and white texture mask according to one embodiment of the present disclosure;
[0027] Figure 17 This is a schematic diagram illustrating the referencing of a function into a material according to one embodiment of the present disclosure;
[0028] Figure 18 This is a schematic diagram of a random mask according to one embodiment of the present disclosure;
[0029] Figure 19 This is a schematic diagram illustrating different decomposition effects according to one embodiment of the present disclosure;
[0030] Figure 20 This is a schematic diagram of the fabrication of a programmed hexagonal sampling molecular grid function according to one embodiment of the present disclosure;
[0031] Figure 21 This is a schematic diagram of a deformed hexagonal mesh according to one embodiment of the present disclosure;
[0032] Figure 22 This is a schematic diagram of a sharpened hexagonal mesh according to one embodiment of the present disclosure;
[0033] Figure 23 This is a schematic diagram of a corrected deformed hexagonal mesh according to one embodiment of the present disclosure;
[0034] Figure 24 This is a schematic diagram of the decomposition of texture into a hexagonal mesh according to one embodiment of the present disclosure;
[0035] Figure 25This is a schematic diagram of a reconstructed sampled texture according to one embodiment of the present disclosure;
[0036] Figure 26 This is a structural block diagram of a texture sampling device according to an embodiment of the present disclosure;
[0037] Figure 27 This is a schematic diagram of an electronic device according to an embodiment of the present disclosure. Detailed Implementation
[0038] 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.
[0039] 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.
[0040] In one possible implementation, in the field of data processing, texture mapping is typically designed using two-dimensional or four-dimensional continuous textures. However, after practical experience and careful research, the inventors discovered that these methods require repeated texture mapping to achieve sufficient texture resolution to cover the entire object. Repeatedly repeating the texture makes the covered object look unnatural and incurs performance overhead, thus presenting a technical problem of ineffective texture sampling. Based on this, this disclosure proposes a texture sampling method applicable to texture mapping design. This method generates controllable random adjustment parameters based on an original texture map, thereby rapidly and randomly changing the texture. This achieves infinite, non-repeating texture sampling using a single original texture map, thus effectively solving the technical problem of ineffective texture sampling.
[0041] According to one embodiment of this disclosure, an embodiment of a texture sampling method 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.
[0042] This method embodiment can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, the mobile terminal can be a smartphone (such as an Android phone, iOS phone, etc.), tablet computer, PDA, mobile Internet Device (MID), PAD, game console, and other terminal devices. Figure 1 This is a hardware structure block diagram of a mobile terminal using a texture sampling method according to an embodiment of this disclosure. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which 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 a memory 104 for storing data are also shown. Optionally, the mobile terminal may further include a transmission device 106 for communication functions, an input / output device 108, and a display device 110. 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.
[0043] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the texture sampling method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the texture sampling method described above. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0044] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0045] The inputs in input / output device 108 can come from multiple human interface devices (HIDs). Examples include keyboards and mice, gamepads, and other dedicated game controllers (such as steering wheels, fishing rods, dance mats, and remote controls). Some HIDs, in addition to providing input functions, can also provide output functions, such as force feedback and vibration from gamepads, and audio output from controllers.
[0046] Display device 110 may be, for example, a head-up display (HUD), a touchscreen liquid crystal display (LCD), and a touch display (also referred to as a "touchscreen" or "touch display"). The LCD allows a user to interact with the user interface of the mobile terminal. In some embodiments, the mobile terminal has a graphical user interface (GUI), which allows the user to interact with the GUI by touching and / or gesturing on a touch-sensitive surface. Optional human-computer interaction functions include: creating web pages, drawing, word processing, creating electronic documents, playing games, video conferencing, instant messaging, sending and receiving emails, a call interface, playing digital video, playing digital music, and / or web browsing, etc. Executable instructions for performing the above human-computer interaction functions are configured / stored in one or more processor-executable computer program products or readable storage media.
[0047] 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.
[0048] In one possible implementation, embodiments of this disclosure provide a texture sampling method. Figure 2 This is a flowchart of a texture sampling method according to one embodiment of the present disclosure, such as... Figure 2 As shown, the method may include the following steps:
[0049] Step S202: Obtain the original texture coordinates to be sampled in the original texture map.
[0050] In the technical solution provided by step S202 of this disclosure, the original texture coordinates to be sampled in the original texture map can be obtained. The original texture map can be a single texture map. The original texture coordinates can be the texture map coordinates (Tex Coord), which can be represented by UV coordinates.
[0051] Alternatively, the original texture coordinates to be sampled in the original texture map can be obtained by adding a texture coordinate attribute to the material's properties.
[0052] Step S204: Generate at least one set of target random adjustment parameters based on the original texture coordinates.
[0053] In the technical solution provided by step S204 of this disclosure, at least one set of target random adjustment parameters can be generated based on the original texture coordinates. These target random adjustment parameters can be rotation, scaling, or displacement parameters, also known as random adjustment functions. They can be functions combining rotation, scaling, and displacement logic, and can be used to influence scalar values of the original texture coordinates.
[0054] Optionally, the original texture coordinates to be sampled in the original texture map can be obtained. The original texture coordinates can be input into the UV interface that connects the original texture map and the target random adjustment parameters to generate at least one set of target random adjustment parameters.
[0055] Step S206: Adjust the original texture coordinates based on the target random adjustment parameters to obtain the target texture coordinates.
[0056] In the technical solution provided in step S206 of this disclosure, the original texture coordinates can be adjusted based on the target random adjustment parameters to obtain the target texture coordinates. The adjustment methods can include rotation, scaling, translation, etc., which are only illustrative examples and do not impose specific limitations on the adjustment methods.
[0057] Optionally, at least one set of target random adjustment parameters is generated based on the original texture coordinates. Based on the target random adjustment parameters, the original texture coordinates can be adjusted to obtain the target texture coordinates.
[0058] Step S208: Based on the target texture coordinates, sample the original texture map to obtain the target texture map.
[0059] In the technical solution provided by step S208 of this disclosure, the target texture coordinates can be obtained, and the original texture map can be mixed based on the target texture coordinates to obtain the target texture map.
[0060] Optionally, this embodiment can create an input node (e.g., an input node) to collect the original texture coordinates to be sampled from the original texture map. The original texture coordinates can be processed to generate at least one set of target random adjustment parameters. These parameters can serve as key points controlling the random transformation of the texture, allowing each tile to obtain different random variations. Based on the target texture coordinates, the original texture map can be sampled to obtain the target texture map.
[0061] Through the above steps S202 to S208, the original texture coordinates to be sampled in the original texture map are obtained; at least one set of target random adjustment parameters are generated based on the original texture coordinates; the original texture coordinates are adjusted based on the target random adjustment parameters to obtain the target texture coordinates; and the original texture map is sampled based on the target texture coordinates to obtain the target texture map. In other words, this embodiment of the present disclosure generates controllable random adjustment parameters based on an original texture map, thereby rapidly and randomly changing the texture. This achieves the goal of infinitely non-repeating texture sampling using only one original texture map, thus achieving the technical effect of effective texture sampling and solving the technical problem of ineffective texture sampling.
[0062] The methods described above in the embodiments of this disclosure will be further described below.
[0063] As an optional embodiment, step S204, generating at least one set of target random adjustment parameters based on the original texture coordinates, includes: adjusting the original color channel information corresponding to the original texture coordinates to obtain target color channel information; and generating target random adjustment parameters based on the target color channel information.
[0064] In this embodiment, the original color channel information corresponding to the original texture coordinates can be adjusted to obtain the target color channel information, and target random adjustment parameters can be generated based on the target color channel information. The color channel information can be red (R), green (G), and blue (B) color channel information. Adjusting the original color channel information can be done through methods such as misalignment, scrambling, or misalignment addition; these are merely illustrative examples and do not impose specific limitations on the adjustment methods. The target color channel information can be a recombined RGB vector.
[0065] Optionally, a node can be created as an input point to sample the original texture coordinates. Masks in the red and green channels of the original texture coordinates can then be extracted to obtain the mask (Mask(R)) in the red channel and the mask (Mask(G)) in the green channel. Three multi-channel vectors can be created to adjust the input values of the red and green channels; for example, the x, y, and z axes can be misaligned to obtain a more random result, resulting in re-extracted and recreated target random adjustment parameters.
[0066] Alternatively, the recombined target random adjustment parameters can be input into the sine function by appending multiple times, multiplying with a random value, and then using a numeric function (such as the Frac function) to obtain the first decimal place output.
[0067] For example, x, y, and z correspond to the RGB color channels. The original color channel information can be shuffled by re-pairing the RGB values extracted from the two inputs. For instance, the first red channel, the first green channel, and the second blue channel can be paired (i.e., R1\G1\B2), and the first red channel, the second green channel, and the second blue channel can be paired (R1\G2\B2). It should be noted that this shuffling method is merely an example and does not impose any specific limitations.
[0068] As an optional embodiment, generating target random adjustment parameters based on target color channel information includes: adjusting target color channel information based on random values; and determining target random adjustment parameters based on the adjusted target color channel information.
[0069] In this embodiment, a random value is determined, and the target color channel information can be adjusted based on this random value. The target random adjustment parameters can be determined based on the adjusted target color channel information. The random value can be represented by `randomSeed`, and can be a pre-set value. For example, a rotation angle can be set: 0.25 = 90°, 0.5 = 180°, 0.75 = 270°, 1 = 360°. Therefore, the random value can be 0.2, 1, etc. It should be noted that this is only an example and no specific limitation is made on the size of the random value.
[0070] Optionally, random values can be input into the random noise logic function (MF_Random_Noise) to obtain default values. The target color channel information is then adjusted based on these default values. Based on the adjusted target color channel information, the target random adjustment parameters are determined. These target random adjustment parameters may include rotation, translation, and scaling logic, random transformation logic, etc.
[0071] For example, random values can be input into a random noise logic function to obtain default values. Based on these default values, the red and green channels can be adjusted, and the results can be combined and input into a displacement interface (e.g., an offset interface) to adjust the target color channel information. Based on the adjusted target color channel information, the target random adjustment parameters can be determined.
[0072] As an optional embodiment, determining the target random adjustment parameters based on the adjusted target color channel information includes: adjusting the original random adjustment parameters based on the adjusted target color channel information to obtain the target random adjustment parameters, wherein the type of the target color channel information is associated with the type of the original random adjustment parameters.
[0073] In this embodiment, the original random adjustment parameters can be adjusted based on the adjusted target color channel information to obtain the target random adjustment parameters. The original random adjustment parameters can be represented by MF_UV Random Transform, which can be a function of random transformation, such as rotation angle, scaling variable, or translation variable.
[0074] Optionally, the blue (B) channel of the random noise can be multiplied by a random value to obtain the target color channel information adjusted based on the random value. The original random adjustment parameters can be adjusted based on the adjusted target color channel information to obtain a function of random transformation (i.e., the target random adjustment parameters).
[0075] As an optional embodiment, the adjusted target color channel information includes first type channel color information, second type channel color information, and third type channel color information. Based on the adjusted target color channel information, the original random adjustment parameters are adjusted to obtain target random adjustment parameters, including at least one of the following: adjusting the original random displacement parameters based on the first type channel color information and the second type channel color information to obtain target random displacement parameters, wherein the target random displacement parameters are used to move the original texture coordinates; adjusting the original random rotation parameters based on the third type channel color information to obtain target random rotation parameters, wherein the target random displacement parameters are used to rotate the original texture coordinates; and adjusting the original random scaling parameters based on the third type channel color information to obtain target random scaling parameters, wherein the target random displacement parameters are used to scale the original texture coordinates.
[0076] In this embodiment, the adjusted target color channel information may include first type channel color information, second type color channel information, and third type color channel information. The original random adjustment parameters are adjusted based on the adjusted target color channel information to obtain the target random adjustment parameters.
[0077] Optionally, the original random displacement parameters are adjusted based on the first type of channel color information and the second type of color channel information to obtain the target random displacement parameters. The first type of channel information can be R channel information, and the second type of information can be G channel information. The target random displacement parameters can be used to move the original texture coordinates and can be a displacement variable, also known as a random transformation value.
[0078] For example, the first and second type channel color information can be extracted from the random noise logic function. This first and second type color channel information can be combined and input into the displacement interface to adjust the original random displacement parameters, obtaining the target random displacement parameters. Based on these target random displacement parameters, the original texture coordinates can be moved.
[0079] For another example, the texture coordinates of the output function can be extracted. These extracted texture coordinates are then input into the texture coordinate interface of the rotation, scaling, and displacement function. It's necessary to encapsulate the input data into a function before connecting the texture map and variable interfaces. After encapsulation, the UV coordinates of the texture are extracted. Random values can be input into the random noise logic function to obtain a preview value, which can then be set as a default value. The red (R) and green (G) channels from the random function can be extracted, merged, and input into the Offset displacement interface to obtain random transformation values.
[0080] Optionally, the original random rotation parameters are adjusted based on the third-type channel color information to obtain the target random rotation parameters, where the third-type channel color information can be B channel information. The target random displacement parameters can be used to rotate the original texture coordinates and can be a rotation angle.
[0081] For example, the blue channel color information can be retrieved from the MF_Random_Noise random noise, and a random value can be added to the function to add random noise to the rotation. The blue (B) channel of the random noise can be multiplied by a random value and used as the minimum rotation value (Rotation Min) and maximum rotation value (Rotation Max) of the alpha channel mixing input to obtain the random rotation value.
[0082] Optionally, based on the third type channel color information, the original random scaling parameters are adjusted to obtain the target random scaling parameters, wherein the target random displacement parameters can be used to scale the original texture coordinates and can be a scaling variable.
[0083] For example, the blue channel can be multiplied by a random value from the random noise logic function, and the result can be used as the random scaling values (scale Min and scale Max) of the Alpha channel mixing input, thus obtaining the scaling variable. The random transformation function can be used to determine the random scaling value.
[0084] As an optional embodiment, the original texture coordinates are adjusted based on the target random adjustment parameters to obtain the target texture coordinates, including: rotating the original texture coordinates into first target texture coordinates based on random rotation parameters; scaling the first target texture coordinates into second target texture coordinates based on random scaling parameters; and offsetting the second target texture coordinates into target texture coordinates based on random displacement parameters.
[0085] In this embodiment, random rotation parameters, random scaling parameters, and random displacement parameters are determined. Based on the random rotation parameters, the original texture coordinates can be rotated to first target texture coordinates. Based on the random scaling parameters, the first target texture coordinates are scaled to second target texture coordinates. Based on the random displacement parameters, the second target texture coordinates can be offset to target texture coordinates. The random scaling parameters can also be referred to as random scaling values. The random rotation parameters can also be referred to as random rotation values. The random displacement parameters can also be referred to as random variation values.
[0086] Optionally, a translation variable (e.g., 0.3, 0.5) can be added to the rotation and scaling logic to obtain an encapsulated function (which can be named MF_Transform UVs) that can change the rotation center and scaling after a displacement.
[0087] For example, the original texture coordinates can be processed in the order of rotation, scaling, and translation to obtain the target texture coordinates.
[0088] As an optional implementation, random values are determined based on the grayscale image in a distorted state.
[0089] In this embodiment, random values can be determined based on a grayscale image in a distorted state. The grayscale image can also be called a random mask, and can be a multi-channel black and white texture mask or a multi-channel black and white texture mask. This is merely an example and does not impose specific limitations on the type of grayscale image.
[0090] Alternatively, a random transformation function can be referenced in the material shader, allowing any input value to be converted into a random transformation effect. Alternatively, an image processing software (such as Photoshop, Substance 3D Designer, etc.) can be used to create a multi-channel black and white texture mask as the random value, which can be used to control and increase the area of random variation. The random transformation function can then be referenced in the material shader to obtain the area of random variation.
[0091] As an optional embodiment, step S204, determining a random value based on the distorted grayscale image, includes: adjusting the grayscale value of the grayscale image based on the target variable; and rounding the adjusted grayscale value to obtain the random value.
[0092] In this embodiment, the grayscale values of the grayscale image can be adjusted based on a target variable. The adjusted grayscale values can be rounded to obtain random values. This adjustment can be achieved by multiplying the grayscale value by a variable. The rounding method can be any rounding operation; this is merely an example and no specific limitation is made on the rounding method.
[0093] Alternatively, an image processing software can be used to create a multi-channel distorted texture as a random mask, which is then multiplied by a target variable to adjust the grayscale value of the grayscale image. The adjusted grayscale value can be rounded down by the number of turns, and then linked to the random number generator of the random transformation function to obtain a random value.
[0094] Optionally, when the target variable being multiplied has different values, different decomposition effects can be randomly generated. The larger the target variable, the more detailed the decomposition.
[0095] As an optional embodiment, step S204 involves establishing a polygonal mesh based on the original texture coordinates and determining random values based on the polygonal mesh.
[0096] In this embodiment, a polygonal mesh can be created based on the original texture coordinates, and random values can be determined based on the polygonal mesh. The polygonal mesh, also known as a mesh block, can be a hexagonal mesh.
[0097] Optionally, a polygonal mesh can be created based on the original texture coordinates. Procedural hexagonal sampling is used to solve the problem of seams appearing in the texture after decomposition and reconstruction.
[0098] For example, a red-blue grid can be created first to construct a hexagonal grid. This hexagonal grid can then be sharpened, and the tilt angle of the sharpened hexagonal grid can be corrected to obtain the hexagonal sampling molecular grid function (MF_Hex GridDemo). Random values can then be determined based on this hexagonal sampling molecular grid function.
[0099] As an optional embodiment, a polygonal mesh is established based on the original texture coordinates, including: establishing a quadrilateral mesh based at least on the original color channel information corresponding to the original texture coordinates, wherein the quadrilateral mesh includes cubes of different color gamuts; and converting the quadrilateral mesh into a hexagonal mesh.
[0100] In this embodiment, a quadrilateral mesh can be established based at least on the original color channel information corresponding to the original texture coordinates, and the quadrilateral mesh can be converted into a hexagonal mesh. The quadrilateral mesh can be a red-blue-green quadrilateral mesh, and can include cubes of different color gamuts.
[0101] For example, this embodiment can create a node (e.g., a floor node) to separate the U(R) and V(G) channel information from the original color channel information, and then subtract them to obtain a red-blue-green quadrilateral grid. Then, a three-dimensional vector (0,1,2) is added and multiplied by 1 / 3 to distinguish the squares of several different color gamuts. The first step involves indistinct black, white, and gray squares, so further differentiation of the color gamut is needed to obtain three different grid squares. The added three-dimensional vector can be a pre-set value, which can be selected according to the actual situation; this is only an example, and no specific limitation is made on the size of the three-dimensional vector. The three different channel squares can be color-corrected, and then rounded down to obtain a red-blue-green quadrilateral grid. The red-blue-green quadrilateral grid can be converted into a hexagonal grid.
[0102] As an optional embodiment, a quadrilateral mesh is established based at least on the original color channel information corresponding to the original texture coordinates, including: establishing a hexagonal mesh based on the mesh tilt angle and the original color channel information corresponding to the original texture coordinates.
[0103] In this embodiment, the mesh tilt angle and the original color channel information corresponding to the original texture coordinates are determined. A hexagonal mesh can be constructed based on the mesh tilt angle and the original color channel information corresponding to the original texture coordinates.
[0104] Optionally, the tilt angle of the hexagonal mesh can be corrected to obtain a programmed hexagonal mesh.
[0105] As an optional embodiment, step S204, converting the quadrilateral mesh into a hexagonal mesh, includes: converting the quadrilateral mesh into a hexagonal mesh based on the original texture coordinates and the original color channel information corresponding to the original texture coordinates.
[0106] In this embodiment, a quadrilateral mesh can be converted into a hexagonal mesh based on the original texture coordinates and the corresponding original color channel information. The original color channel information can be the separated U(R) and V(G) channel information. The original texture coordinates can include the X and Y coordinates.
[0107] Optionally, the U(R) and V(G) channels in the original texture coordinates can be separated, their absolute values taken, and the XY of Texcoord can be converted to YX to create a hexagonal mesh that provides red, green, and blue channels. This mesh is then combined with a quadrilateral mesh, and the relationship between colors is enhanced using the power function to obtain a hexagonal mesh with sharpened edges.
[0108] As an optional embodiment, the edges of the hexagonal mesh are sharpened; determining random values based on the polygonal mesh includes: determining random values based on the sharpened hexagons.
[0109] In this embodiment, the edges of the hexagonal mesh can be sharpened, and random values can be determined based on the sharpened hexagons.
[0110] Optionally, a red-blue-green quadrilateral grid is first created, and a hexagonal grid is constructed based on the quadrilateral grid. The hexagonal grid is then sharpened, and the tilt angle of the sharpened hexagonal grid is corrected to obtain the hexagonal sampling molecular grid function (MF_Hex Grid Demo). Random values are then determined based on the hexagonal sampling molecular grid function.
[0111] As an optional embodiment, the original texture coordinates are converted into multiple sets of rendering data corresponding to multiple original color channel information; different target texture maps are adjusted based on the multiple sets of rendering data; and the adjusted different target texture maps are combined to obtain a combined texture map.
[0112] In this embodiment, the original texture coordinates can be converted into multiple sets of rendering data corresponding to multiple original color channel information. Different target texture maps can be adjusted based on these multiple sets of rendering data, and the adjusted target texture maps can be combined to obtain a combined texture map. The multiple sets of rendering data can be the split R, G, and B rendering data.
[0113] Optionally, the original color channel information can be split to obtain multiple sets of rendering data corresponding to multiple original color channel information. Each tile will obtain a different randomly varying texture, and different target texture maps can be mixed and recombined based on multiple sets of rendering data. Furthermore, the adjusted different target texture maps are recombined to obtain a combined texture map.
[0114] Alternatively, recombining the adjusted target texture maps can eliminate the problem of edge seams.
[0115] As an optional embodiment, the number of tiling times is determined based on the original texture coordinates; the target texture coordinates are then tiled according to the number of tiling times.
[0116] In this embodiment, the number of tiling times can be determined based on the original texture coordinates, and the target texture coordinates can be tiled according to the number of tiling times.
[0117] Optionally, Texcoord can be multiplied by a vector to control the number of tilings and linked to the base color.
[0118] As an optional embodiment, the target texture map is rendered and displayed as target terrain in a virtual scene.
[0119] In this embodiment, the target texture map can be rendered and displayed as target terrain in a virtual scene. The virtual scene can include a terrain scene. The target terrain can be mountains, land, etc.; this is merely an example and no specific limitation is made on the type of target terrain.
[0120] In this embodiment of the disclosure, by generating controllable random adjustment parameters based on an original texture map, the texture is rapidly and randomly transformed. This achieves the goal of infinite and non-repeating texture sampling using only an original texture map, thereby achieving the technical effect of effective texture sampling and solving the technical problem of ineffective texture sampling.
[0121] The technical solutions of this disclosure will be further illustrated below with reference to preferred embodiments. Specifically, a method for simulating spatial molecular decomposition to achieve infinitely large non-repeating texture sampling will be further explained.
[0122] Currently, texture mapping comes in two forms: two-dimensional continuous and four-dimensional continuous. If a single four-dimensional continuous texture is used on a large object or terrain, it needs to be repeated multiple times at great distances to achieve sufficient texture resolution to cover the entire object. However, repeatedly repeating the texture makes the covered object look unnatural and also leads to performance overhead. World texture mapping can also be performed using very large textures. Figure 3 This is a schematic diagram of an ultra-large texture according to one embodiment of the present disclosure, such as... Figure 3 As shown, however, once the viewpoint is high, the terrain will inevitably have a noticeable sense of repetition if other texture maps are not added. In another case, a large number of other textures can be used to break this repetition, but this requires generating an additional set of textures, which will result in excessive data usage.
[0123] In one alternative embodiment, it can be customized for specific terrain. Figure 4 This is a schematic diagram of a special mountain texture according to one embodiment of the present disclosure, such as... Figure 4 As shown, individual customization can only exist in the creation of some special mountains, and cannot meet the needs of large-scale terrain, especially the terrain textures in turn-based strategy games (SLG).
[0124] In another alternative embodiment, world texture mapping can be performed using an ultra-large texture. However, using ultra-large world texture sampling would undoubtedly consume a lot of performance and place even more stringent requirements on the device.
[0125] To address the technical problem of the aforementioned methods' inability to perform texture sampling in games, this disclosure provides a method for achieving infinitely large, non-repeating texture sampling by simulating the decomposition of spatial molecules. This method utilizes molecular-like logic, sequentially writing random noise logic, rotation / translation and scaling logic, and random transformation logic, each encapsulated as an independent function. Using the encapsulated random transformation function and a distorted grayscale image or a programmed hexagonal molecular mesh, the decomposition and recombination texture logic is created and then independently encapsulated into a function, enabling random transformation and decomposition of texture tiling. The function can pass random numbers, acting as a molecular formula, to the material texture as a key point for controlling the random transformation of UVs. By using a controllable random value as a seed, any random value can be provided to offer a set of random transformation offsets, rotations, and scaling, allowing each tile to obtain different random changes to sample the surface texture. Then, the tiles are mixed together, achieving infinitely non-repeating sampling with a single texture set. This solves the technical problem of ineffective texture sampling and achieves a technically effective texture sampling effect.
[0126] The adaptive tool for topological equivalence model attachments in the embodiments of this disclosure will be further described below.
[0127] As an optional implementation, a function for random noise logic is written.
[0128] In this embodiment, Figure 5 This is a schematic diagram illustrating the writing of a random noise logic function according to one embodiment of the present disclosure, such as... Figure 5 As shown, a node (input in) can be created as the input point, and texture coordinates (Tex Coord) can be sampled. Then, masks in the red and green channels can be extracted to obtain the mask (Mask(R)) in the red channel and the mask (Mask(G)) in the green channel. Three multi-channel vectors can be created, and the x, y, and z axes of the input values in the red and green channels can be shuffled to obtain more random results. Then, new RGB vectors can be extracted and created. Figure 6 This is a schematic diagram illustrating the acquisition of a random noise logic function according to one embodiment of the present disclosure, such as... Figure 6 As shown, the recombined RGB vector can be input into a sine function by appending multiple values, multiplied by a random value, and then the first decimal place is obtained using a numerical function to get the random noise logic function, as shown below. Figure 6 As shown, after encapsulating the above process into a random noise function, the image after encapsulation is obtained. Figure 6 As shown, the encapsulated random noise logic function can be represented by MF_Random_Noise.
[0129] Optionally, x, y, and z correspond to the RGB color channels. The input signals can be shuffled by re-pairing the extracted RGB values from each input. For example, the first red channel, the first green channel, and the second blue channel can be paired (i.e., R1\G1\B2), and the first red channel, the second green channel, and the second blue channel can be paired (R1\G2\B2). It should be noted that this shuffling method is merely illustrative and does not impose any specific limitations.
[0130] As an alternative implementation, a function that combines rotation, scaling, and translation logic can be written.
[0131] In this embodiment, Figure 7 This is a schematic diagram illustrating the writing of a function that combines rotation, scaling, and translation logic according to one embodiment of this disclosure, as shown below. Figure 7 As shown, writing the rotation function allows you to call up the sine and cosine function nodes, inputting a variable vector into the function. You then call TeXcord and use subtraction to extract the red (R) and green (G) channels. For example, you can set the rotation angles: 0.25 = 90°, 0.5 = 180°, 0.75 = 270°, and 1 = 360°. You can add the cosine U and sine V, subtract the cosine V from the sine U, and append them together to obtain the new UV. Finally, you identify the rotation center and output the rotation logic function. This rotation logic function can be encapsulated to obtain the encapsulated rotation logic function.
[0132] In this embodiment, Figure 8 This is a schematic diagram illustrating the acquisition of a scaling logic function according to one embodiment of the present disclosure, such as... Figure 8 As shown, a scaling variable (e.g., 2.5) can be added to the rotation logic function, followed by multiplication. The order of these steps cannot be reversed to obtain the scaling logic function. This scaling logic function can then be encapsulated to obtain the encapsulated scaling logic function. The size of the scaling variable can be selected based on the desired effect in the actual application.
[0133] In this embodiment, Figure 9 This is a schematic diagram illustrating the acquisition of a displacement logic function according to one embodiment of the present disclosure, such as... Figure 9 As shown, you can add a translation variable (e.g., 0.3, 0.5) to the rotation and scaling logic to obtain a wrapper function (which can be named MF_TransformUVs) that can change the rotation center and scaling logic after a displacement. Figure 10 This is a schematic diagram of a movement variable to be added according to one embodiment of this disclosure, such as... Figure 10 As shown, the rotation center without a translation variable does not rotate; Figure 11This is a schematic diagram showing the addition of a movement variable according to one embodiment of this disclosure, as shown below. Figure 11 As shown, the center of rotation changes after adding the translation variable.
[0134] As an optional embodiment, Figure 12 This is a schematic diagram illustrating the merging of a random noise function and a rotation-scaling displacement function according to one embodiment of this disclosure, as shown below. Figure 12 As shown, a new function can be obtained by merging random noise and rotation / scaling / displacement functions.
[0135] Optionally, Figure 13 This is a schematic diagram illustrating the construction of a random position function according to one embodiment of the present disclosure, such as... Figure 13 As shown, the texture coordinates (UV coordinates) of the output function can be extracted. The extracted texture coordinates are then input into the texture coordinate interface (UV) of the rotation, scaling, and displacement function. Specifically, the data output from the input port (Input UV) needs to be encapsulated into a function before connecting the texture map and the variable interface, and the UV coordinates of the texture can be extracted after encapsulation into a function. Figure 14 This is a schematic diagram illustrating the determination of a default value according to one embodiment of the present disclosure, such as... Figure 14 As shown, you can input random values into the random function to get a preview value, and you can set the preview value as the default value. You can extract the red (R) and green (G) channels from the random function, merge them, and input them into the Offset shift interface to get a randomized value.
[0136] Optionally, the blue channel can be called from the MF_Random_Noise random noise, and a random value can be added to the function MF_TransformUVs to achieve the purpose of adding a random function to the rotation. The blue (B) channel of the random noise can be multiplied by a random value and used as the alpha channel to mix the minimum and maximum rotation values of the input, thereby obtaining the random rotation value.
[0137] Optionally, the blue channel can be multiplied by a random value from the MF_Random_Noise random noise, and the result can be used as the alpha channel. This is then mixed with the random scaling value of the input to obtain a random transformation function (which can be named MF_UVRandom Transform). The random transformation function can be used to determine the random scaling value.
[0138] For example, you can obtain the output of random rotation values, random scaling values, random change values, and UV tiling times, and mix them together with the input function MF_Transform UVs to construct a function of random transformation.
[0139] As an alternative implementation, a random transformation function can be referenced in the material shader. Figure 15 This is a schematic diagram illustrating the random transformation effect according to one embodiment of the present disclosure, such as... Figure 15 As shown, any value (e.g., 0.3) input into the random transformation function or the shift logic function can be converted into an image with a random transformation effect.
[0140] Alternatively, an image processing software can be used to create a multi-channel black and white texture mask as the random value. Figure 16 This is a schematic diagram of a black and white texture mask according to one embodiment of the present disclosure, such as... Figure 16 As shown, it is possible to control or increase the area of random variation by using random values. Figure 17 This is a schematic diagram illustrating the referencing of a function into a material according to one embodiment of this disclosure, such as... Figure 17 As shown, a random transformation function can be referenced in the material shader to obtain randomly changing regions.
[0141] As an alternative implementation, a random transformation function can be used to begin decomposing the texture.
[0142] Optionally, Texcoord can be multiplied by a vector to control the number of tilings and linked to the base color. Figure 18 This is a schematic diagram of a random mask according to one embodiment of the present disclosure, such as... Figure 18 As shown, you can use Photoshop or Substance 3D Designer to create a multi-channel distortion texture as a random mask, then multiply it by a variable, round it, and then link it to the random number generator of the MF_UV Random Transform function. Figure 19 This is a schematic diagram illustrating different decomposition effects according to one embodiment of the present disclosure, such as... Figure 19 As shown, when the variables being multiplied have different values, they can all be randomly transformed into different decomposition effects. The larger the variable, the more detailed the decomposition.
[0143] As an alternative implementation, procedural hexagonal sampling can be used to address the problem of seams appearing in textures after decomposition and recombination.
[0144] In this embodiment, a programmed hexagonal sampling molecular grid function can be created first.
[0145] Optionally, Figure 20 This is a schematic diagram of fabricating a programmed hexagonal sampling molecular grid function according to one embodiment of the present disclosure, as shown below. Figure 20As shown, a node (e.g., a floor node) can be created to separate the U(R) and V(G) channels, and then subtracted to obtain a red-blue-green quadrilateral grid. A 3D vector (0,1,2) is then added and multiplied by 1 / 3 to distinguish the squares from different color gamuts. The first step involves indistinct black, white, and gray squares, so further differentiation of the color gamuts is needed to obtain three different grid squares. The added 3D vector can be a pre-defined value, which can be selected according to the actual situation; this is just an example, and no specific limit is placed on the size of the 3D vector. Frac can be added to the squares with the three different channels for color correction, and then Round can be added to round up to obtain the red-blue-green quadrilateral grid.
[0146] Optionally, Figure 21 This is a schematic diagram of a deformed hexagonal mesh according to one embodiment of the present disclosure, such as... Figure 21 As shown, the U(R) and V(G) channels of Texcoord can be separated, their absolute values taken, and the XY of Texcoord converted to YX to create red, green, and blue channels. This can be combined with a hexagonal sampling molecular grid function. Figure 22 This is a schematic diagram of a sharpened hexagonal mesh according to one embodiment of the present disclosure, such as... Figure 22 As shown, the value of the power function is set, for example, it can be 12.0. The power function is used to strengthen the relationship between colors and obtain a hexagonal grid with sharpened edges.
[0147] In this embodiment, Figure 23 This is a schematic diagram of a corrected deformed hexagonal mesh according to one embodiment of the present disclosure, such as... Figure 23 As shown, the tilt angle of the hexagonal mesh can be corrected to obtain a programmed hexagonal mesh.
[0148] In this embodiment, a red-blue grid is first created to construct a hexagonal grid. The hexagonal grid is then sharpened, and the tilt angle of the sharpened hexagonal grid is corrected to obtain a hexagonal sampling molecular grid function.
[0149] As an alternative embodiment, the texture of the hexagonal mesh is decomposed and the sampled texture is reconstructed.
[0150] In this embodiment, a three-layer ID (used by multisampling to eliminate edge seams) can be created for the hexagonal grid function, separating and recombining the R, G, and B layers. A stable texture can be split into three different rendering data before output. The functions MF_HexGridDemo and MF_UVRandomTransform are combined. Simultaneously, a new shader is created, and the function is called to copy MF_HexGridDemo and three MF_UVRandomTransform functions using three different random numbers to sample the texture. The function MF_HexGridDemo takes the texture, tiling variable, scaling variable, and focus variable as input. Figure 24 This is a schematic diagram of the decomposition texture of a hexagonal mesh according to one embodiment of the present disclosure, such as... Figure 24 As shown, linking to a material ball results in noticeable seams. Finally, the texture is broken down and reassembled using the function MF_HexGridDemo to resolve the seam issue.
[0151] Optionally, Figure 25 This is a schematic diagram of a resampled texture according to one embodiment of the present disclosure, such as... Figure 25 As shown, by changing the values of variables that affect texcoord, the results of random changes can be influenced, thereby enabling the creation of infinitely large non-repeating sampled textures. It is also possible to freely change textures to suit the style of the project, and the resampled textures are non-repeating and seamless.
[0152] In this embodiment, a single material can solve the problem of severe repetition caused by texture tiling, achieving infinitely large and non-repeating texture sampling with just one texture. This greatly enhances the naturalness of the terrain from a high perspective, enabling rapid texture transformation via functional logic. Furthermore, it perfectly solves the problem of texture repetition in extremely large terrains from a high perspective, improving the overall art quality. Simultaneously, the procedural hexagonal sampling molecular mesh logic control offers high controllability, efficiency, convenience, and wide applicability, eliminating the tedious and time-consuming manual adjustment and modification of surface textures, thus achieving effective texture sampling.
[0153] In this embodiment, for the creation of terrain textures, random noise logic, rotation, translation and scaling logic, and random transformation logic are constructed, and each of these logics is encapsulated as an independent function. The encapsulated random transformation logic is used in conjunction with a grayscale image or a programmatic hexagonal molecule to construct a texture splitting and recombination logic. This splitting and recombination logic is further encapsulated as a function, and the constructed function is used as a random number in the molecule to pass to the material texture. Based on the constructed function, the random transformation of UVs is controlled, thereby enabling each tile to obtain different random transformations and sampled surface textures. The sampled surface textures and the results of random transformations are mixed together to obtain a rendered image with surface textures, thus achieving infinitely large non-repeating texture sampling. This solves the technical problem of ineffective texture sampling and achieves the technical effect of effective texture sampling.
[0154] 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 related technology, 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 of the various embodiments of this disclosure.
[0155] This embodiment also provides a texture sampling device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "unit" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0156] Figure 26 This is a structural block diagram of a texture sampling device according to an embodiment of the present disclosure, such as... Figure 26 As shown, the texture sampling device 2600 may include: an acquisition unit 2602, a generation unit 2604, an adjustment unit 2606, and a sampling unit 2608.
[0157] Acquisition unit 2602 is used to acquire the original texture coordinates to be sampled in the original texture map.
[0158] The generation unit 2604 is used to generate at least one set of target random adjustment parameters based on the original texture coordinates.
[0159] The adjustment unit 2606 is used to adjust the original texture coordinates based on the target random adjustment parameters to obtain the target texture coordinates.
[0160] The sampling unit 2608 is used to sample the original texture map based on the target texture coordinates to obtain the target texture map.
[0161] In this embodiment, the acquisition unit acquires the original texture coordinates to be sampled from the original texture map; the generation unit generates at least one set of target random adjustment parameters based on the original texture coordinates; the adjustment unit adjusts the original texture coordinates based on the target random adjustment parameters to obtain the target texture coordinates; and the sampling unit samples the original texture map based on the target texture coordinates to obtain the target texture map. This achieves the technical effect of effectively performing texture sampling and solves the technical problem of ineffective texture sampling.
[0162] It should be noted that the above-mentioned units can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above-mentioned units are located in the same processor; or, the above-mentioned units are located in different processors in any combination.
[0163] 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.
[0164] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0165] S1, obtain the original texture coordinates to be sampled in the original texture map;
[0166] S2, generate at least one set of target random adjustment parameters based on the original texture coordinates;
[0167] S3, based on the target random adjustment parameters, adjust the original texture coordinates to obtain the target texture coordinates;
[0168] S4, based on the target texture coordinates, samples the original texture map to obtain the target texture map.
[0169] 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.
[0170] 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.
[0171] 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.
[0172] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0173] S1, obtain the original texture coordinates to be sampled in the original texture map;
[0174] S2, generate at least one set of target random adjustment parameters based on the original texture coordinates;
[0175] S3, based on the target random adjustment parameters, adjust the original texture coordinates to obtain the target texture coordinates;
[0176] S4, based on the target texture coordinates, samples the original texture map to obtain the target texture map.
[0177] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0178] Figure 27 This is a schematic diagram of an electronic device according to an embodiment of the present disclosure. Figure 27 As shown, the electronic device 2700 is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0179] like Figure 27 As shown, the electronic device 2700 is presented in the form of a general-purpose computing device. The components of the electronic device 2700 may include, but are not limited to: at least one processor 2710, at least one memory 2720, a bus 2730 connecting different system components (including memory 2720 and processor 2710), and a display 2740.
[0180] The memory 2720 stores program code that can be executed by the processor 2710, causing the processor 2710 to perform the steps described in the method section of the embodiments of this disclosure according to various exemplary implementations of this disclosure.
[0181] The memory 2720 may include a readable medium in the form of volatile memory cells, such as random access memory (RAM) 10201 and / or cache memory 27202, and may further include a read-only memory (ROM) 10203, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
[0182] In some instances, memory 2720 may also include programs / utilities 27204 having a set (at least one) of program modules 27205, 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 2720 may further include memory remotely located relative to processor 2710, which can be connected to electronic device 2700 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.
[0183] Bus 2730 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 2710, or a local bus using any of the various bus structures.
[0184] The display 2740 may be, for example, a touch screen liquid crystal display (LCD) that allows a user to interact with the user interface of the electronic device 2700.
[0185] Optionally, the electronic device 2700 can also communicate with one or more external devices 1400 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 2700, and / or any device that enables the electronic device 2700 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 2750. Furthermore, the electronic device 2700 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 the network adapter 2760. Figure 27 As shown, network adapter 2760 communicates with other modules of electronic device 2700 via bus 2730. It should be understood that, although... Figure 27As not shown, other hardware and / or software modules may be used in conjunction with electronic device 2700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, Redundant Array of Independent Disks (RAID) systems, tape drives, and data backup storage systems.
[0186] The aforementioned electronic device 2700 may also 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.
[0187] Those skilled in the art will understand that Figure 27 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, electronic device 2700 may also include components that are more... Figure 27 The more or fewer components shown, or having the same Figure 1 Different configurations are shown. The memory 2720 can be used to store computer programs and corresponding data, such as the computer program and corresponding data corresponding to the texture sampling method in this embodiment. The processor 2710 executes various functional applications and data processing by running the computer program stored in the memory 2720, thereby implementing the aforementioned data processing method.
[0188] The sequence numbers of the embodiments disclosed above are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0189] 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.
[0190] In the several embodiments provided in this disclosure, 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 example, 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 couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.
[0191] 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.
[0192] 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.
[0193] 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 related technologies, 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 of 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.
[0194] The above are merely preferred embodiments of this disclosure. It should be noted that those skilled in the art can make various improvements and modifications 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 of texture sampling, characterized by, include: Obtain the original texture coordinates to be sampled from the original texture map; Generate at least one set of target random adjustment parameters based on the original texture coordinates; Based on the target random adjustment parameters, the original texture coordinates are adjusted to obtain the target texture coordinates; Based on the target texture coordinates, the original texture map is sampled to obtain the target texture map; The step of generating at least one set of target random adjustment parameters based on the original texture coordinates includes: adjusting the original texture coordinates to generate target color channel information; adjusting the target color channel information; and adjusting the original random adjustment parameters based on the adjusted target color channel information to obtain the target random adjustment parameters. The step of adjusting the original random adjustment parameters based on the adjusted target color channel information to obtain the target random adjustment parameters includes: adjusting the original random displacement parameters based on the first type channel color information and the second type channel color information in the adjusted target color channel information to obtain the target random displacement parameters in the target random adjustment parameters, wherein the target random displacement parameters are used to move the original texture coordinates.
2. The method of claim 1, wherein, The step of adjusting the original texture coordinates to generate target color channel information includes: The original color channel information corresponding to the original texture coordinates is adjusted to obtain the target color channel information.
3. The method according to claim 2, characterized in that, The adjustment of the target color channel information includes: The target color channel information is adjusted based on random values.
4. The method of claim 3, wherein, The type of the target color channel information is associated with the type of the original random adjustment parameter.
5. The method of claim 4, wherein, The adjusted target color channel information includes the first type of channel color information, the second type of channel color information, and the third type of channel color information. Furthermore, based on the adjusted target color channel information, the original random adjustment parameters are adjusted to obtain the target random adjustment parameters, which further include: Based on the third type of channel color information, the original random rotation parameters are adjusted to obtain the target random rotation parameters in the target random adjustment parameters, wherein the target random rotation parameters are used to rotate the original texture coordinates; Based on the third type of channel color information, the original random scaling parameters are adjusted to obtain the target random scaling parameters in the target random adjustment parameters, wherein the target random scaling parameters are used to scale the original texture coordinates.
6. The method of claim 5, wherein, Based on the target random adjustment parameters, the original texture coordinates are adjusted to obtain the target texture coordinates, including: Based on the target random rotation parameters, the original texture coordinates are rotated to the first target texture coordinates; Based on the target random scaling parameters, the first target texture coordinates are scaled to the second target texture coordinates; Based on the target random displacement parameters, the second target texture coordinates are moved to the target texture coordinates.
7. The method according to claim 3, characterized in that, The method further includes: The random value is determined based on the grayscale image in a distorted state.
8. The method of claim 7, wherein, Determining the random value based on the distorted grayscale image includes: Adjust the grayscale values of the grayscale image based on the target variable; The adjusted grayscale value is rounded down to obtain the random value.
9. The method of claim 3, wherein, The method further includes: Based on the original texture coordinates, a polygonal mesh is established; The random value is determined based on the polygonal grid.
10. The method according to claim 9, characterized in that, Based on the original texture coordinates, a polygonal mesh is constructed, including: Based on the original color channel information corresponding to the original texture coordinates, a quadrilateral mesh is established, wherein the quadrilateral mesh includes cubes of different color gamuts; The quadrilateral mesh is converted into a hexagonal mesh.
11. The method of claim 10, wherein, Based on the original color channel information corresponding to the original texture coordinates, a quadrilateral mesh is constructed, including: The quadrilateral mesh is established based on the mesh tilt angle and the original color channel information corresponding to the original texture coordinates.
12. The method of claim 10, wherein, Converting the quadrilateral mesh into a hexagonal mesh includes: Based on the original texture coordinates and the original color channel information corresponding to the original texture coordinates, the quadrilateral mesh is converted into the hexagonal mesh.
13. The method of claim 10, wherein, The method further includes: The edges of the hexagonal mesh are sharpened. Determining the random value based on the polygonal mesh includes: determining the random value based on the sharpened hexagonal mesh.
14. The method of claim 9, wherein, The method further includes: The original texture coordinates are converted into multiple sets of rendering data corresponding to multiple original color channel information; Based on the multiple sets of rendering data, the different target texture maps are adjusted respectively; The different target texture maps after adjustment are combined to obtain a combined texture map.
15. The method according to any one of claims 1 to 14, characterized in that, The method further includes: The number of tiling operations is determined based on the original texture coordinates; The target texture coordinates are tiled according to the number of tiling operations.
16. The method according to any one of claims 1 to 14, characterized in that, The method further includes: The target texture map is rendered and displayed as the target terrain in the virtual scene.
17. A texture sampling apparatus, characterized by: include: The acquisition unit is used to acquire the original texture coordinates to be sampled in the original texture map; A generation unit is configured to generate at least one set of target random adjustment parameters based on the original texture coordinates; An adjustment unit is used to adjust the original texture coordinates based on the target random adjustment parameters to obtain the target texture coordinates; A sampling unit is used to sample the original texture map based on the target texture coordinates to obtain the target texture map; The generation unit is configured to generate at least one set of target random adjustment parameters based on the original texture coordinates through the following steps: adjusting the original texture coordinates to generate target color channel information; adjusting the target color channel information; and adjusting the original random adjustment parameters based on the adjusted target color channel information to obtain the target random adjustment parameters. The generation unit is further configured to adjust the original random adjustment parameters based on the adjusted target color channel information through the following steps to obtain the target random adjustment parameters: based on the first type channel color information and the second type channel color information in the adjusted target color channel information, the original random displacement parameters are adjusted to obtain the target random displacement parameters in the target random adjustment parameters, wherein the target random displacement parameters are used to move the original texture coordinates.
18. 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 16 when run by a processor. 19.An electronic device comprising a memory and a processor, the electronic device characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method described in any one of claims 1 to 16.