Method and device for rendering attachment model in virtual scene, equipment and medium

By generating an attachment model in a virtual scene, using the scene picture taken by a virtual camera to determine the target terrain surface points and diffuse the surface points, the problems of high production cost and poor matching of attachment models in the prior art are solved, and high realism is achieved The attachment model is generated.

CN119406061APending Publication Date: 2025-02-11NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411564318.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

In the prior art, the production cost of attaching models in game scenes is high, the matching and modification process is cumbersome, which affects the development progress, and cannot fully match the terrain and landform during splicing, affecting the authenticity.

Method used

By generating an attachment model in a virtual scene, the scene picture taken by a virtual camera is used to determine the target terrain surface points, and multiple surface points are obtained through the diffusion of surface points, a virtual attachment unit is generated and merged to form an attachment model.

Benefits of technology

It realizes the generation of an attachment model that can match the target terrain surface in the game-building scene, avoiding interspersed with the scene, and improving the matching reality between the attachment model and the scene.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119406061A_ABST
    Figure CN119406061A_ABST
Patent Text Reader

Abstract

The invention provides an attachment model rendering method and device in a virtual scene, equipment and a medium, and relates to the technical field of image processing. The method comprises the following steps: in response to a scene building instruction, displaying a game scene picture formed by shooting a game building scene through a virtual camera in a graphical user interface; a target terrain unit is determined from the game building scene in the shooting direction of the virtual camera, and a target surface point used for being attached to an attachment model is determined on the model surface of the target terrain unit; performing surface point diffusion from the game building scene by taking the target surface point as a reference to obtain a plurality of surface points; and generating a plurality of virtual attachment units at the positions of the plurality of surface points in the game building scene, and merging the plurality of virtual attachment units to generate an attachment model. Based on the model surface of the target terrain unit and the shooting direction of the virtual camera, the attachment model is generated, matching with the model surface of the target terrain unit is achieved, and interpenetration with a game building scene is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a method, device, equipment and medium for rendering an attached model in a virtual scene. Background Art

[0002] In the field of computer multimedia, a large number of three-dimensional models are usually required to form a game scene in a three-dimensional game. Some scene models in the game scene that can improve the realism have become an indispensable part of the industrial production process.

[0003] At present, the traditional practice of attaching models in game scenes is that model makers make the attached models one by one, which has high production costs, and the relevant matching and modification processes of the attached models are cumbersome and time-consuming, seriously affecting the development progress. Alternatively, model makers make a large number of templates of attached models for splicing. However, when splicing, the relevant terrain cannot be completely matched, which will be interspersed with the scene, affecting the realism of matching with the environment. Summary of the invention

[0004] The purpose of the present invention is to provide a method, device, equipment and medium for rendering an attachment model in a virtual scene in order to generate an attachment model that can match the target terrain surface in a game construction scene in order to address the deficiencies in the above-mentioned prior art.

[0005] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0006] In a first aspect, an embodiment of the present application provides a method for generating an attachment model in a virtual scene, comprising:

[0007] In response to the scene construction instruction, a game scene screen formed by shooting a game construction scene by a virtual camera is displayed in the graphical user interface, wherein the game construction scene includes a plurality of terrain units;

[0008] Determine a target terrain unit from the game scene along the shooting direction of the virtual camera, and determine a target surface point for attaching the attachment model on the model surface of the target terrain unit;

[0009] Perform surface point diffusion based on the target surface point in the game scene to obtain multiple surface points;

[0010] At the positions of the plurality of surface points in the game construction scene, a plurality of virtual attachment units are respectively generated, and the plurality of virtual attachment units are merged to generate the attachment model.

[0011] In an optional implementation, the determining a target terrain unit from the game construction scene along the shooting direction of the virtual camera, and determining a target surface point for attaching the attachment model on the model surface of the target terrain unit includes:

[0012] Sending a first ray to the game construction scene along the shooting direction of the virtual camera, so as to perform collision detection on the game construction scene by using the first ray;

[0013] If the first ray hits the model surface of the target terrain unit, the target surface point is determined.

[0014] In an optional embodiment, the surface point diffusion is performed based on the target surface point in the game construction scene to obtain a plurality of surface points, including:

[0015] According to the preset radius range and the target surface point, surface point diffusion is performed in the game construction scene with the target surface point as a reference to obtain the plurality of surface points.

[0016] In an optional embodiment, the step of performing surface point diffusion based on the preset radius range and the target surface point and taking the target surface point as a reference in the game construction scene to obtain the plurality of surface points includes:

[0017] According to the preset radius range and the target surface point, determining a plurality of initial surface points within the preset radius range from the game construction scene;

[0018] The multiple initial surface points are filtered to obtain the multiple surface points.

[0019] In an optional embodiment, the determining, from the game construction scene, a plurality of initial surface points within the preset radius range according to the preset radius range and the target surface point comprises:

[0020] Generate a target plane range parallel to a preset reference plane according to the preset radius range and the target surface point;

[0021] Taking a plurality of random points within the target plane as starting points, vertically emitting a plurality of second rays toward the game construction scene, so as to perform collision detection on the game construction scene by using the plurality of second rays;

[0022] The surface points hit by the plurality of second rays in the game construction scene are determined as the plurality of initial surface points.

[0023] In an optional implementation, filtering the multiple initial surface points to obtain the multiple surface points includes:

[0024] Generate a parallel and preset reference plane according to a preset pattern, the preset radius range and the target surface point, and a target surface patch having the preset pattern;

[0025] The plurality of initial surface points are filtered according to the target surface patch to obtain the plurality of surface points.

[0026] In an optional embodiment, the generating of a parallel and preset reference plane according to the preset pattern, the preset radius range and the target surface point, and the target surface patch having the preset pattern includes:

[0027] According to the preset pattern, generating an initial patch having the preset pattern on the target surface point;

[0028] According to the preset radius range, the initial face patch is translated along a direction perpendicular to the preset reference plane to obtain the target face patch.

[0029] In an optional implementation, before filtering the multiple initial surface points according to the target surface to obtain the multiple surface points, the method further includes:

[0030] Adjusting the size of the preset pattern in the target patch;

[0031] The filtering the multiple initial surface points according to the target face to obtain the multiple surface points includes:

[0032] The plurality of initial surface points are filtered according to the target facet after the size adjustment to obtain the plurality of surface points.

[0033] In an optional implementation, before translating the initial facet according to the preset radius range and along a direction perpendicular to the preset reference plane to obtain the target facet, the method further includes:

[0034] Adjusting the size of the initial face sheet;

[0035] The step of translating the initial face patch along a direction perpendicular to the preset reference plane according to the preset radius range to obtain the target face patch includes:

[0036] According to the preset radius range, the initial facet after resizing is translated along a direction perpendicular to the preset reference plane to obtain the target facet.

[0037] In an optional implementation, filtering the multiple initial surface points according to the target surface patch to obtain the multiple surface points includes:

[0038] The plurality of initial surface points are filtered according to the grayscale value of each pixel point corresponding to the preset pattern in the target surface patch to obtain the plurality of surface points.

[0039] In an optional embodiment, the surface point diffusion is performed based on the target surface point in the game construction scene to obtain a plurality of surface points, including:

[0040] The plurality of surface points are obtained from a model surface of the target terrain unit where the target surface point is located.

[0041] In an optional implementation manner, the merging of the multiple virtual attachment units to generate the attachment model includes:

[0042] Invoking a retopology function of a preset digital content software to merge the multiple virtual attachment units to generate an initial attachment model;

[0043] The initial attachment model is rendered according to a preset attachment type map to generate the attachment model.

[0044] In an optional implementation manner, rendering the initial attachment model according to a preset attachment type map to generate the attachment model includes:

[0045] The initial attachment model is rendered according to a texture map of a preset attachment type and a material map of a preset attachment type to generate the attachment model.

[0046] In an optional implementation manner, before rendering the initial attachment model according to a preset attachment type map to generate the attachment model, the method further includes:

[0047] Performing shape adjustment on the initial attachment model;

[0048] The step of rendering the initial attachment model according to the preset attachment type map to generate the attachment model includes:

[0049] The initial attachment model after shape adjustment is rendered according to a preset attachment type map to generate the attachment model.

[0050] In an optional implementation manner, before rendering the initial attachment model according to a preset attachment type map to generate the attachment model, the method further includes:

[0051] Performing face reduction processing on the triangular facets of the initial attached model;

[0052] The step of rendering the initial attachment model according to the preset attachment type map to generate the attachment model comprises:

[0053] The initial attachment model after the surface reduction process is rendered according to the preset attachment type map to generate the attachment model.

[0054] In an optional embodiment, the method further comprises:

[0055] A first insert model is generated on the surface of the attachment model.

[0056] In an optional embodiment, the method further comprises:

[0057] A second insert model is generated at a connection area between the attachment model and the target terrain unit in the game construction scene.

[0058] In a second aspect, an embodiment of the present application further provides an attached model rendering device in a virtual scene, which provides a graphical user interface through a terminal device, and the device includes:

[0059] A display module, configured to respond to a scene construction instruction and display a game scene screen formed by shooting a game construction scene with a virtual camera in the graphical user interface, wherein the game construction scene includes a plurality of terrain units;

[0060] A determination module, used to determine a target terrain unit from the game construction scene along the shooting direction of the virtual camera, and determine a target surface point for attaching the attachment model on the model surface of the target terrain unit;

[0061] The determination module is further used to perform surface point diffusion based on the target surface point in the game construction scene to obtain multiple surface points;

[0062] The generation module is used to generate a plurality of virtual attachment units at the positions of the plurality of surface points in the game construction scene, respectively, and merge the plurality of virtual attachment units to generate the attachment model.

[0063] In the third aspect, an embodiment of the present application also provides a computer device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, and when the computer device is running, the processor communicates with the storage medium through the bus, and the processor executes the program instructions to perform the steps of the attached model rendering method in the virtual scene as described in any one of the first aspects.

[0064] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method for rendering an attached model in a virtual scene as described in any one of the first aspects are executed.

[0065] The beneficial effects of this application are:

[0066] The embodiment of the present application provides a method, device, equipment and medium for rendering an attachment model in a virtual scene, the method comprising: in response to a scene construction instruction, displaying a game scene screen formed by shooting a game construction scene by a virtual camera in a graphical user interface, wherein the game construction scene includes multiple terrain units; determining a target terrain unit from the game construction scene along the shooting direction of the virtual camera, and determining a target surface point for attaching the attachment model on the model surface of the target terrain unit; performing surface point diffusion based on the target surface point in the game construction scene to obtain multiple surface points; generating multiple virtual attachment units at the positions of multiple surface points in the game construction scene, and merging the multiple virtual attachment units to generate an attachment model. The method of the present application generates a target surface point based on the model surface of the target terrain unit and the shooting direction of the virtual camera, thereby determining the reference position of the attachment model to be generated, performing surface point diffusion based on the target surface point as the reference, determining the positions of multiple surface points, further determining the generation range of the attachment model to be generated, and finally generating the attachment model in the game construction scene to achieve matching with the model surface of the target terrain unit, avoiding interlacing with the game construction scene, and increasing the authenticity of matching between the attachment model and the game construction scene. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0068] Figure 1 One of the flow diagrams of a method for rendering an attached model in a virtual scene provided in an embodiment of the present application;

[0069] Figure 2 A second flow chart of a method for rendering an attached model in a virtual scene provided in an embodiment of the present application;

[0070] Figure 3 A schematic diagram of a visual target surface point provided in an embodiment of the present application;

[0071] Figure 4 A third flow chart of a method for rendering an attached model in a virtual scene provided in an embodiment of the present application;

[0072] Figure 5 A fourth flowchart of a method for rendering an attached model in a virtual scene provided in an embodiment of the present application;

[0073] Figure 6 A schematic diagram of multiple initial surface points provided in an embodiment of the present application;

[0074] Figure 7 A fifth flow chart of a method for rendering an attached model in a virtual scene provided in an embodiment of the present application;

[0075] Figure 8 A sixth flow chart of a method for rendering an attached model in a virtual scene provided in an embodiment of the present application;

[0076] Fig. 9 A seventh flowchart of a method for rendering an attached model in a virtual scene provided in an embodiment of the present application;

[0077] Fig.10 A schematic diagram of an initial attachment model provided in an embodiment of the present application;

[0078] Fig.11 A schematic diagram of an initial attachment model UV provided in an embodiment of the present application;

[0079] Fig.12 A schematic diagram of an initial attachment model after surface reduction processing provided in an embodiment of the present application;

[0080] Fig.13 A schematic diagram of a first insert model provided in an embodiment of the present application;

[0081] Fig.14 A schematic diagram of functional modules of an attached model rendering device in a virtual scene provided by an embodiment of the present application;

[0082] Fig.15 A schematic diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0083] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.

[0084] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0085] In the description of the present application, it should be noted that if the terms "upper", "lower", etc. appear, the orientation or position relationship indicated is based on the orientation or position relationship shown in the drawings, or is the orientation or position relationship in which the product of the application is usually placed when used. It is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application.

[0086] In addition, the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0087] It should be noted that, in the absence of conflict, the features in the embodiments of the present application may be combined with each other.

[0088] In order to generate an attachment model that can match the surface of a target terrain unit in a virtual game construction scene, an embodiment of the present application provides an attachment model rendering method in a virtual scene, by determining the target terrain unit from the game construction scene along the shooting direction of a virtual camera, and determining the target surface point for attaching the attachment model on the model surface of the target terrain unit, and then performing surface point diffusion based on the target surface point in the game construction scene to obtain multiple surface points, and generating multiple virtual attachment units at the positions of the multiple surface points in the game construction scene respectively, and merging the multiple virtual attachment units to generate an attachment model, and determining the positions of the multiple surface points according to the model surface of the target terrain unit, so that the generated attachment model can match the model surface of the target terrain unit, avoiding interlacing with the game construction scene, and increasing the realism of the match between the attachment model and the game construction scene.

[0089] The attached model rendering method in the virtual scene provided by the embodiment of the present application is explained in detail below with reference to the accompanying drawings through specific examples. The attached model rendering method in the virtual scene provided by the embodiment of the present application can be implemented by a computer device pre-installed with: an attached model rendering algorithm or detection software, by running the algorithm or software. The computer device can be, for example, a server or a terminal, and the terminal can be a user computer. Figure 1One of the flow diagrams of a method for rendering an attached model in a virtual scene provided in an embodiment of the present application; Figure 1 As shown, the method includes:

[0090] S101. In response to a scene building instruction, a game scene screen formed by shooting a game building scene with a virtual camera is displayed in a graphical user interface.

[0091] Among them, the game construction scene includes multiple terrain units.

[0092] S102: along the shooting direction of the virtual camera, determine a target terrain unit from the game scene, and determine a target surface point for attaching the model on the model surface of the target terrain unit.

[0093] In this embodiment, the scene building instruction indicates to build a virtual game scene in the graphical user interface, so that the game scene screen and multiple terrains formed by the game building scene can be displayed in the graphical user interface. The terrain unit mainly includes various terrain features and interactive mechanisms. For example, the terrain unit can be: plains, forests, deserts, waters, swamps, etc.

[0094] Game scene construction refers to an environment or scene isolated from the real world generated by computer technology. This environment can be completely fictional or a simulation of the real world. Game scene construction requires a large number of three-dimensional models to form a game scene. For the generation of attached models in the game scene, the position of the target surface point of the model surface of the target terrain unit under the current shooting direction is determined along the shooting direction of the virtual camera. The model surface of the target terrain unit can be the ground surface, wall surface, eaves surface, etc. in the game scene. According to the shooting direction of the virtual camera, the target surface point of the attached model is determined from the model surface of the target terrain unit.

[0095] S103, performing surface point diffusion based on the target surface point in the game scene to obtain multiple surface points.

[0096] S104: Generate a plurality of virtual attachment units at the positions of a plurality of surface points in the game construction scene, respectively, and merge the plurality of virtual attachment units to generate an attachment model.

[0097] Specifically, the position of the target surface point can be regarded as a reference position point, and position diffusion is performed based on the position coordinates of the target surface point. Multiple surface points are determined from the model surface of the target terrain unit in the game scene. For example, based on the position of the target surface point, the positions of multiple surface points are determined from the ground surface or the wall surface, and the positions of the multiple surface points are used to determine the range of attachment model generation.

[0098] Then, according to the positions of the multiple surface points, multiple virtual attachment units are generated respectively, and the multiple virtual attachment units are merged to generate an attachment model in the game building scene, wherein the attachment model can be a moss model, a mud model, a magma model, etc., and the display range of the attachment model is related to the positions of the multiple surface points, so as to achieve the generation of the attachment model by rendering on the ground surface or on the wall surface. For example, if the attachment model is a moss model, the moss model is rendered on the ground surface or on the wall surface.

[0099] In summary, the embodiment of the present application provides a method for rendering an attachment model in a virtual scene, including: in response to a scene construction instruction, displaying a game scene screen formed by shooting a game construction scene by a virtual camera in a graphical user interface, wherein the game construction scene includes multiple terrain units; along the shooting direction of the virtual camera, determining the target terrain unit from the game construction scene, and determining the target surface point for attaching the attachment model on the model surface of the target terrain unit; performing surface point diffusion based on the target surface point in the game construction scene to obtain multiple surface points; generating multiple virtual attachment units at the positions of the multiple surface points in the game construction scene, and merging the multiple virtual attachment units to generate an attachment model. The method of the present application generates a target surface point based on the model surface of the target terrain unit and the shooting direction of the virtual camera, thereby determining the reference position of the attachment model to be generated, performing surface point diffusion based on the target surface point as the reference, determining the positions of the multiple surface points, further determining the generation range of the attachment model to be generated, and finally generating the attachment model in the game construction scene to achieve matching with the model surface of the target terrain unit, avoiding interlacing with the game construction scene, and increasing the authenticity of the matching between the attachment model and the game construction scene.

[0100] Based on the method for rendering an attached model in a virtual scene provided in the above embodiment, the embodiment of the present application provides another possible implementation of the method for rendering an attached model in a virtual scene by determining the position of a target surface point. Figure 2 The second flowchart of a method for rendering an attached model in a virtual scene provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, along the shooting direction of the virtual camera, a target terrain unit is determined from the game scene, and a target surface point for attaching the attachment model is determined on the model surface of the target terrain unit, including:

[0101] S201. Send a first ray to a game construction scene along a shooting direction of a virtual camera, so as to perform collision detection on the game construction scene by using the first ray.

[0102] S202: If the first ray hits the model surface of the target terrain unit, determine the target surface point.

[0103] In this embodiment, the position of the virtual camera in the game construction scene and the shooting direction of the virtual camera are first determined, and starting from the position of the virtual camera, a first ray is emitted toward the game construction scene along the shooting direction of the virtual camera, and a collision detection is performed on the game construction scene. If it is detected that the first ray hits the model surface of the target terrain unit, the coordinates of the hitting point are recorded as the position coordinates of the target surface point.

[0104] Among them, the first ray is recorded as K, and the first ray K is expressed as: K=P1+V1*X, wherein P1 represents the position of the virtual camera, V1 represents the shooting direction of the virtual camera, and X represents the distance of the first ray. When it is detected that the first ray collides with the model surface of the target terrain unit in the game construction scene, the coordinates of the hitting point, that is, the coordinates of the target position point, are recorded to obtain the target surface point P.

[0105] It should be noted that if the first ray hits the ground in the game scene, the model surface of the target terrain unit is the ground; if the first ray hits the wall in the game scene, the model surface of the target terrain unit is the wall. There is no restriction on the model surface of the target terrain unit.

[0106] In the method provided in this embodiment, a first ray is emitted to the game construction scene along the shooting direction of the virtual camera, so as to perform collision detection on the game construction scene using the first ray, and if the first ray hits the model surface of the target terrain unit, the target surface point is determined. By emitting the first ray to the game construction scene, the point where the first ray hits the model surface of the target terrain unit is used as the target surface point, so as to use the target surface point as a reference to determine the generation range of the attached model.

[0107] Optionally, the embodiment of the present application provides another possible implementation of the attached model rendering method in a virtual scene by determining multiple surface points. Figure 3 A schematic diagram of a visualized target surface point provided in an embodiment of the present application. Surface point diffusion is performed based on the target surface point in the game scene to obtain multiple surface points, including:

[0108] According to the preset radius range and the target surface point, surface point diffusion is performed based on the target surface point in the game scene to obtain multiple surface points.

[0109] In this embodiment, a visual spherical model is generated at the location of the target surface point, such as Figure 3 As shown, the position of the target surface point is Figure 3 The positions of the small and medium ball markers are located on the surface of the wall. The positions of the target surface points are visualized to obtain a ball model with the position of the target surface point as the sphere center. The size of the preset radius range is determined according to the radius r of the ball model.

[0110] According to the radius r of the ball model, the surface point diffusion is performed based on the position of the target surface point to obtain a preset radius range, and then the positions of multiple surface points within the preset radius range are determined from the game construction scene.

[0111] Optionally, an embodiment of the present application further provides another possible implementation of a method for rendering an attached model in a virtual scene. Figure 4 A third flow chart of a method for rendering an attached model in a virtual scene provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, according to the preset radius range and the target surface point, the surface point diffusion is performed based on the target surface point in the game scene to obtain multiple surface points, including:

[0112] S301. According to a preset radius range and a target surface point, a plurality of initial surface points within a preset radius range are determined from a game construction scene.

[0113] S302: Filter multiple initial surface points to obtain multiple surface points.

[0114] In this embodiment, after a plurality of initial surface points within a preset radius range are determined from the game construction scene according to the preset radius range and the target surface point, the plurality of initial surface points can be further screened. For example, by using a preset position coordinate range, if there is an initial surface point whose position coordinate is not within the preset position coordinate range, the initial surface point is filtered out; or, by using a preset number of surface points, if the number of the plurality of initial surface points is greater than the number of the preset surface points, the initial surface points are randomly filtered out so that the number of the filtered initial surfaces is less than the number of the preset surface points.

[0115] By filtering a plurality of initial surface points, a plurality of surface points are obtained, and the shape customization of the attached model is realized.

[0116] Optionally, based on the above embodiment, the embodiment of the present application further provides another possible implementation of the attached model rendering method in the virtual scene by determining multiple initial surface points. Figure 5 A fourth flowchart of a method for rendering an attached model in a virtual scene provided in an embodiment of the present application is provided. Figure 6 A schematic diagram of multiple initial surface points provided in an embodiment of the present application. Figure 5 As shown, according to the preset radius range and the target surface point, multiple initial surface points within the preset radius range are determined from the game construction scene, including:

[0117] S401: Generate a target plane range parallel to a preset reference plane according to a preset radius range and a target surface point.

[0118] In this embodiment, if the position of the target surface point is expressed as P(x, y, z), wherein the x-axis is the horizontal direction in the game construction scene, the y-axis is the front-to-back direction in the game construction scene, and the z-axis is the vertical direction in the game construction scene, and the preset reference plane is the plane perpendicular to the z-axis, then the position of the target surface point is moved vertically upward along the z-axis direction by a preset radius range, i.e., the radius r of the ball model, to obtain the center position of the target plane range, and the coordinates of the center position are expressed as P(x, y, z+r), and then the target plane range is constructed with the center position as the center and the preset radius range as the radius, as shown in FIG. Figure 6 shown.

[0119] S402: Taking multiple random points within the target plane as starting points, vertically emitting multiple second rays toward the game construction scene, so as to perform collision detection on the game construction scene using the multiple second rays.

[0120] S403: Determine the surface points hit by the multiple second rays in the game construction scene as multiple initial surface points.

[0121] Specifically, the coordinates of multiple random points T within the target plane satisfy the following coordinate range:

[0122] P(xr,yr,z+r) <T(x,y,z)<P(x+r,y+r,z+r)

[0123] Then, starting from the coordinates of the multiple random points, multiple second rays are emitted vertically downward in a loop, and the surface points hit by the multiple second rays in the game scene are determined as the positions of the multiple initial surface points. The multiple second rays can hit the ground surface or the wall surface. The positions of the generated multiple initial surface points are related to the topography of the model surface of the target terrain unit. The multiple initial surface points can be recorded as T1, T2, T3, ..., Tn.

[0124] In the method provided in this embodiment, a target plane range parallel to a preset reference plane is generated according to a preset radius range and a target surface point, and multiple random points within the target plane range are used as starting points to emit multiple second rays vertically to the game construction scene, so as to perform collision detection on the game construction scene using multiple second rays, and determine the surface points hit by multiple second rays in the game construction scene as the positions of multiple initial surface points. By determining multiple initial surface points, the generation range of the attached model can be further determined.

[0125] The embodiment of the present application also provides another possible implementation of the attached model rendering method in the virtual scene by filtering multiple initial surface points. Figure 7 A fifth flow chart of a method for rendering an attached model in a virtual scene provided in an embodiment of the present application is shown in FIG. Figure 7As shown, multiple initial surface points are filtered to obtain multiple surface points, including:

[0126] S501, generating a target surface patch parallel to a preset reference plane and having a preset pattern according to a preset pattern, a preset radius range and a target surface point.

[0127] S502: Filter multiple initial surface points according to the target face to obtain multiple surface points.

[0128] In this embodiment, the preset pattern may be a black and white pattern, which is used to filter a plurality of initial surface points and determine the shape of the attached model.

[0129] According to the preset pattern, the preset radius range and the target surface point, a parallel and preset reference plane is generated, and a target surface patch with the preset pattern is generated, wherein the target surface patch includes a black and white pattern.

[0130] Optionally, the plurality of initial surface points are filtered according to the grayscale value of each pixel point corresponding to a preset pattern in the target patch to obtain the plurality of surface points.

[0131] Specifically, taking multiple random points in the target patch as starting points, multiple second rays are emitted vertically toward the game scene. However, when emitting multiple second rays, it is necessary to determine whether each random point emits a second ray based on the grayscale value of each pixel corresponding to a preset pattern.

[0132] For example, if the grayscale value of the color pixel corresponding to the preset pattern in the target patch T(x, y, z) is less than the preset grayscale threshold, the second ray is not emitted, which can be expressed by the following formula:

[0133] C T(x,y,z) <C?0:1

[0134] Among them, C T(x,y,z) It is represented as the color grayscale value of each pixel of the target patch T(x, y, z), and C is represented as a preset grayscale threshold, so that multiple initial surface points are filtered according to the preset grayscale threshold to obtain multiple surface points, thereby realizing customization of the positions of multiple surface points and customization of the attached model.

[0135] Optionally, before step S502, the method further includes:

[0136] Adjust the size of the preset pattern in the target patch.

[0137] Specifically, the size of the preset pattern in the target surface is adjusted so that the size of the preset pattern is within a preset radius. For example, if the size of the preset pattern in the target surface is larger than the preset radius, the size of the preset pattern is reduced and adjusted so that the size of the preset pattern is within the preset radius.

[0138] According to the resized target patch, a plurality of initial surface points are filtered to obtain a plurality of surface points.

[0139] Specifically, according to the grayscale value of each pixel corresponding to the preset pattern in the target patch after the size adjustment, the multiple initial surface points are filtered to obtain the multiple surface points.

[0140] In the method provided in the embodiment of the present application, a parallel and preset reference plane is generated according to a preset pattern, a preset radius range and a target surface point, and then a plurality of initial surface points are filtered according to the target surface to obtain a plurality of surface points. The plurality of initial surface points are filtered according to the preset pattern to achieve customization of the plurality of surface points, thereby adjusting the generated shape of the attached model.

[0141] Optionally, the embodiment of the present application also provides another possible implementation of the attached model rendering method in the virtual scene by generating a target patch. Figure 8 A sixth flow chart of a method for rendering an attached model in a virtual scene provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, according to the preset pattern, the preset radius range and the target surface point, a parallel and preset reference plane is generated, and the target patch with the preset pattern includes:

[0142] S601 . Generate an initial patch with a preset pattern on a target surface point according to a preset pattern.

[0143] S602: According to a preset radius range, the initial face patch is translated along a direction perpendicular to a preset reference plane to obtain a target face patch.

[0144] In this embodiment, an initial facet perpendicular to a preset reference plane is generated with the position of the target surface point as the center, and then the initial facet is moved upward by a value corresponding to the preset radius range along a direction perpendicular to the preset reference plane according to a preset radius range to obtain a target facet, and the coordinates of the target facet are also P(x, y, z+r).

[0145] Optionally, before step S602, the method further includes:

[0146] Adjust the size of the initial patch.

[0147] Specifically, according to the rendering requirements of the attached model in the virtual scene, the size of the initial face patch can be adjusted to obtain the initial face patch after the size adjustment.

[0148] Then, according to the preset radius range, the resized initial patch is translated along a direction perpendicular to the preset reference plane to obtain a target patch.

[0149] In the method provided in the embodiment of the present application, an initial patch with a preset pattern is generated on the target surface point according to a preset pattern, and then the initial patch is translated along a direction perpendicular to a preset reference plane according to a preset radius range to obtain a target patch. The method is used to filter multiple initial surface points according to the preset pattern in the target patch to achieve shape customization of the attached model.

[0150] Optionally, the embodiment of the present application also provides another possible implementation of the method for rendering an attached model in a virtual scene by determining multiple surface points. Surface point diffusion is performed based on the target surface point in the game construction scene to obtain multiple surface points, including:

[0151] Get a number of surface points from the model surface of a target terrain unit where the target surface points are located.

[0152] In this embodiment, if there is a target model of the target terrain unit in the game construction scene, and the target surface point is on the surface of the target model of the target terrain unit, all points on the surface of the target model are determined to be multiple surface points, and the generation range of the attached model is determined.

[0153] The embodiment of the present application also provides another possible implementation of the method for rendering an attachment model in a virtual scene by generating an attachment model. Fig. 9 FIG7 is a flow chart of a method for rendering an attached model in a virtual scene provided in an embodiment of the present application. Fig.10 A schematic diagram of an initial attachment model provided in an embodiment of the present application, Fig.11 A schematic diagram of an initial attachment model UV provided in an embodiment of the present application, Fig.12 A schematic diagram of an initial attachment model after surface reduction processing provided in an embodiment of the present application, such as Fig. 9 As shown, multiple virtual attachment units are merged to generate an attachment model, including:

[0154] S701: Calling a retopology function of a preset digital content software to merge multiple virtual attachment units to generate an initial attachment model.

[0155] In this embodiment, virtual attachment units of the same size are generated at the positions of multiple surface points in the game construction scene. The size of the virtual attachment unit can be adjusted. For example, if the attachment model is a moss model, the size of the virtual attachment unit also determines the thickness of the moss when the moss model is generated.

[0156] Specifically, the retopology function Compact Mesh of the preset digital content creation software (DCC) is called to perform a model Boolean operation on multiple virtual attachment units, and then the overlapping surfaces of the multiple virtual attachment units are removed to form a combined model with only different parts of the combined surfaces of the multiple virtual attachment units, that is, the multiple virtual attachment units are merged to generate an initial attachment model, such as Fig.10 As shown, Fig.10 The PCG in the text stands for Production Code Generation, which is displayed as an identifier in the schematic diagram provided by the preset digital content software and has no impact on the content of this solution.

[0157] S702: Rendering the initial attachment model according to a preset attachment type map to generate an attachment model.

[0158] Specifically, the following schematic diagram takes the attachment model as a moss model as an example, the preset attachment type map is a preset moss map, and the initial attachment model is processed using the preset digital content software to obtain the initial attachment model UV, such as Fig.11 As shown, the preset moss map is then assigned to the initial attached model UV to generate the attached model.

[0159] Model UV is a concept in computer graphics that describes the two-dimensional texture coordinate system obtained after the three-dimensional model surface is unfolded. By mapping the texture map to the UV coordinate system of the model surface, the texture map and color of the model surface can be controlled, thereby achieving a more realistic rendering effect. Model UV is usually composed of the vertex coordinates and texture coordinates of the triangular patch, which can be automatically generated or manually edited.

[0160] Optionally, the initial attachment model is rendered according to a texture map of a preset attachment type and a material map of a preset attachment type to generate an attachment model.

[0161] Specifically, a texture map of a preset attachment type and a material map of a preset attachment type are assigned to the initial attachment model UV to generate an attachment model, so that the surface of the attachment model has a texture of the preset attachment type and a material of the preset attachment type.

[0162] Optionally, before step S702, the method further includes:

[0163] Make shape adjustments to the initially attached model.

[0164] According to the preset attachment type map, the initial attachment model after shape adjustment is rendered to generate the attachment model.

[0165] Specifically, the shape of the initial attachment model is adjusted so that the shape of the initial attachment model is within a preset radius, and then the shape-adjusted initial attachment model is rendered according to a preset attachment type map to generate the attachment model.

[0166] Optionally, before step S702, the method further includes:

[0167] Perform face reduction processing on the triangular facets of the initial attached model;

[0168] According to the preset attachment type map, the initial attachment model after the surface reduction process is rendered to generate the attachment model.

[0169] Specifically, the initial attachment model is subjected to surface reduction processing using a preset virtual engine to obtain the initial attachment model after surface reduction processing, such as Fig.12 As shown, the initial attachment model after the surface reduction process is rendered according to the preset attachment type map to generate the attachment model.

[0170] In the method provided in the embodiment of the present application, the retopology function of the preset digital content software is called to merge multiple virtual attachment units to generate an initial attachment model; the initial attachment model is rendered according to the preset attachment type map to generate an attachment model, thereby obtaining an attachment model with a customized shape that matches the surface.

[0171] The embodiment of the present application also provides another possible implementation of the method for rendering an attached model in a virtual scene by generating a first insert model. Fig.13 A schematic diagram of a first insert model provided in an embodiment of the present application, wherein the method further includes:

[0172] Generate a first insert model on the surface of the attached model.

[0173] In this embodiment, a surface extraction operation is performed on the attached model in a direction perpendicular to the preset reference plane. For example, a surface extraction operation is performed on the attached model in the z-axis direction to determine the model surface on which the first insert needs to be generated. The determination formula is as follows:

[0174]

[0175] Among them, M (z) Expressed as the z-axis coordinate on each model surface, It represents the threshold value on the z-axis, thereby determining the model surface for generating the first insert model.

[0176] It should be noted that the present invention is also applicable to the model surface in the x-axis or y-axis direction, and the first insert model in the x-axis or y-axis direction can be generated, such as Fig.13 As shown, the first insert model can be a fluffy grass model.

[0177] The embodiment of the present application also provides another possible implementation of the method for rendering an attached model in a virtual scene by generating a second insert model. The method also includes:

[0178] A second insert model is generated at the connection area between the attached model and the target terrain unit in the game construction scene.

[0179] In this embodiment, there is a gap in the connection area between the attached model and the target terrain unit in the game construction scene. Therefore, decals can be added to the connection area between the attached model and the target terrain unit by using the decal function in the preset digital content software to be used as occlusion adjustment for the seam.

[0180] Among them, the decal function is used to add additional two-dimensional images or textures to the surface of the game scene to enhance visual details and realism. Decals can be used to simulate graffiti on the wall, cracks on the ground, mud stains on vehicles or scars on characters, etc. There is no need to redraw or modify the original three-dimensional virtual model, which greatly saves resources and development time, while increasing the diversity and richness of attached models and target terrain units.

[0181] Then, a color grayscale recognition method can be used to generate a second insert model at the location of the decal, or the second insert model can be directly added by manual placement, and the details can be further adjusted and optimized on the attached model, wherein the second insert model can also be a fluffy grass model.

[0182] The following is a corresponding explanation of the attached model rendering device and computer equipment in the virtual scene provided by any of the above embodiments of the present application. The specific implementation process and the technical effects produced are the same as those of the corresponding method embodiments mentioned above. For the sake of brief description, the parts not mentioned in this embodiment can refer to the corresponding contents in the method embodiments.

[0183] Fig.14 This is a functional module diagram of an attached model rendering device in a virtual scene provided by an embodiment of the present application. Fig.14 As shown, a graphical user interface is provided by a terminal device, and the attached model rendering device 100 in the virtual scene includes:

[0184] The display module 110 is used to respond to the scene construction instruction and display the game scene screen formed by shooting the game construction scene by a virtual camera in the graphical user interface, wherein the game construction scene includes a plurality of terrain units;

[0185] A determination module 120 is used to determine a target terrain unit from the game scene along the shooting direction of the virtual camera, and determine a target surface point for attaching the attachment model on the model surface of the target terrain unit;

[0186] The determination module 120 is further used to perform surface point diffusion based on the target surface point in the game construction scene to obtain multiple surface points;

[0187] The generation module 130 is used to generate a plurality of virtual attachment units at the positions of a plurality of surface points in the game construction scene, respectively, and merge the plurality of virtual attachment units to generate an attachment model.

[0188] Optionally, the determination module 120 is further used to send a first ray to the game construction scene along the shooting direction of the virtual camera, so as to use the first ray to perform collision detection on the game construction scene; if the first ray hits the model surface of the target terrain unit, the target surface point is determined.

[0189] Optionally, the determination module 120 is further configured to perform surface point diffusion based on a preset radius range and a target surface point and take the target surface point as a reference in the game construction scene to obtain a plurality of surface points.

[0190] Optionally, the device also includes a filtering module.

[0191] The determination module 120 is further used to determine a plurality of initial surface points within a preset radius range from the game construction scene according to the preset radius range and the target surface point;

[0192] The filtering module is used to filter the multiple initial surface points to obtain multiple surface points.

[0193] Optionally, the determination module 120 is further used to generate a target plane range parallel to a preset reference plane according to a preset radius range and a target surface point; to emit a plurality of second rays vertically to the game construction scene with a plurality of random points within the target plane range as starting points, so as to perform collision detection on the game construction scene using the plurality of second rays; and to determine the surface points hit by the plurality of second rays in the game construction scene as a plurality of initial surface points.

[0194] Optionally, the generating module 130 is further used to generate a parallel and preset reference plane according to a preset pattern, a preset radius range and a target surface point, and a target surface patch having a preset pattern;

[0195] The filtering module is also used to filter the multiple initial surface points according to the target surface to obtain multiple surface points.

[0196] Optionally, the generation module 130 is further used to generate an initial patch with a preset pattern on the target surface point according to the preset pattern; and translate the initial patch along a direction perpendicular to a preset reference plane according to a preset radius range to obtain a target patch.

[0197] Optionally, the device further includes: an adjustment module.

[0198] An adjustment module, used for adjusting the size of a preset pattern in a target patch;

[0199] The filtering module is used to filter the multiple initial surface points according to the target face after the size adjustment to obtain multiple surface points.

[0200] Optionally, the adjustment module is further used to adjust the size of the initial face patch; according to a preset radius range, the initial face patch after the size adjustment is translated along a direction perpendicular to a preset reference plane to obtain a target face patch.

[0201] Optionally, the filtering module is further used to filter the multiple initial surface points according to the grayscale value of each pixel point corresponding to the preset pattern in the target surface patch to obtain multiple surface points.

[0202] Optionally, the determination module 120 is further configured to obtain a plurality of surface points from the model surface of the target terrain unit where the target surface point is located.

[0203] Optionally, the generation module 130 is further used to call the retopology function of the preset digital content software to merge multiple virtual attachment units to generate an initial attachment model; render the initial attachment model according to the preset attachment type map to generate the attachment model.

[0204] Optionally, the generating module 130 is further configured to render the initial attachment model according to a texture map of a preset attachment type and a material map of a preset attachment type to generate the attachment model.

[0205] Optionally, the adjustment module is further used to adjust the shape of the initial attachment model;

[0206] The generating module 130 is further used to render the initial attachment model after shape adjustment according to a preset attachment type map to generate an attachment model.

[0207] Optionally, the device further includes: a processing module.

[0208] A processing module, used for performing face reduction processing on the triangular facets of the initial attached model;

[0209] The generation module 130 is further used to render the initial attachment model after the surface reduction process according to the preset attachment type map to generate the attachment model.

[0210] Optionally, the generating module 130 is further configured to generate a first insert model on the surface of the attached model.

[0211] Optionally, the generating module 130 is further configured to generate a second insert model at a connection area between the attached model and the target terrain unit in the game construction scene.

[0212] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0213] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASICs), or one or more microprocessors, or one or more field programmable gate arrays (FPGAs). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0214] Fig.15 This is a schematic diagram of a computer device provided in an embodiment of the present application, which can be used for rendering attached models in a virtual scene. Fig.15 As shown, the computer device 200 includes: a processor 210 , a storage medium 220 , and a bus 230 .

[0215] The storage medium 220 stores machine-readable instructions executable by the processor 210. When the computer device is running, the processor 210 communicates with the storage medium 220 via the bus 230, and the processor 210 executes the machine-readable instructions. The execution method includes:

[0216] In response to a scene building instruction, a game scene screen formed by shooting a game building scene with a virtual camera is displayed in a graphical user interface, wherein the game building scene includes a plurality of terrain units; along the shooting direction of the virtual camera, a target terrain unit is determined from the game building scene, and a target surface point for attaching an attachment model is determined on the model surface of the target terrain unit; surface point diffusion is performed from the game building scene based on the target surface point to obtain a plurality of surface points; at the positions of the plurality of surface points in the game building scene, a plurality of virtual attachment units are respectively generated, and the plurality of virtual attachment units are merged to generate an attachment model.

[0217] Optionally, along the shooting direction of the virtual camera, a target terrain unit is determined from the game scene, and a target surface point for attaching the attachment model is determined on the model surface of the target terrain unit, including:

[0218] The shooting direction of the virtual camera sends a first ray to the game scene, so as to use the first ray to perform collision detection on the game scene; if the first ray hits the model surface of the target terrain unit, the target surface point is determined.

[0219] Optionally, surface point diffusion is performed based on the target surface point in the game scene to obtain multiple surface points, including:

[0220] According to the preset radius range and the target surface point, surface point diffusion is performed based on the target surface point in the game scene to obtain multiple surface points.

[0221] Optionally, according to the preset radius range and the target surface point, surface point diffusion is performed based on the target surface point in the game scene to obtain multiple surface points, including:

[0222] According to the preset radius range and the target surface point, multiple initial surface points within the preset radius range are determined from the game construction scene; the multiple initial surface points are filtered to obtain multiple surface points.

[0223] Optionally, according to the preset radius range and the target surface point, a plurality of initial surface points within the preset radius range are determined from the game construction scene, including:

[0224] According to the preset radius range and the target surface point, a target plane range parallel to the preset reference plane is generated; taking multiple random points within the target plane range as starting points, multiple second rays are vertically emitted to the game construction scene, so as to perform collision detection on the game construction scene using the multiple second rays; and the surface points hit by the multiple second rays in the game construction scene are determined as multiple initial surface points.

[0225] Optionally, the multiple initial surface points are filtered to obtain multiple surface points, including:

[0226] According to the preset pattern, the preset radius range and the target surface point, a parallel and preset reference plane is generated, and a target surface patch with the preset pattern is generated; according to the target surface patch, a plurality of initial surface points are filtered to obtain a plurality of surface points.

[0227] Optionally, a parallel and preset reference plane is generated according to a preset pattern, a preset radius range and a target surface point, and a target patch having a preset pattern includes:

[0228] According to the preset pattern, an initial patch with the preset pattern is generated on the target surface point; according to the preset radius range, the initial patch is translated along a direction perpendicular to the preset reference plane to obtain the target patch.

[0229] Optionally, before filtering the multiple initial surface points according to the target face to obtain the multiple surface points, the method further includes:

[0230] Adjust the size of the preset pattern in the target patch;

[0231] According to the target patch, multiple initial surface points are filtered to obtain multiple surface points, including:

[0232] According to the resized target patch, a plurality of initial surface points are filtered to obtain a plurality of surface points.

[0233] Optionally, before translating the initial face patch according to a preset radius range and in a direction perpendicular to a preset reference plane to obtain a target face patch, the method further includes:

[0234] Adjust the size of the initial patch;

[0235] According to the preset radius range, the initial patch is translated along the direction perpendicular to the preset reference plane to obtain the target patch, including:

[0236] According to the preset radius range, the initial facet after resizing is translated along a direction perpendicular to the preset reference plane to obtain a target facet.

[0237] Optionally, multiple initial surface points are filtered according to the target patch to obtain multiple surface points, including:

[0238] According to the grayscale value of each pixel point corresponding to the preset pattern in the target patch, multiple initial surface points are filtered to obtain multiple surface points.

[0239] Optionally, surface point diffusion is performed based on the target surface point in the game scene to obtain multiple surface points, including:

[0240] Get a number of surface points from the model surface of a target terrain unit where the target surface points are located.

[0241] Optionally, multiple virtual attachment units are merged to generate an attachment model, including:

[0242] The retopology function of the preset digital content software is called to merge multiple virtual attachment units to generate an initial attachment model; the initial attachment model is rendered according to the preset attachment type map to generate an attachment model.

[0243] Optionally, the initial attachment model is rendered according to a preset attachment type map to generate an attachment model, including:

[0244] The initial attachment model is rendered according to the texture map of the preset attachment type and the material map of the preset attachment type to generate the attachment model.

[0245] Optionally, before rendering the initial attachment model according to a preset attachment type map and generating the attachment model, the method further includes:

[0246] Perform shape adjustments on the initial attachment model;

[0247] According to the preset attachment type map, the initial attachment model is rendered to generate the attachment model, including:

[0248] According to the preset attachment type map, the initial attachment model after shape adjustment is rendered to generate the attachment model.

[0249] Optionally, before rendering the initial attachment model according to a preset attachment type map and generating the attachment model, the method further includes:

[0250] Perform face reduction processing on the triangular facets of the initial attached model;

[0251] According to the preset attachment type map, the initial attachment model is rendered to generate the attachment model, including;

[0252] According to the preset attachment type map, the initial attachment model after the surface reduction process is rendered to generate the attachment model.

[0253] Optionally, the method further comprises:

[0254] Generate a first insert model on the surface of the attached model.

[0255] Optionally, the method further comprises:

[0256] A second insert model is generated at the connection area between the attached model and the target terrain unit in the game construction scene.

[0257] Optionally, the present application further provides a storage medium 220 on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method embodiment are executed.

[0258] When the program is executed by the processor, the execution method may include:

[0259] In response to a scene building instruction, a game scene screen formed by shooting a game building scene with a virtual camera is displayed in a graphical user interface, wherein the game building scene includes a plurality of terrain units; along the shooting direction of the virtual camera, a target terrain unit is determined from the game building scene, and a target surface point for attaching an attachment model is determined on the model surface of the target terrain unit; surface point diffusion is performed from the game building scene based on the target surface point to obtain a plurality of surface points; at the positions of the plurality of surface points in the game building scene, a plurality of virtual attachment units are respectively generated, and the plurality of virtual attachment units are merged to generate an attachment model.

[0260] Optionally, along the shooting direction of the virtual camera, a target terrain unit is determined from the game scene, and a target surface point for attaching the attachment model is determined on the model surface of the target terrain unit, including:

[0261] The shooting direction of the virtual camera sends a first ray to the game scene, so as to use the first ray to perform collision detection on the game scene; if the first ray hits the model surface of the target terrain unit, the target surface point is determined.

[0262] Optionally, surface point diffusion is performed based on the target surface point in the game scene to obtain multiple surface points, including:

[0263] According to the preset radius range and the target surface point, surface point diffusion is performed based on the target surface point in the game scene to obtain multiple surface points.

[0264] Optionally, according to the preset radius range and the target surface point, surface point diffusion is performed based on the target surface point in the game scene to obtain multiple surface points, including:

[0265] According to the preset radius range and the target surface point, multiple initial surface points within the preset radius range are determined from the game construction scene; the multiple initial surface points are filtered to obtain multiple surface points.

[0266] Optionally, according to the preset radius range and the target surface point, a plurality of initial surface points within the preset radius range are determined from the game construction scene, including:

[0267] According to the preset radius range and the target surface point, a target plane range parallel to the preset reference plane is generated; taking multiple random points within the target plane range as starting points, multiple second rays are vertically emitted to the game construction scene, so as to perform collision detection on the game construction scene using the multiple second rays; and the surface points hit by the multiple second rays in the game construction scene are determined as multiple initial surface points.

[0268] Optionally, the multiple initial surface points are filtered to obtain multiple surface points, including:

[0269] According to the preset pattern, the preset radius range and the target surface point, a parallel and preset reference plane is generated, and a target surface patch with the preset pattern is generated; according to the target surface patch, a plurality of initial surface points are filtered to obtain a plurality of surface points.

[0270] Optionally, a parallel and preset reference plane is generated according to a preset pattern, a preset radius range and a target surface point, and a target patch having a preset pattern includes:

[0271] According to the preset pattern, an initial patch with the preset pattern is generated on the target surface point; according to the preset radius range, the initial patch is translated along a direction perpendicular to the preset reference plane to obtain the target patch.

[0272] Optionally, before filtering the multiple initial surface points according to the target face to obtain the multiple surface points, the method further includes:

[0273] Adjust the size of the preset pattern in the target patch;

[0274] According to the target patch, multiple initial surface points are filtered to obtain multiple surface points, including:

[0275] According to the resized target patch, a plurality of initial surface points are filtered to obtain a plurality of surface points.

[0276] Optionally, before translating the initial face patch according to a preset radius range and in a direction perpendicular to a preset reference plane to obtain a target face patch, the method further includes:

[0277] Adjust the size of the initial patch;

[0278] According to the preset radius range, the initial patch is translated along the direction perpendicular to the preset reference plane to obtain the target patch, including:

[0279] According to the preset radius range, the initial facet after resizing is translated along a direction perpendicular to the preset reference plane to obtain a target facet.

[0280] Optionally, multiple initial surface points are filtered according to the target patch to obtain multiple surface points, including:

[0281] According to the grayscale value of each pixel point corresponding to the preset pattern in the target patch, multiple initial surface points are filtered to obtain multiple surface points.

[0282] Optionally, surface point diffusion is performed based on the target surface point in the game scene to obtain multiple surface points, including:

[0283] Get a number of surface points from the model surface of a target terrain unit where the target surface points are located.

[0284] Optionally, multiple virtual attachment units are merged to generate an attachment model, including:

[0285] The retopology function of the preset digital content software is called to merge multiple virtual attachment units to generate an initial attachment model; the initial attachment model is rendered according to the preset attachment type map to generate an attachment model.

[0286] Optionally, the initial attachment model is rendered according to a preset attachment type map to generate an attachment model, including:

[0287] The initial attachment model is rendered according to the texture map of the preset attachment type and the material map of the preset attachment type to generate the attachment model.

[0288] Optionally, before rendering the initial attachment model according to a preset attachment type map and generating the attachment model, the method further includes:

[0289] Perform shape adjustments on the initial attachment model;

[0290] According to the preset attachment type map, the initial attachment model is rendered to generate the attachment model, including:

[0291] According to the preset attachment type map, the initial attachment model after shape adjustment is rendered to generate the attachment model.

[0292] Optionally, before rendering the initial attachment model according to a preset attachment type map and generating the attachment model, the method further includes:

[0293] Perform face reduction processing on the triangular facets of the initial attached model;

[0294] According to the preset attachment type map, the initial attachment model is rendered to generate the attachment model, including;

[0295] According to the preset attachment type map, the initial attachment model after the surface reduction process is rendered to generate the attachment model.

[0296] Optionally, the method further comprises:

[0297] Generate a first insert model on the surface of the attached model.

[0298] Optionally, the method further comprises:

[0299] A second insert model is generated at the connection area between the attached model and the target terrain unit in the game construction scene.

[0300] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0301] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0302] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0303] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

[0304] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for rendering an attached model in a virtual scene, characterized in that: Providing a graphical user interface through a terminal device, the method comprising: In response to the scene construction instruction, a game scene screen formed by shooting a game construction scene by a virtual camera is displayed in the graphical user interface, wherein the game construction scene includes a plurality of terrain units; Determine a target terrain unit from the game scene along the shooting direction of the virtual camera, and determine a target surface point for attaching the attachment model on the model surface of the target terrain unit; Perform surface point diffusion based on the target surface point in the game scene to obtain multiple surface points; At the positions of the plurality of surface points in the game construction scene, a plurality of virtual attachment units are respectively generated, and the plurality of virtual attachment units are merged to generate the attachment model.

2. The method according to claim 1, characterized in that: The step of determining a target terrain unit from the game scene along the shooting direction of the virtual camera, and determining a target surface point for attaching the attachment model on the model surface of the target terrain unit includes: Sending a first ray to the game construction scene along the shooting direction of the virtual camera, so as to perform collision detection on the game construction scene by using the first ray; If the first ray hits the model surface of the target terrain unit, the target surface point is determined.

3. The method according to claim 1, characterized in that The step of performing surface point diffusion based on the target surface point in the game scene to obtain a plurality of surface points includes: According to the preset radius range and the target surface point, surface point diffusion is performed in the game construction scene with the target surface point as a reference to obtain the plurality of surface points.

4. The method according to claim 3, characterized in that The step of performing surface point diffusion based on the preset radius range and the target surface point and taking the target surface point as a reference in the game construction scene to obtain the plurality of surface points includes: According to the preset radius range and the target surface point, determining a plurality of initial surface points within the preset radius range from the game construction scene; The multiple initial surface points are filtered to obtain the multiple surface points.

5. The method according to claim 4, characterized in that The step of determining a plurality of initial surface points within the preset radius range from the game construction scene according to the preset radius range and the target surface point comprises: Generate a target plane range parallel to a preset reference plane according to the preset radius range and the target surface point; Taking a plurality of random points within the target plane as starting points, vertically emitting a plurality of second rays toward the game construction scene, so as to perform collision detection on the game construction scene by using the plurality of second rays; The surface points hit by the plurality of second rays in the game construction scene are determined to be the plurality of initial surface points.

6. The method according to claim 4, characterized in that The filtering of the plurality of initial surface points to obtain the plurality of surface points comprises: Generate a parallel and preset reference plane according to a preset pattern, the preset radius range and the target surface point, and a target surface patch having the preset pattern; The plurality of initial surface points are filtered according to the target surface patch to obtain the plurality of surface points.

7. The method according to claim 6, characterized in that The method of generating a parallel and preset reference plane according to the preset pattern, the preset radius range and the target surface point, and the target surface patch having the preset pattern includes: According to the preset pattern, generating an initial patch having the preset pattern on the target surface point; According to the preset radius range, the initial face patch is translated along a direction perpendicular to the preset reference plane to obtain the target face patch.

8. The method according to claim 6, characterized in that Before filtering the plurality of initial surface points according to the target surface to obtain the plurality of surface points, the method further includes: Adjusting the size of the preset pattern in the target patch; The filtering the multiple initial surface points according to the target face to obtain the multiple surface points includes: The plurality of initial surface points are filtered according to the target facet after the size adjustment to obtain the plurality of surface points.

9. The method according to claim 7, characterized in that: Before translating the initial facet according to the preset radius range and along a direction perpendicular to the preset reference plane to obtain the target facet, the method further includes: Adjusting the size of the initial face sheet; The step of translating the initial face patch along a direction perpendicular to the preset reference plane according to the preset radius range to obtain the target face patch includes: According to the preset radius range, the initial facet after resizing is translated along a direction perpendicular to the preset reference plane to obtain the target facet.

10. The method according to claim 6, characterized in that The filtering the multiple initial surface points according to the target face to obtain the multiple surface points includes: The plurality of initial surface points are filtered according to the grayscale value of each pixel point corresponding to the preset pattern in the target surface patch to obtain the plurality of surface points.

11. The method according to claim 1, characterized in that: The step of performing surface point diffusion based on the target surface point in the game scene to obtain a plurality of surface points includes: The plurality of surface points are obtained from a model surface of the target terrain unit where the target surface point is located.

12. The method according to claim 1, characterized in that The step of merging the plurality of virtual attachment units to generate the attachment model comprises: Invoking a retopology function of a preset digital content software to merge the multiple virtual attachment units to generate an initial attachment model; The initial attachment model is rendered according to a preset attachment type map to generate the attachment model.

13. The method according to claim 12, characterized in that The step of rendering the initial attachment model according to the preset attachment type map to generate the attachment model includes: The initial attachment model is rendered according to a texture map of a preset attachment type and a material map of a preset attachment type to generate the attachment model.

14. The method according to claim 12, characterized in that Before rendering the initial attachment model according to the preset attachment type map to generate the attachment model, the method further includes: Performing shape adjustment on the initial attachment model; The step of rendering the initial attachment model according to the preset attachment type map to generate the attachment model includes: The initial attachment model after shape adjustment is rendered according to a preset attachment type map to generate the attachment model.

15. The method according to claim 12, characterized in that Before rendering the initial attachment model according to the preset attachment type map to generate the attachment model, the method further includes: Performing face reduction processing on the triangular facets of the initial attachment model; The step of rendering the initial attachment model according to the preset attachment type map to generate the attachment model comprises: The initial attachment model after the surface reduction process is rendered according to the preset attachment type map to generate the attachment model.

16. The method according to claim 1, characterized in that The method further comprises: A first insert model is generated on the surface of the attachment model.

17. The method according to claim 1, characterized in that The method further comprises: A second insert model is generated at a connection area between the attachment model and the target terrain unit in the game construction scene.

18. An attached model rendering device in a virtual scene, characterized in that: Provides a graphical user interface through terminal devices, including: A display module, configured to respond to a scene construction instruction and display a game scene screen formed by shooting a game construction scene with a virtual camera in the graphical user interface, wherein the game construction scene includes a plurality of terrain units; A determination module, used to determine a target terrain unit from the game construction scene along the shooting direction of the virtual camera, and determine a target surface point for attaching the attachment model on the model surface of the target terrain unit; The determination module is further used to perform surface point diffusion based on the target surface point in the game construction scene to obtain multiple surface points; The generation module is used to generate a plurality of virtual attachment units at the positions of the plurality of surface points in the game construction scene, respectively, and merge the plurality of virtual attachment units to generate the attachment model.

19. A computer device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, and when the computer device is running, the processor and the storage medium communicate through the bus, and the processor executes the program instructions to perform the steps of the attached model rendering method in a virtual scene as described in any one of claims 1 to 17.

20. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for rendering an attached model in a virtual scene according to any one of claims 1 to 17 are executed.

Citation Information

Cited By

  • Special effect positioning generation method and device, equipment and medium

    CN121266116A