Sculpture processing method, device and computer equipment for a spherical model
By determining the screen coordinates and surface point position information of the virtual focus in the graphical user interface, and adjusting the carving area and depth of the spherical model, the problem of low processing efficiency of complex spherical models is solved, and the efficiency of carving effect is improved.
Patent Information
- Application Number
- CN202211466631.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-22
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2042-11-22
AI Technical Summary
Existing technologies suffer from low model processing efficiency and poor results when designing complex spherical models, especially when sculpting spherical models with concave or embossed patterns, requiring the creation of multiple materials and prone to mismatches.
By determining the position information of surface points in the virtual scene space, responding to the virtual focus selection command in the graphical user interface, determining the screen coordinates of the virtual focus, determining the area to be sculpted and its sculpting depth based on the screen coordinates and surface point information, and adjusting the position of the surface points to obtain the sculpted spherical model.
It improves the efficiency of model processing, avoids the problem of mismatched material splicing, enhances the sculpting effect of the model, and allows direct control of the sculpting area and adjustment of surface point positions through virtual focus, saving material production time.
Smart Images

Figure CN115758502B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a sculpture processing method and device of a spherical model and a computer device. BACKGROUND
[0002] With the development of computer technology, more and more animations or electronic games enter people's life. In the development of animations or electronic games, a large amount of model design and model rendering work is involved.
[0003] In the related art, when designing a model, a related technical personnel often needs to make fixed materials in advance, and then splices or combines different shapes of materials together to form a special-shaped model. Alternatively, there can be some simple and fixed model templates, and the related technical personnel can adjust the shape of the model templates by inputting corresponding parameters in a specific program. In this way, some special-shaped models can be designed.
[0004] However, the scheme in the related art has the problems of low model processing efficiency and poor effect when designing some complex-shaped models, such as a spherical model with a concave or embossed pattern. SUMMARY
[0005] The purpose of the present application is to provide a sculpture processing method and device of a spherical model and a computer device, which can improve the efficiency and effect of processing the model.
[0006] Embodiments of the present application are implemented as follows:
[0007] In an aspect, the present application provides a sculpture processing method of a spherical model, a graphical user interface is provided by a terminal, and the content displayed by the graphical user interface includes a virtual scene picture obtained by photographing a model in a virtual scene space. The method comprises the following steps:
[0008] Determine the position information of each surface point of a to-be-sculpted model in the virtual scene space, wherein the to-be-sculpted model is a spherical model;
[0009] In response to a selection instruction of a virtual focus point in the graphical user interface, determine the screen coordinates of the virtual focus point;
[0010] According to the screen coordinates of the virtual focus point and the position information of each surface point, determine a to-be-sculpted region of the to-be-sculpted model and the sculpture depth of each surface point in the to-be-sculpted region, wherein the sculpture depth is used to indicate the amplitude of the distance between the surface point and the center of the to-be-sculpted model that needs to be adjusted;
[0011] The position information of each surface point in the to-be-engraved region is adjusted according to the engraving depth, to obtain an engraved spherical model.
[0012] In a second aspect, the embodiment of the present application provides a device for processing engraving of a spherical model. The device provides a graphical user interface through a terminal. The graphical user interface displays a virtual scene picture obtained by photographing a model in a virtual scene space. The device comprises:
[0013] A first determining module is configured to determine position information of each surface point of a to-be-engraved model in the virtual scene space. The to-be-engraved model is a spherical model.
[0014] A second determining module is configured to determine a screen coordinate of a virtual focus point in the graphical user interface in response to a selection instruction of the virtual focus point.
[0015] A third determining module is configured to determine a to-be-engraved region of the to-be-engraved model and an engraving depth of each surface point in the to-be-engraved region according to the screen coordinate of the virtual focus point and the position information of each surface point. The engraving depth is used to indicate a magnitude of distance adjustment between the surface point and a center of the to-be-engraved model.
[0016] A processing module is configured to adjust the position information of each surface point in the to-be-engraved region according to the engraving depth, to obtain an engraved spherical model.
[0017] In a third aspect, the embodiment of the present application provides a computer device. The computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor. The computer program is executed by the processor to implement the method for processing engraving of a spherical model in the first aspect.
[0018] In a fourth aspect, the embodiment of the present application provides a computer readable storage medium. The computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the method for processing engraving of a spherical model in the first aspect.
[0019] The embodiment of the present application has the following beneficial effects:
[0020] The method for processing engraving of a spherical model provided by the embodiment of the present application comprises the following steps. The position information of each surface point of a to-be-engraved model in a virtual scene space is determined. The screen coordinate of a virtual focus point in a graphical user interface is determined in response to a selection instruction of the virtual focus point. The to-be-engraved region of the to-be-engraved model and the engraving depth of each surface point in the to-be-engraved region are determined according to the screen coordinate of the virtual focus point and the position information of each surface point. The position information of each surface point in the to-be-engraved region is adjusted according to the engraving depth, to obtain an engraved spherical model.
[0021] The position information of each surface point of the model to be carved in the virtual scene space is determined, and the screen coordinates of the virtual focus point are determined in response to a selection instruction of the virtual focus point in the graphical user interface, so that the position of each surface point of the model to be carved in the virtual scene and the position of the virtual focus point mapped into the virtual scene can be accurately determined, and the position of the region to be carved of the model to be carved indicated or selected by the virtual focus point can be conveniently determined.
[0022] The region to be carved of the model to be carved and the carving depth of each surface point in the region to be carved are determined according to the screen coordinates of the virtual focus point and the position information of each surface point, since the user can control the position of the virtual focus point on the graphical user interface, and the screen coordinates of the virtual focus point can be global coordinates of the virtual focus point converted into the virtual scene, so that the direction of the virtual focus point in the virtual scene and the position of the virtual focus point in the virtual scene can be accurately determined, and the region of the model to be carved selected by the user through the virtual focus point can be accurately determined, and the processing of each surface point in the region to be carved can be determined according to the screen coordinates of the virtual focus point and the position information of each surface point, so that the carving depth of each surface point in the region to be carved can be accurately determined.
[0023] The position information of each surface point in the region to be carved is adjusted according to the carving depth to obtain a carved spherical model, and the position of each surface point in the region to be carved can be directly adjusted according to the carving depth, and the shape of the model to be carved will change after the position of each surface point in the region to be carved is adjusted, so that the model after the position of each surface point in the region to be carved of the model to be carved is adjusted or changed according to the carving depth can be obtained.
[0024] In addition, the user can adjust the position of the virtual focus point displayed on the graphical user interface, and change the region to be carved of the model to be carved selected by the virtual focus point, so that each region or each surface point of the model to be carved can be carved to carve the shape or pattern required by the user on the model to be carved.
[0025] And, the method for sculpture processing of the spherical model provided by the embodiment of the present application only needs to obtain a model to be sculpted, and does not need to make the required material in advance, so that the time spent on making the material can be saved, and the plurality of materials do not need to be spliced or combined, so that the situation that the plurality of materials do not match can be avoided. Instead, the to-be-sculpted area to be sculpted can be selected by controlling the virtual focus point, and the positions of the surface points in the to-be-sculpted area are adjusted according to the sculpture depth, so as to obtain the model after sculpture.
[0026] In this way, the efficiency of processing the model can be improved, and the effect of processing the model can be improved. BRIEF DESCRIPTION OF DRAWINGS
[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required to be used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor.
[0028] Figure 1 The flow chart of the first method for sculpture processing of the spherical model provided by the embodiment of the present application;
[0029] Figure 2 The flow chart of the second method for sculpture processing of the spherical model provided by the embodiment of the present application;
[0030] Figure 3 The flow chart of the third method for sculpture processing of the spherical model provided by the embodiment of the present application;
[0031] Figure 4 The schematic diagram of the model to be sculpted and the virtual camera provided by the embodiment of the present application;
[0032] Figure 5 The flow chart of the fourth method for sculpture processing of the spherical model provided by the embodiment of the present application;
[0033] Figure 6 The flow chart of the fifth method for sculpture processing of the spherical model provided by the embodiment of the present application;
[0034] Figure 7 The flow chart of the sixth method for sculpture processing of the spherical model provided by the embodiment of the present application;
[0035] Figure 8 The schematic diagram of the model to be sculpted provided by the embodiment of the present application;
[0036] Figure 9A flowchart of a seventh ball model engraving processing method provided by an embodiment of the present application is shown in FIG. 7;
[0037] Figure 10 An eighth ball model engraving processing method provided by an embodiment of the present application is shown in FIG. 8;
[0038] Figure 11 A structure diagram of a ball model engraving processing device provided by an embodiment of the present application is shown in FIG. 9;
[0039] Figure 12 A structure diagram of a computer device provided by an embodiment of the present application is shown in FIG. 10. DETAILED DESCRIPTION
[0040] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in connection with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments of the present application. The components of the embodiments of the present application described and shown in the drawings can be arranged and designed in various different configurations.
[0041] Therefore, the detailed description of the embodiments of the present application provided in the drawings below is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of the present application.
[0042] It should be noted that: similar reference numerals and letters represent similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0043] In the related art, when designing a model, a related skilled person often needs to make fixed materials to be used in advance, and then forms a special-shaped model by splicing or combining different-shaped materials together. Alternatively, there can be some simple and fixed model templates, and the related skilled person can adjust the shape of the model templates by inputting corresponding parameters in a specific program. In this way, some special-shaped models can be designed.
[0044] However, the scheme in the related art has problems of low model processing efficiency and poor effect when designing some complex-shaped models, such as a ball-shaped model with a carved or embossed pattern, because a large number of fine materials need to be made, and when splicing multiple materials, it is inevitable that the materials cannot match or completely fit each other.
[0045] To this end, the embodiment of the present application provides a sculpture processing method of a spherical model, the sculpture processing method comprises the following steps: determining position information of each surface point of a to-be-sculpted model in a virtual scene space; in response to a selection instruction of a virtual focus point in a graphical user interface, determining a screen coordinate of the virtual focus point; determining a to-be-sculpted region of the to-be-sculpted model and a sculpture depth of each surface point in the to-be-sculpted region according to the screen coordinate of the virtual focus point and the position information of each surface point; and adjusting the position information of each surface point in the to-be-sculpted region according to the sculpture depth, so as to obtain a sculpted spherical model, thereby improving the efficiency and effect of processing the model.
[0046] In a possible implementation, the embodiment of the present application provides a sculpture processing method of a spherical model, and a graphical user interface is provided by a terminal device, wherein the terminal device can be a local terminal device or a client device in a cloud interaction system.
[0047] Generally, a target application program for displaying a model, designing a model and changing a model parameter can be installed in the terminal device, for example, the target application program can be 3D MAX, Maya software or the like.
[0048] The graphical user interface can be used to display a virtual focus point of an input device, can be used to display a UI interface of the target application program, and can also be used to display a three-dimensional virtual scene provided by the target application program.
[0049] Optionally, the input device can be a mouse, a remote sensing device, a keyboard, a handle or the like electronic device.
[0050] The virtual focus point can be a virtual pointer, a virtual foresight, a virtual brush, a virtual sculpture pen or the like.
[0051] At least one 3D model can be displayed in the three-dimensional virtual scene, a user can select a point or a region on the at least one 3D model by controlling the virtual focus point, and can operate the selected point or region by controlling the virtual focus point. The embodiment of the present application does not limit this.
[0052] In addition, the three-dimensional virtual scene displayed on the graphical user interface can be a picture taken by a virtual camera in the three-dimensional virtual scene, and after a user inputs a corresponding instruction to adjust a position of the virtual camera and / or a shooting direction of the virtual camera, the picture of the three-dimensional virtual scene taken by the virtual camera will also be changed correspondingly.
[0053] For example, if the virtual camera currently captures the top surface of a cube model in the three-dimensional virtual scene, the top surface of the cube model can be displayed on the graphical user interface. After the user inputs a corresponding instruction to adjust the position of the virtual camera and / or the direction of the virtual camera, the virtual camera captures the bottom surface of the cube model, and the bottom surface of the cube model can be displayed on the graphical user interface. The embodiments of the present application do not make any limitation in this regard.
[0054] The embodiments of the present application take the carving processing method of a spherical model applied in model design as an example for illustration. However, the embodiments of the present application are not limited to the carving processing of the spherical model in model design.
[0055] The carving processing method of the spherical model provided by the embodiments of the present application is explained in detail as follows.
[0056] Figure 1 A flowchart of the carving processing method of the spherical model provided by the present application is shown in FIG. 1. The method can be applied to a computer device, which can be the terminal device or the server as described above.
[0057] Referring to FIG. 1, Figure 1 The embodiments of the present application provide a carving processing method of a spherical model, which includes the following steps.
[0058] Step 1001: Determine the position information of each surface point of the to-be-carved model in the virtual scene space.
[0059] Optionally, the to-be-carved model is a spherical model. Specifically, the spherical model can be a standard sphere, or a sphere-like model after carving a standard sphere. The embodiments of the present application do not make any limitation in this regard.
[0060] Optionally, the surface point can be a point on the outer surface of the to-be-carved model.
[0061] Generally, when displaying a model or designing a model, the surface thickness of the model can be considered as 0, that is, a point on the outer surface of the to-be-carved model and a corresponding point on the inner surface of the to-be-carved model can be considered as the same point. The embodiments of the present application do not make any limitation in this regard.
[0062] Optionally, the position information is used to represent the position of each surface point of the to-be-carved model in the virtual scene. The virtual scene can be the 3D virtual scene as described above. The position information of each surface point can further indicate the position of the to-be-carved model in the virtual scene.
[0063] Specifically, the position information can include global coordinates and local coordinates of each surface point.
[0064] The global coordinate is a coordinate representing the position of each surface point based on a global coordinate system, and the local coordinate is a coordinate representing the position of each surface point based on a local coordinate system. The global coordinate and the local coordinate can be converted into each other, which is not limited in the embodiments of the present application.
[0065] In this way, the positions of each surface point of the model to be engraved in the virtual scene can be accurately determined, facilitating subsequent operations.
[0066] Step 1002: In response to a selection instruction of a virtual focus point in the graphical user interface, determining a screen coordinate of the virtual focus point.
[0067] Optionally, the virtual focus point can be a virtual focus point of the input device displayed in the graphical user interface.
[0068] The selection instruction of the virtual focus point in the graphical user interface can be an instruction input by the user through the input device to control the virtual focus point to move, select a target, and confirm to perform a corresponding operation.
[0069] For example, if the input device is a mouse, the virtual focus point can be a virtual pointer of the mouse, and the selection instruction of the virtual focus point in the graphical user interface can be an instruction input by the user by clicking a button and / or a scroll wheel of the mouse, which is not limited in the embodiments of the present application.
[0070] Optionally, the screen coordinate of the virtual focus point can be a coordinate of the virtual focus point on the graphical user interface. The screen coordinate of the virtual focus point can also be used to indicate a coordinate of the position of the virtual focus point on the graphical user interface converted to the virtual scene, in which case the screen coordinate of the virtual focus point can be a global coordinate of the virtual focus point based on the global coordinate system, which is not limited in the embodiments of the present application.
[0071] It is worth noting that since the virtual focus point is displayed on the graphical user interface, and the picture of the virtual scene displayed on the graphical user interface is taken by the virtual camera, when the virtual focus point focuses on or points to the picture of the virtual scene, the virtual focus point can be regarded as being located on the lens of the virtual camera, that is, the position of the virtual focus point on the graphical user interface can be converted to the position of the virtual focus point in the virtual scene. In this way, the position coordinate of the virtual focus point based on the global coordinate system can be determined, facilitating subsequent operations, and specifically facilitating determination of the position of the model to be engraved indicated or selected by the virtual focus point.
[0072] For example, when a region on the to-be-sculpted model is selected by the virtual focus or the to-be-sculpted model is sculpted by the virtual focus, the position of the virtual intersection point on the graphical user interface at the current time can be obtained immediately after receiving the selection instruction of the virtual focus in the graphical user interface, and the position of the virtual intersection point on the graphical user interface is mapped to a corresponding position on the lens of the virtual camera, and the global coordinates of the mapped position in the virtual scene are taken as the screen coordinates of the virtual focus.
[0073] Step 1003: determining the to-be-sculpted region of the to-be-sculpted model and the sculpture depth of each surface point in the to-be-sculpted region according to the screen coordinates of the virtual focus and the position information of each surface point.
[0074] Optionally, the to-be-sculpted region can refer to a region on the to-be-sculpted model that needs to be sculpted by the user, or a region selected on the to-be-sculpted model by the virtual focus, and the embodiments of the present application do not make a limitation in this regard.
[0075] The surface points in the to-be-sculpted region can refer to each surface point on the to-be-sculpted model located in the to-be-sculpted region.
[0076] Optionally, the sculpture depth can also be used to indicate the magnitude of the distance between the surface point and the center of the to-be-sculpted model that needs to be adjusted.
[0077] For example, the distance between a surface point and the center of the to-be-sculpted model is 10 unit lengths, and the sculpture depth is 2, so the sculpture depth can indicate that the distance between the surface point and the center of the to-be-sculpted model needs to be increased by 2 unit lengths or decreased by 2 unit lengths, and the embodiments of the present application do not make a limitation in this regard.
[0078] In addition, the sculpture depth can be used to indicate the distance between the surface point and the center of the to-be-sculpted model after the to-be-sculpted model is processed by sculpture.
[0079] It is worth noting that since the user can control the position of the virtual focus on the graphical user interface, and the screen coordinates of the virtual focus can be the global coordinates of the virtual focus converted into the virtual scene, the direction of the virtual focus in the virtual scene and the position of the virtual focus in the virtual scene can be accurately determined by the screen coordinates of the virtual focus, so that the region on the to-be-sculpted model selected by the user through the virtual focus and needing to be sculpted can be accurately determined.
[0080] It is worth noting that, after the to-be-carved region is determined, the specific processing required for each surface point in the to-be-carved region can be determined according to the screen coordinates of the virtual focus and the position information of each surface point, for example, some surface points in the to-be-carved region are subjected to large-scale carving, and some surface points are subjected to small-scale carving, so that the carving depth of each surface point in the to-be-carved region can be accurately determined, and each surface point in the to-be-carved region can be carved according to the carving depth.
[0081] Step 1004: Adjusting the position information of each surface point in the to-be-carved region according to the carving depth, to obtain a carved spherical model.
[0082] Optionally, the carved spherical model can be a model obtained by adjusting or changing the position of each surface point in the to-be-carved region on the to-be-carved model according to the carving depth.
[0083] It is worth noting that, generally, if the to-be-carved model is a standard sphere, the distance between the centers of the to-be-carved model is the radius of the standard sphere. Since the carving depth can indicate the distance between each surface point in the to-be-carved region and the center of the to-be-carved model, after the position of each surface point in the to-be-carved region is adjusted according to the carving depth, the distance between the adjusted surface points and the center of the to-be-carved model can be greater than or less than the radius of the standard sphere. In this case, the carved spherical model can be a spherical model similar to the standard sphere. The embodiments of the present application do not limit this.
[0084] It is worth noting that, by adjusting the position of each surface point in the to-be-carved region according to the carving depth, the shape of the to-be-carved model will change accordingly after the position of each surface point in the to-be-carved region is adjusted. Thus, the user can adjust the position of the virtual focus displayed on the graphical user interface, and then change the to-be-carved region selected by the virtual focus on the to-be-carved model, to carve each region or surface point on the to-be-carved model, so as to carve the shape or pattern required by the user on the to-be-carved model.
[0085] In the embodiments of the present application, by determining the position information of each surface point of the to-be-carved model in the virtual scene space, in response to the selection instruction of the virtual focus in the graphical user interface, the screen coordinates of the virtual focus are determined, the to-be-carved region of the to-be-carved model and the carving depth of each surface point in the to-be-carved region are determined according to the screen coordinates of the virtual focus and the position information of each surface point, the position information of each surface point in the to-be-carved region is adjusted according to the carving depth, and a carved spherical model is obtained.
[0086] The position information of each surface point of the model to be carved in the virtual scene space is determined, and the screen coordinates of the virtual focus point are determined in response to a selection instruction of the virtual focus point in the graphical user interface, so that the position of each surface point of the model to be carved in the virtual scene and the position of the virtual focus point mapped into the virtual scene can be accurately determined, and the position of the region to be carved of the model to be carved indicated or selected by the virtual focus point can be conveniently determined.
[0087] According to the screen coordinates of the virtual focus point and the position information of each surface point, the region to be carved of the model to be carved and the carving depth of each surface point in the region to be carved are determined. Since the user can control the position of the virtual focus point on the graphical user interface, and the screen coordinates of the virtual focus point can be global coordinates converted from the virtual focus point to the virtual scene, the direction of the virtual focus point in the virtual scene and the position of the virtual focus point in the virtual scene can be accurately determined through the screen coordinates of the virtual focus point, so that the region of the model to be carved selected by the user through the virtual focus point can be accurately determined, and the processing required for each surface point in the region to be carved can be determined according to the screen coordinates of the virtual focus point and the position information of each surface point, so that the carving depth of each surface point in the region to be carved can be accurately determined.
[0088] The position information of each surface point in the region to be carved is adjusted according to the carving depth to obtain a carved spherical model. The position of each surface point in the region to be carved can be directly adjusted according to the carving depth. After the position of each surface point in the region to be carved is adjusted, the shape of the model to be carved changes accordingly, so that the model after the position of each surface point in the region to be carved on the model to be carved is adjusted or changed according to the carving depth can be obtained.
[0089] In addition, the user can adjust the position of the virtual focus point displayed on the graphical user interface, and change the region to be carved on the model to be carved selected by the virtual focus point, so that each region or each surface point on the model to be carved can be carved to carve the shape or pattern required by the user on the model to be carved.
[0090] Further, the method for sculpture processing of the spherical model provided by the embodiment of the present application can only obtain a model to be sculpted, without the need of preparing the required material in advance, so that the time spent on preparing the material can be saved, and the plurality of materials do not need to be spliced or combined, so that the situation that the plurality of materials do not match can be avoided. Instead, the to-be-sculpted region to be sculpted can be selected by controlling the virtual focus point, and the positions of the surface points in the to-be-sculpted region are adjusted according to the sculpture depth, so as to obtain the model after sculpture.
[0091] In this way, the efficiency of processing the model can be improved, and the effect of processing the model can be improved.
[0092] In a possible implementation manner, referring to Figure 2 According to the screen coordinates of the virtual focus point and the position information of the surface points, the to-be-sculpted region of the to-be-sculpted model and the sculpture depth of the surface points in the to-be-sculpted region are determined, and the method comprises the following steps.
[0093] Step 1005: According to the global coordinates in the position information of the surface points and the screen coordinates of the virtual focus point, the global coordinates of the target point corresponding to the virtual focus point on the to-be-sculpted model are determined.
[0094] Optionally, the target point can be a point on the to-be-sculpted model indicated or selected by the virtual focus point.
[0095] In addition, in the case that the to-be-sculpted model is displayed on the graphical user interface, the virtual focus point can coincide with the target point on the graphical user interface, and generally, the virtual focus point can be displayed on the upper layer of the to-be-sculpted model.
[0096] It is worth noting that since the position of the virtual focus point on the graphical user interface is converted to the position in the virtual scene by using the global coordinates, the global coordinates of the target point corresponding to the virtual focus point on the to-be-sculpted model need to be determined according to the screen coordinates of the virtual focus point and the position information of the surface points. In this way, the target point indicated or selected by the virtual focus point and the coordinates of the target point can be accurately determined.
[0097] Step 1006: According to the global coordinates of the target point and the preset region range information, the to-be-sculpted region is determined.
[0098] Optionally, the preset region range information can be used to indicate the size, shape and other parameters of the to-be-sculpted region.
[0099] Exemplarily, the preset region range information can include a preset length, and can also include a preset coordinate interval.
[0100] If the preset region range information comprises a preset length, then the target point can be taken as a center of a circle on the model to be engraved, and a circular region formed by taking the preset length as a radius can be taken as the region to be engraved.
[0101] If the preset region range information comprises a preset coordinate interval, then the coordinates of the target point can be adjusted according to the preset coordinate interval to obtain a plurality of region position points, and a region surrounded by the plurality of region position points on the model to be engraved can be taken as the region to be engraved.
[0102] In this way, the region to be engraved selected by the user by manipulating the virtual focus on the model to be engraved can be accurately determined.
[0103] Step 1007: determining the engraving depth of each surface point in the region to be engraved according to the global coordinates of the target point and the target engraving parameter.
[0104] Optionally, the target engraving parameter can be a parameter input by the user according to actual engraving needs, and used to indicate adjustment of the positions of the surface points in the region to be engraved.
[0105] Exemplarily, the target engraving parameter can comprise a maximum engraving depth, a minimum engraving depth, a positive or negative nature of the engraving depth, and a required time length each time the model to be engraved is engraved.
[0106] The positive or negative nature of the engraving depth can be used to indicate whether the distance between each surface point in the region to be engraved and the sphere center of the model to be engraved is to be increased or decreased when the positions of the surface points in the region to be engraved are adjusted according to the engraving depth.
[0107] For example, in the case where the engraving depth is negative, the value of the obtained engraving depth is negative, and when the positions of the surface points in the region to be engraved are adjusted according to the engraving depth, the distance between each surface point in the region to be engraved and the sphere center of the model to be engraved can be decreased. In the case where the engraving depth is positive, the value of the obtained engraving depth is positive, and when the positions of the surface points in the region to be engraved are adjusted according to the engraving depth, the distance between each surface point in the region to be engraved and the sphere center of the model to be engraved can be increased, which is not limited in the embodiments of the present application.
[0108] In this way, the sculpture depth of each surface point in the to-be-sculpted region can be accurately determined, and specific adjustment of the position of each surface point in the to-be-sculpted region according to the sculpture depth can be performed, so that the sculpted spherical model can be accurately obtained, and it is ensured that the shape of the sculpted spherical model conforms to the shape expected to be sculpted by the user, and it is ensured that the pattern sculpted on the to-be-processed model or the sculpted spherical model conforms to the pattern expected to be sculpted by the user. In this way, the effect of model processing is improved.
[0109] In a possible implementation, referring to Figure 3 The global coordinates of the target point corresponding to the virtual focus point on the to-be-sculpted model are determined according to the screen coordinates of the virtual focus point and the global coordinates in the position information of each surface point, and the determination includes:
[0110] Step 1008: The screen coordinates of the virtual focus point are taken as the ray origin coordinates, and a ray in a preset direction is emitted.
[0111] Optionally, the preset direction is the same as the direction of the lens center of the virtual camera.
[0112] It can be understood that, in life, when people take photos by using a camera, because the lens size of the camera is small, the field of view of the photo taken by the camera is much larger than the lens of the camera, and therefore the light collected by the camera during imaging is often divergent, but the direction of the lens center point of the camera is always the same as the direction of the camera. Similarly, when the virtual camera captures the virtual scene, the direction of the lens center of the virtual camera is also the same as the direction of the virtual camera.
[0113] It is worth noting that, after the position of the virtual focus point in the graphical user interface is converted to the position in the virtual scene, it can be considered that the position of the virtual focus point in the virtual scene is located on the lens of the virtual camera, and the screen coordinates of the virtual focus point are taken as the ray origin coordinates, and a ray in a preset direction is emitted, so that the position pointed to or selected by the virtual focus point in the virtual scene can be accurately determined.
[0114] Step 1009: The intersection of the ray and the to-be-sculpted model is determined according to the global coordinates in the position information of each surface point and the ray.
[0115] Optionally, the intersection of the ray and the to-be-sculpted model can be used to indicate a point on the to-be-sculpted model pointed to or selected by the virtual focus point.
[0116] Step 1010: The global coordinates of the target point are determined according to the intersection of the ray and the to-be-sculpted model.
[0117] In this way, the target point indicated by the virtual focus point or selected by the user and the coordinates of the target point can be accurately determined.
[0118] In a possible implementation, the global coordinates of the target point are determined according to the intersection points of the ray and the model to be engraved.
[0119] If the number of intersection points is 0, it is determined that the target point does not exist.
[0120] If the number of intersection points is 1, the intersection point is taken as the target point, and the global coordinates of the intersection point are taken as the global coordinates of the target point.
[0121] If the number of intersection points is 2, the intersection point closest to the coordinates of the position of the virtual focus point is taken as the target point, and the global coordinates of the intersection point are taken as the global coordinates of the target point.
[0122] For example, if the model to be processed has not undergone any engraving processing, that is, the model to be processed is a standard sphere, when determining the intersection points of the ray and the model to be engraved, the following method can be used:
[0123]
[0124] f(X) = ||X-C|| 2 = R 2 (2)
[0125] In formula (1), L(t) represents the ray, P is a ray origin vector of the ray, t is an independent variable of the parametric equation of the ray, and d is a direction vector of the parametric equation, and is specifically used to indicate the direction of the ray.
[0126] In formula (2), f(X) represents the model to be engraved, X is an independent variable of the parametric equation of the model to be engraved, C is the center of the model to be engraved, and R is the radius of the model to be engraved.
[0127] By substituting formula (1) into formula (2), an equation similar to a monomial quadratic equation can be obtained as shown in formula (3) below:
[0128]
[0129] According to formula (3) above, formula (4) can be obtained, and the number of solutions of formula (3) can be obtained by solving formula (4) below, that is, the number of intersection points of the ray and the model to be engraved.
[0130]
[0131] If there are two solutions of Δ, it can be determined that the number of intersection points of the ray and the model to be carved is 2. If there is one solution of Δ, it can be determined that the number of intersection points of the ray and the model to be carved is 1. If there is no solution of Δ, it can be determined that the number of intersection points of the ray and the model to be carved is 0.
[0132] In this way, the intersection point of the ray and the model to be carved without any carving processing can be directly determined by using the sphere equation without any carving processing of the model to be processed, so that the convenience of determining the target point and the global coordinates of the target point is improved, and the efficiency of processing the model is further improved.
[0133] For example, as shown in Figure 4 , Figure 4 , a model to be carved Q, a sphere center O, a virtual camera S, a virtual focus J, a ray X, a target point M, an upper view line Y1 and a lower view line Y2 of the virtual camera S are shown.
[0134] The upper view line Y1 and the lower view line Y2 are used to indicate the range of the virtual camera S shooting the virtual scene, that is, the virtual scene displayed in the above graphical user interface is the virtual scene within the upper view line Y1 and the lower view line Y2.
[0135] As can be seen from Figure 4 , the model to be carved Q is a standard sphere, the virtual focus J is located at the center of the lens of the virtual camera S, the ray X is emitted with the virtual focus J as the starting point, and the ray X has two intersection points with the model to be carved Q.
[0136] However, since the intersection point on the right side of the model to be carved Q is closer to the coordinates of the position of the virtual focus than the intersection point on the left side, the intersection point on the right side of the model to be carved Q is taken as the target point M.
[0137] In addition, if the model to be carved has been carved, that is, the model to be carved is a spherical model, the global coordinates of the target point can be determined by determining the solutions of the equation of the ray and the parameter equation representing the model to be carved, or any other method that can determine the intersection point of the model to be carved and the ray, which is not limited in the embodiments of the present application.
[0138] In a possible implementation, referring to Figure 5 , the model to be carved is determined according to the global coordinates of the target point and preset region range information, including:
[0139] Step 1011: taking the target point as a center point of the to-be-engraved region, determining, according to a local coordinate in the position coordinate of the target point and local coordinates of other surface points except the target point in the surface points, a first distance from the other surface points to the target point.
[0140] Optionally, the first distance can refer to a distance between the target point and the other surface points calculated according to the local coordinate of the target point and the local coordinates of the other surface points.
[0141] Specifically, the first distance can refer to a straight-line distance between the target point and the other surface points in the local coordinate system. The first distance can also refer to a straight-line distance between the target point and the other surface points in the global coordinate system.
[0142] In addition, the other surface points specifically refer to all other surface points in the to-be-engraved model except the target point.
[0143] Step 1012: taking the other surface points with the first distance to the target point satisfying the preset range information and the target point as surface points in the to-be-engraved region, to obtain the to-be-engraved region.
[0144] For example, if the preset region range information includes a preset length, and the preset length is 2 units of length in the local coordinate system, then a circular region formed by taking the target point as a center and 2 units of length in the local coordinate system as a radius can be taken as the to-be-engraved region.
[0145] If the preset region range information includes a preset coordinate interval, and the preset coordinate interval is 3, and the coordinate of the target point is (4, 6), then the coordinate of the target point is adjusted according to the preset coordinate interval, to obtain the coordinates of a plurality of region position points as (1, 3), (7, 9), (7, 3), and (1, 9), and a region surrounded by the four region position points on the to-be-engraved model is taken as the to-be-engraved region, and the region surrounded by the four region position points on the to-be-engraved model is a rectangular region.
[0146] In this way, the to-be-engraved region selected by the user by manipulating the virtual focus point on the to-be-engraved model can be accurately determined, and the flexibility of determining the to-be-engraved region can be improved.
[0147] In a possible implementation manner, referring to Figure 6 determining, according to the global coordinate of the target point and the target engraving parameter, the engraving depth of each surface point in the to-be-engraved region, includes:
[0148] Step 1013: determining the second distance between the surface point in the to-be-engraved region and the target point along the surface of the to-be-engraved model according to the global coordinate of the surface point in the to-be-engraved region and the global coordinate of the target point.
[0149] Optionally, the second distance can refer to the distance between the target point and each other surface point along the to-be-engraved surface calculated according to the global coordinate of the target point and the global coordinate of each other surface point.
[0150] Specifically, the second distance can refer to the arc distance between the target point and each other surface point in the global coordinate system.
[0151] In addition, in the determination of the second distance between the surface point in the to-be-engraved region and the target point along the surface of the to-be-engraved model, the second distance between all the surface points in the to-be-engraved region and the target point along the surface of the to-be-engraved model can be determined, or only the second distance between the surface points other than the target point in the to-be-engraved region and the target point along the surface of the to-be-engraved model can be determined.
[0152] Illustratively, if the global coordinate of the target point is (x1, y1, z1) and the global coordinate of one other surface point in the to-be-engraved region is (x2, y2, z2), the second distance between the target point and the other surface point can be calculated in the following formula (5).
[0153]
[0154] wherein l is the length of the arc formed by the target point and the other surface point, i.e., the second distance, θ is the radian of the arc formed by the target point and the other surface point, and R is the radius of the to-be-engraved model.
[0155] It is worth noting that since the engraving depth of the to-be-engraved model is generally greatly different from the radius of the to-be-engraved model, the second distance between the target point and the other surface point can be quickly determined by the above formula (5) to improve the efficiency of the engraving process. In addition, the concave-convex height of the spherical model surface can be added to the value calculated by the above formula (5) in any other possible way, and the sum is taken as the second distance, so that the distance between each other surface point and the target point along the to-be-engraved surface can be accurately determined.
[0156] Step 1014: determining the engraving depth according to the second distance and the target engraving parameter.
[0157] It is worth noting that since the surface points in the to-be-engraved region are different from the target point in the second distance along the surface of the to-be-engraved model, different engraving depths of the surface points in the to-be-engraved region can be determined according to the size of the second distance, and different adjustments of the positions of the surface points in the to-be-engraved region can be made, and then the flexibility of engraving the to-be-engraved model can be further improved.
[0158] In this way, the engraving depth of each surface point in the to-be-engraved region can be more accurately determined, and the specific adjustment of the position of each surface point in the to-be-engraved region according to the engraving depth can be made, and then the engraved spherical model can be accurately obtained. In this way, the effect of model processing can be improved.
[0159] In a possible implementation manner, referring to Figure 7 The engraving depth is determined according to the second distance and the target engraving parameter, including:
[0160] Step 1015: Determine whether the second distance of each surface point in the to-be-engraved region from the target point is greater than or equal to a preset distance.
[0161] Optionally, the preset distance can be set by a related technical person according to actual needs. Generally, the preset distance can be greater than, equal to, or less than one-half of the radius, length, and / or width of the to-be-engraved region, and the embodiments of the present application do not limit this.
[0162] Generally, if different amplitudes of engraving are needed for each surface point in the to-be-engraved region, the preset distance can be set to be less than one-half of the radius, length, and / or width of the to-be-engraved region.
[0163] Step 1016: If yes, the engraving depth of each surface point in the to-be-engraved region is determined according to the first preset algorithm and the target engraving parameter.
[0164] Step 1017: If no, the engraving depth of each surface point in the to-be-engraved region is determined according to the second preset algorithm and the target engraving parameter.
[0165] Exemplarily, the engraving depth PaintAmount of each surface point in the to-be-engraved region can be determined by the following formulas (6) and (7).
[0166] y = 1.0f - (Distance - Radius) / Falloff;
[0167] PaintAmount = y * y * (3 - 2 * y) (6)
[0168] wherein, Distance is the second distance, Falloff is the preset distance, Radius is a difference between a radius, length or width of the sculpture region and the preset distance, and f is a weight value. It can be seen that the above formula (6) is the second preset algorithm. That is, in the case that the second distance of each surface point in the to-be-sculpted region to the target point is greater than or equal to the preset distance, the sculpture depth of each surface point is calculated according to the second distance, the preset distance, the radius, length or width of the sculpture region.
[0169] It can be seen from formula (6) that, in the case that the second distance of each surface point in the to-be-sculpted region to the target point is greater than or equal to the preset distance, generally, the greater the second distance of any surface point in the to-be-sculpted region to the target point, the smaller the sculpture depth of the any surface point is determined.
[0170] PaintAmount = 1 (7)
[0171] It can be seen that the above formula (7) is the second preset algorithm. That is, in the case that the second distance of each surface point in the to-be-sculpted region to the target point is greater than or equal to the preset distance, the sculpture depth of each surface point in the to-be-sculpted region can be directly determined as 1 unit depth. The unit depth can be set by a related technical person, which is not limited in the embodiment of the present application.
[0172] In a possible implementation, adjusting the positions of the surface points in the to-be-sculpted region according to the sculpture depth comprises:
[0173] Adjusting global coordinates of the surface points in the to-be-sculpted region based on the sculpture depth.
[0174] It is worth noting that, since the sculpture depth can be used to indicate the magnitude of the distance between the surface point and the sphere center of the to-be-sculpted model that needs to be adjusted, and can also be used to indicate the distance between the surface point and the sphere center of the to-be-sculpted model after the to-be-sculpted model is subjected to the sculpture processing, and the distance between the surface point and the sphere center of the to-be-sculpted model after the to-be-sculpted model is subjected to the sculpture processing is determined by the global coordinates of the surface points after adjustment and the global coordinates of the sphere center, then the global coordinates of the surface points can be adjusted by the sculpture depth to change the positions of the surface points in the virtual scene, and thus the distance between the surface points in the sculpture region of the to-be-sculpted model after sculpture processing and the sphere center of the to-be-sculpted model is changed, and the shape of the to-be-sculpted model is changed.
[0175] In a possible implementation, the method further comprises:
[0176] Converting the global coordinates of each surface point on the model to be engraved into local coordinates in a local coordinate system established based on the face of the associated cube corresponding to each surface point.
[0177] Inserting parameter information of the local coordinate system into the local coordinates of each surface point.
[0178] Optionally, the parameter information is used to indicate the face of the associated cube corresponding to the local coordinates of each surface point.
[0179] Storing the local coordinates of each surface point in the region to be engraved and the parameter information.
[0180] Exemplarily, referring to Figure 8 , Figure 8 The associated cube surrounded by the eight points A, B, C, D, A1, B1, C1, and D1 is the inscribed cube of the model Q to be engraved.
[0181] The six faces of the associated cube are face ABCD, face A1B1C1D1, face AA1D1D, face BB1C1C, face CC1D1D, and face AA1B1B. The parameter information corresponding to the six faces can be represented by surface, and surface can be indicated by North, South, Left, Right, Back, and Front, respectively.
[0182] Therefore, the local coordinates of each surface point can be stored in a data structure such as (x, y, surface). For example, there is a surface point on the model Q to be engraved corresponding to a local coordinate system established based on face ABCD, and the local coordinates of the surface point are (1, 2). The local coordinates of the surface point can be stored as (1, 2, North).
[0183] In addition, the local coordinates of each surface point can also be stored in a map structure, in which (x, y, surface) can be used as key and the height value Height can be used as Value. The embodiments of the present application are not limited in this regard.
[0184] It is worth noting that, since in a local coordinate system, the coordinates of the points on the face of the associated cube corresponding to the establishment of the coordinate system always have a fixed value, the use of local coordinates to store the positions of each surface point can reduce the complexity of storage, reduce the storage capacity, and improve the storage efficiency.
[0185] In addition, after adjusting the positions of each surface point in the region to be engraved according to the engraving depth to obtain the engraved spherical model, the method further comprises:
[0186] determine whether the local coordinate systems corresponding to the surface points in the to-be-engraved region are the same local coordinate system.
[0187] If not, the local coordinates of the surface points in the to-be-engraved region are all converted into the local coordinate system corresponding to the target point, and the local coordinates of the surface points in the to-be-engraved region are stored.
[0188] For example, continuing to refer to Figure 8 , it is assumed that there are two surface points, one surface point W is the target point, and the local coordinates of the surface point W correspond to a local coordinate system established based on the face ABCD in Figure 8 , and the local coordinates of the other surface point E correspond to a local coordinate system established based on the face AA1B1B in Figure 8 . Originally, the coordinates of the surface point E in the local coordinate system established based on the face AA1B1B in Figure 8 are (3, 5), and after being stored in the form of (x, y, surface), the coordinates of the surface point E are (3, 5, Front), and after the coordinates of the surface point E are converted into the local coordinate system corresponding to the target point, the coordinates of the surface point E can be stored as (-3, 5, North).
[0189] In this way, the surface points on different faces can be stored in the same form or structure, which facilitates terminal device identification and improves data storage efficiency.
[0190] In a possible implementation manner, before determining the positions of the surface points of the to-be-engraved model, the method further includes:
[0191] establishing the global coordinate system and the local coordinate systems, respectively.
[0192] Optionally, the global coordinate system is used to represent a coordinate relationship established in the virtual scene and used to represent positions of all virtual objects in the virtual scene.
[0193] The local coordinate systems are established based on a specific point or a specific face, and are used to represent coordinate relationships of partial virtual objects or virtual positions in the virtual scene.
[0194] In a possible manner, referring to Figure 9 , the global coordinate system and the local coordinate systems can be established in the following manner:
[0195] Step 1018: Establishing the global coordinate system with the spherical center of the to-be-engraved model as the coordinate origin.
[0196] In this way, the subsequent calculation process can be simplified, so as to reduce the processing pressure of the terminal device.
[0197] Step 1019: establishing each local coordinate system based on the associated cube of the model to be engraved.
[0198] Optionally, the associated cube can be an inscribed cube, an circumscribed cube or any cube of the model to be engraved, and the embodiments of the present application do not make any limitation in this aspect.
[0199] Generally, since each local coordinate system needs to be established based on the associated cube, if a too small or too large cube is selected, the selected region can be too large or too small in the case that the target point on the model to be engraved is indicated or selected by the virtual focal point, and therefore, the inscribed cube or the circumscribed cube of the model to be engraved can be preferably selected as the associated cube.
[0200] Optionally, the first axis and the second axis of each local coordinate system form a plane which is parallel to each face of the associated cube of the model to be engraved, and there is a conversion relationship between each local coordinate system and the global coordinate system.
[0201] Optionally, the conversion relationship is used to indicate the included angle between each axis of each local coordinate system and each axis of the global coordinate system.
[0202] In this way, the local coordinates and the global coordinates of each surface point and the local coordinates and the global coordinates of the virtual focal point can be obtained, which facilitates the execution of other steps provided in the embodiments of the present application.
[0203] In a possible implementation manner, referring to Figure 10 , the position information of each surface point of the model to be engraved is determined, including:
[0204] Step 1020: obtaining the global coordinates of each surface point of the model to be engraved.
[0205] Optionally, the global coordinates are used to indicate the position coordinates of each surface point in the global coordinate system.
[0206] Step 1021: converting the global coordinates of each surface point into the local coordinates in the local coordinate system corresponding to each surface point according to the conversion relationship between the local coordinate system and the global coordinate system.
[0207] Optionally, the local coordinates are used to represent the position coordinates of each surface point in each local coordinate system.
[0208] The following describes the device, equipment and computer readable storage medium for performing the ball model engraving processing method provided by the present application, and the specific implementation process and technical effects are described above, and will not be described here.
[0209] Figure 11 is a structural schematic diagram of a ball model engraving processing device provided by the embodiments of the present application, referring toFigure 11 The device comprises:
[0210] The first determining module 201 is configured to determine position information of each surface point of the model to be carved in the virtual scene space.
[0211] Optionally, the model to be carved is a spherical model.
[0212] The second determining module 202 is configured to determine screen coordinates of the virtual focus in response to a selection instruction of the virtual focus in the graphical user interface.
[0213] The third determining module 203 is configured to determine a region to be carved of the model to be carved and a carving depth of each surface point in the region to be carved according to the screen coordinates of the virtual focus and the position information of each surface point.
[0214] Optionally, the carving depth is used to indicate a distance between the surface point and a center of the model to be carved.
[0215] The processing module 204 is configured to adjust the position information of each surface point in the region to be carved according to the carving depth, to obtain a carved spherical model.
[0216] The third determining module 203 is further configured to determine global coordinates of a target point corresponding to the virtual focus on the model to be carved according to the screen coordinates of the virtual focus and global coordinates in the position information of each surface point, determine the region to be carved according to the global coordinates of the target point and preset region range information, and determine the carving depth of each surface point in the region to be carved according to the global coordinates of the target point and target carving parameters.
[0217] The third determining module 203 is further configured to take the screen coordinates of the virtual focus as a starting point coordinate of a ray, emit a ray in a preset direction, determine an intersection point of the ray and the model to be carved according to global coordinates in the position information of each surface point and the ray, and determine the global coordinates of the target point according to the intersection point of the ray and the model to be carved.
[0218] The third determining module 203 is further configured to determine that the target point does not exist in a case where the number of intersection points is 0.
[0219] The third determining module 203 is further configured to take the intersection point as the target point and take global coordinates of the intersection point as global coordinates of the target point in a case where the number of intersection points is 1.
[0220] The third determining module 203 is further configured to take the intersection point closest to the position of the virtual focus as the target point and take global coordinates of the intersection point as global coordinates of the target point in a case where the number of intersection points is 2.
[0221] The third determining module 203 is further configured to take the target point as a center point of the to-be-engraved region, determine a first distance from each of the surface points other than the target point to the target point according to the local coordinates in the position coordinates of the target point and the local coordinates of the surface points, and take the surface points and the target point that satisfy the first distance as the surface points in the to-be-engraved region, to obtain the to-be-engraved region.
[0222] The third determining module 203 is further configured to determine a second distance from each of the surface points in the to-be-engraved region to the target point along the surface of the to-be-engraved model according to the global coordinates of the surface points and the global coordinates of the target point, and determine the engraving depth according to the second distance and the target engraving parameter.
[0223] The third determining module 203 is further configured to determine whether the second distance from each of the surface points in the to-be-engraved region to the target point is greater than or equal to a preset distance, and determine the engraving depth of each of the surface points in the to-be-engraved region according to a first preset algorithm and the target engraving parameter if the second distance is greater than or equal to the preset distance, or determine the engraving depth of each of the surface points in the to-be-engraved region according to a second preset algorithm and the target engraving parameter if the second distance is less than the preset distance.
[0224] The processing module 204 is further configured to adjust the global coordinates of each of the surface points in the to-be-engraved region based on the engraving depth.
[0225] The first determining module 201 is further configured to convert the global coordinates of each of the surface points on the to-be-engraved model into local coordinates in a local coordinate system established based on a face of an associated cube corresponding to each of the surface points, respectively, insert parameter information of the local coordinate system into the local coordinates of each of the surface points, and store the local coordinates of each of the surface points in the to-be-engraved region and the parameter information.
[0226] The first determining module 201 is further configured to determine whether the local coordinate systems corresponding to the surface points in the to-be-engraved region are the same, and convert the local coordinates of each of the surface points in the to-be-engraved region into a local coordinate system corresponding to a target point if the local coordinate systems are not the same, and store the local coordinates of each of the surface points in the to-be-engraved region.
[0227] The first determining module 201 is further configured to take a spherical center of the to-be-engraved model as a coordinate origin to establish the global coordinate system, and establish each of the local coordinate systems based on the associated cubes of the to-be-engraved model.
[0228] The first determining module 201 is further configured to obtain the global coordinates of each of the surface points of the to-be-engraved model, and convert the global coordinates of each of the surface points into local coordinates in a local coordinate system corresponding to each of the surface points according to a conversion relationship between the local coordinate system and the global coordinate system.
[0229] The device is used for executing the method provided by the foregoing embodiments, and has similar implementation principles and technical effects, which will not be described here.
[0230] The above modules can be one or more integrated circuits configured to implement the above method, for example, one or more application specific integrated circuits (ASICs), or one or more microprocessors, or one or more field programmable gate arrays (FPGAs), etc. For another example, when a certain module above is implemented in the form of a processing element scheduling code, the processing element can be a general-purpose processor, for example, a central processing unit (CPU) or other processor that can invoke program code. For another example, the modules can be integrated together to be implemented in the form of a system on a chip (SOC).
[0231] Figure 12 is a structural schematic diagram of a computer device provided by an embodiment of the present application. Referring to Figure 12 The computer device includes a memory 301 and a processor 302. The memory 301 stores a computer program capable of running on the processor 302. When the processor 302 executes the computer program, the steps in any of the above method embodiments are implemented.
[0232] The processor 302 is configured to determine position information of each surface point of a to-be-carved model in the virtual scene space.
[0233] Optionally, the to-be-carved model is a spherical model.
[0234] The processor 302 is configured to determine screen coordinates of the virtual focus in the graphical user interface in response to a selection instruction of the virtual focus.
[0235] The processor 302 is configured to determine a to-be-carved region of the to-be-carved model and a carving depth of each surface point in the to-be-carved region according to the screen coordinates of the virtual focus and the position information of each surface point.
[0236] Optionally, the carving depth is used to indicate a distance between the surface point and a center of the to-be-carved model.
[0237] The processor 302 is configured to adjust the position information of each surface point in the to-be-carved region according to the carving depth, to obtain a carved spherical model.
[0238] The processor 302 is further configured to determine, according to the screen coordinates of the virtual focus and global coordinates in the position information of the surface points, global coordinates of a target point corresponding to the virtual focus on the model to be engraved, determine the region to be engraved according to the global coordinates of the target point and preset region range information, and determine the engraving depth of each surface point in the region to be engraved according to the global coordinates of the target point and the target engraving parameter.
[0239] The processor 302 is further configured to take the screen coordinates of the virtual focus as the starting point coordinates of a ray, emit a ray in a preset direction, determine, according to the global coordinates in the position information of the surface points and the ray, an intersection point of the ray and the model to be engraved, and determine the global coordinates of the target point according to the intersection point of the ray and the model to be engraved.
[0240] The processor 302 is further configured to, in a case where the number of intersection points is 0, determine that the target point does not exist.
[0241] The processor 302 is further configured to, in a case where the number of intersection points is 1, take the intersection point as the target point and take the global coordinates of the intersection point as the global coordinates of the target point.
[0242] The processor 302 is further configured to, in a case where the number of intersection points is 2, take the intersection point closest to the coordinates of the position of the virtual focus as the target point and take the global coordinates of the intersection point as the global coordinates of the target point.
[0243] The processor 302 is further configured to take the target point as a center point of the region to be engraved, determine, according to the local coordinates in the position coordinates of the target point and local coordinates of other surface points except the target point in the surface points, first distances of the other surface points to the target point, take the other surface points and the target point to the target point of which the first distances satisfy the preset range information as surface points in the region to be engraved, and obtain the region to be engraved.
[0244] The processor 302 is further configured to determine, according to the global coordinates of the surface points in the region to be engraved and the global coordinates of the target point, second distances of the surface points in the region to be engraved to the target point along the surface of the model to be engraved, and determine the engraving depth according to the second distances and the target engraving parameter.
[0245] The processor 302 is further configured to determine whether the second distances of the surface points in the region to be engraved to the target point are greater than or equal to a preset distance, determine the engraving depth of the surface points in the region to be engraved according to a first preset algorithm and the target engraving parameter in a case where the determination result is yes, and determine the engraving depth of the surface points in the region to be engraved according to a second preset algorithm and the target engraving parameter in a case where the determination result is no.
[0246] The processor 302 is further configured to adjust the global coordinates of each surface point in the to-be-engraved region based on the engraving depth.
[0247] The processor 302 is further configured to convert the global coordinates of each surface point on the to-be-engraved model into local coordinates in a local coordinate system established based on a face of the associated cube corresponding to each surface point, respectively. The parameter information of the local coordinate system is inserted into the local coordinates of each surface point. The local coordinates of each surface point in the to-be-engraved region and the parameter information are stored.
[0248] The processor 302 is further configured to determine whether the local coordinate systems corresponding to each surface point in the to-be-engraved region are the same, and if not, convert the local coordinates of each surface point in the to-be-engraved region into the local coordinate system corresponding to the target point, and store the local coordinates of each surface point in the to-be-engraved region.
[0249] The processor 302 is further configured to establish the global coordinate system with the spherical center of the to-be-engraved model as the coordinate origin, and establish each local coordinate system based on the associated cube of the to-be-engraved model.
[0250] The processor 302 is further configured to obtain the global coordinates of each surface point of the to-be-engraved model, and convert the global coordinates of each surface point into local coordinates in the local coordinate system corresponding to each surface point according to the conversion relationship between the local coordinate system and the global coordinate system.
[0251] The embodiment of the present application also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps in each method embodiment.
[0252] The processor is configured to determine position information of each surface point of a to-be-engraved model in a virtual scene space.
[0253] Optionally, the to-be-engraved model is a spherical model.
[0254] The processor is configured to determine screen coordinates of a virtual focus in the graphical user interface in response to a selection instruction of the virtual focus.
[0255] The processor is configured to determine a to-be-engraved region of the to-be-engraved model and an engraving depth of each surface point in the to-be-engraved region according to the screen coordinates of the virtual focus and the position information of each surface point.
[0256] Optionally, the engraving depth is used to indicate a distance between the surface point and a spherical center of the to-be-engraved model.
[0257] The processor is configured to adjust the position information of each surface point in the to-be-engraved region according to the engraving depth to obtain an engraved spherical model.
[0258] The processor is further configured to determine a global coordinate of a target point corresponding to the virtual focus on the model to be engraved according to the screen coordinate of the virtual focus and the global coordinate in the position information of each surface point, determine the region to be engraved according to the global coordinate of the target point and preset region range information, and determine the engraving depth of each surface point in the region to be engraved according to the global coordinate of the target point and the target engraving parameter.
[0259] The processor is further configured to take the screen coordinate of the virtual focus as a ray origin coordinate, emit a ray in a preset direction, determine an intersection of the ray and the model to be engraved according to the global coordinate in the position information of each surface point and the ray, and determine the global coordinate of the target point according to the intersection of the ray and the model to be engraved.
[0260] The processor is further configured to determine that the target point does not exist in a case where the number of intersections is 0.
[0261] The processor is further configured to take the intersection as the target point and take the global coordinate of the intersection as the global coordinate of the target point in a case where the number of intersections is 1.
[0262] The processor is further configured to take the intersection closest to the coordinate of the position of the virtual focus as the target point and take the global coordinate of the intersection as the global coordinate of the target point in a case where the number of intersections is 2.
[0263] The processor is further configured to take the target point as a center point of the region to be engraved, determine a first distance of each surface point other than the target point to the target point according to the local coordinate in the position coordinate of the target point and the local coordinate of each surface point other than the target point, take the target point and the other surface points with a first distance to the target point satisfying the preset range information as surface points in the region to be engraved, and obtain the region to be engraved.
[0264] The processor is further configured to determine a second distance of each surface point in the region to be engraved to the target point along the surface of the model to be engraved according to the global coordinate of each surface point in the region to be engraved and the global coordinate of the target point, and determine the engraving depth according to the second distance and the target engraving parameter.
[0265] The processor is further configured to determine whether the second distance of each surface point in the region to be engraved to the target point is greater than or equal to a preset distance, determine the engraving depth of each surface point in the region to be engraved according to a first preset algorithm and the target engraving parameter in a case where the determination result is yes, and determine the engraving depth of each surface point in the region to be engraved according to a second preset algorithm and the target engraving parameter in a case where the determination result is no.
[0266] The processor is further configured to adjust global coordinates of each surface point in the to-be-engraved region based on the engraving depth.
[0267] The processor is further configured to convert the global coordinates of each surface point on the to-be-engraved model into local coordinates in a local coordinate system established based on a face of the associated cube corresponding to each surface point, respectively. The parameter information of the local coordinate system is inserted into the local coordinates of each surface point. The local coordinates of each surface point in the to-be-engraved region and the parameter information are stored.
[0268] The processor is further configured to determine whether the local coordinate systems corresponding to each surface point in the to-be-engraved region are the same, and if not, convert the local coordinates of each surface point in the to-be-engraved region into the local coordinate system corresponding to the target point, and store the local coordinates of each surface point in the to-be-engraved region.
[0269] The processor is further configured to establish the global coordinate system with the spherical center of the to-be-engraved model as the coordinate origin, and establish each local coordinate system based on the associated cube of the to-be-engraved model.
[0270] The processor is further configured to obtain the global coordinates of each surface point of the to-be-engraved model, and convert the global coordinates of each surface point into local coordinates in the local coordinate system corresponding to each surface point according to the conversion relationship between the local coordinate system and the global coordinate system.
[0271] Optionally, the present application also provides a program product, for example, a computer readable storage medium, comprising a program which, when executed by a processor, is configured to perform any of the above-mentioned spherical model engraving processing method embodiments.
[0272] In several embodiments provided in the present application, 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 units is only a logical function division. In actual implementation, another division mode can be used, for example, a plurality of units or components can be combined or integrated into another system, or some features can be omitted or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0273] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. they can be located in one place or distributed on a plurality of network units. According to actual needs, some or all of the units can be selected to achieve the purpose of the embodiment.
[0274] In addition, each function unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of hardware plus software function unit.
[0275] The integrated unit realized in the form of software function unit can be stored in a computer readable storage medium. The software function unit stored in a storage medium includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to execute part of the steps of the method of each embodiment of the present application. The foregoing storage medium includes a U disk, a mobile hard disk, a read-only memory (English: Read-Only Memory, for short: ROM), a random access memory (English: Random Access Memory, for short: RAM), a magnetic disk or an optical disk, and various program code storage media.
[0276] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of changes or replacements within the technical range disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
[0277] The above is only a preferred embodiment of the present application, and is not used to limit the present application. For those skilled in the art, the present application can have various changes and variations. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A method for sculpting a spherical model, characterized in that, The method includes providing a graphical user interface via a terminal, wherein the content displayed by the graphical user interface includes images of a virtual scene obtained by capturing a model in a virtual scene space; the method includes: Determine the position information of each surface point of the model to be sculpted in the virtual scene space, wherein the model to be sculpted is a spherical model; In response to a selection command for a virtual focus in the graphical user interface, determine the screen coordinates of the virtual focus; Based on the screen coordinates of the virtual focus and the position information of each surface point, the area to be sculpted of the model to be sculpted and the sculpting depth of each surface point in the area to be sculpted are determined. The sculpting depth is used to indicate the magnitude of adjustment required between the surface point and the center of the sphere of the model to be sculpted. The position information of each surface point in the area to be carved is adjusted according to the carving depth to obtain the carved spherical model; The step of determining the area to be sculpted in the model to be sculpted based on the screen coordinates of the virtual focus and the position information of each surface point includes: Based on the screen coordinates of the virtual focus and the global coordinates in the position information of each surface point, the global coordinates of the target point corresponding to the virtual focus on the model to be sculpted are determined. Using the target point as the center point of the area to be sculpted, a first distance from the target point to the other surface points is determined based on the local coordinates of the target point's position coordinates and the local coordinates of the other surface points besides the target point. The first distance is the straight-line distance between the target point and the other surface points in the local coordinate system, or the straight-line distance between the target point and each of the other surface points in the global coordinate system is used as the first distance from the other surface points to the target point. Other surface points whose first distance to the target point satisfies the preset area range information, along with the target point, are used as surface points in the area to be sculpted, thus obtaining the area to be sculpted.
2. The sculpting method for a spherical model as described in claim 1, characterized in that, The method further includes: The carving depth of each surface point in the area to be carved is determined based on the global coordinates of the target point and the target carving parameters.
3. The sculpting method for a spherical model as described in claim 2, characterized in that, The step of determining the global coordinates of the target point corresponding to the virtual focus on the model to be sculpted based on the screen coordinates of the virtual focus and the global coordinates in the position information of each surface point includes: Using the screen coordinates of the virtual focus as the starting coordinates of the ray, a ray is emitted in a preset direction, which is the same as the orientation of the center of the virtual camera lens. Based on the global coordinates in the position information of each surface point and the ray, determine the intersection point of the ray and the model to be sculpted; The global coordinates of the target point are determined based on the intersection of the ray and the model to be sculpted.
4. The sculpting method for a spherical model as described in claim 3, characterized in that, Determining the global coordinates of the target point based on the intersection of the ray and the model to be sculpted includes: If the number of intersections is 0, then the target point does not exist. If the number of intersection points is 1, then the intersection point is taken as the target point, and the global coordinates of the intersection point are taken as the global coordinates of the target point; If the number of intersection points is 2, then the intersection point closest to the location of the virtual focus is taken as the target point, and the global coordinates of the intersection point are taken as the global coordinates of the target point.
5. The sculpting method for a spherical model as described in claim 2, characterized in that, The step of determining the carving depth of each surface point in the area to be carved based on the global coordinates of the target point and the target carving parameters includes: Based on the global coordinates of the surface points in the area to be sculpted and the global coordinates of the target point, determine the second distance between the surface points in the area to be sculpted and the target point along the surface of the model to be sculpted; The carving depth is determined based on the second distance and the target carving parameters.
6. The sculpting method for a spherical model as described in claim 5, characterized in that, Determining the carving depth based on the second distance and the target carving parameters includes: Determine whether the second distance between each surface point in the area to be sculpted and the target point is greater than or equal to a preset distance; If so, the carving depth of each surface point in the area to be carved is determined according to the first preset algorithm and the target carving parameters; If not, the carving depth of each surface point in the area to be carved is determined according to the second preset algorithm and the target carving parameters.
7. The sculpting method for a spherical model as described in any one of claims 1-6, characterized in that, The step of adjusting the position information of each surface point in the area to be carved according to the carving depth includes: The global coordinates of each surface point in the area to be sculpted are adjusted based on the sculpting depth.
8. The sculpting method for a spherical model as described in any one of claims 1-6, characterized in that, The method further includes: The global coordinates of each surface point on the model to be sculpted are converted into local coordinates in a local coordinate system based on the faces of the associated cubes corresponding to each surface point. Insert the parameter information of the local coordinate system into the local coordinates of each of the surface points. The parameter information is used to indicate the face of the associated cube corresponding to the local coordinates of each of the surface points. Store the local coordinates and parameter information of each surface point in the area to be sculpted; After adjusting the position information of each surface point in the area to be sculpted according to the sculpting depth to obtain the sculpted spherical model, the method further includes: Determine whether the local coordinate systems corresponding to each surface point in the area to be sculpted are the same local coordinate system; If not, the local coordinates of each surface point in the area to be sculpted are transformed to the local coordinate system corresponding to the target point, and the local coordinates of each surface point in the area to be sculpted are stored.
9. The sculpting method for a spherical model as described in any one of claims 1-6, characterized in that, Before determining the position information of each surface point of the model to be sculpted in the virtual scene space, the method further includes: A global coordinate system is established with the center of the sphere of the model to be sculpted as the origin. Establish local coordinate systems based on the associated cube of the model to be sculpted; The planes formed by the first and second axes of each local coordinate system are parallel to each face of the associated cube of the model to be sculpted. There is a transformation relationship between each local coordinate system and the global coordinate system. The transformation relationship is used to indicate the angle between each axis of each local coordinate system and each axis of the global coordinate system.
10. The sculpting method for a spherical model as described in claim 9, characterized in that, Determining the position information of each surface point of the model to be sculpted in the virtual scene space includes: Obtain the global coordinates of each surface point of the model to be sculpted, wherein the global coordinates are used to indicate the position coordinates of each surface point in the global coordinate system; Based on the transformation relationship between the local coordinate system and the global coordinate system, the global coordinates of each surface point are converted into local coordinates in the local coordinate system corresponding to each surface point. The local coordinates are used to characterize the position coordinates of each surface point in the local coordinate system.
11. A carving processing device for a spherical model, characterized in that, The device provides a graphical user interface via a terminal, the content of which includes images of a virtual scene obtained by capturing a model in a virtual scene space. The device includes: The first determining module is used to determine the position information of each surface point of the model to be sculpted in the virtual scene space, wherein the model to be sculpted is a spherical model; The second determining module is used to determine the screen coordinates of the virtual focus in response to a selection instruction for the virtual focus in the graphical user interface. The third determining module is used to determine the area to be sculpted of the model to be sculpted and the sculpting depth of each surface point in the area to be sculpted based on the screen coordinates of the virtual focus and the position information of each surface point. The sculpting depth is used to indicate the magnitude of the adjustment required between the surface point and the center of the model to be sculpted. The processing module is used to adjust the position information of each surface point in the area to be carved according to the carving depth to obtain the carved spherical model; The third determining module is specifically used to determine the global coordinates of the target point corresponding to the virtual focus on the model to be sculpted based on the screen coordinates of the virtual focus and the global coordinates in the position information of each of the surface points; Using the target point as the center point of the area to be sculpted, a first distance from the target point to the other surface points is determined based on the local coordinates of the target point's position coordinates and the local coordinates of the other surface points besides the target point. The first distance is the straight-line distance between the target point and the other surface points in the local coordinate system, or the straight-line distance between the target point and each of the other surface points in the global coordinate system is used as the first distance from the other surface points to the target point. Other surface points whose first distance to the target point satisfies the preset area range information, along with the target point, are used as surface points in the area to be sculpted, thus obtaining the area to be sculpted.
12. A computer device, characterized in that, include: A memory and a processor, wherein the memory stores a computer program that can run on the processor, and when the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1 to 10.