Virtual scene construction method and device, electronic equipment and storage medium
The scene plane attributes of the virtual scene are determined through user input, and the boundary lines of the interaction area and the fitting connection area are split, which solves the problem of low efficiency in virtual scene construction in the existing technology, and realizes the rapid construction and efficient construction of virtual scenes.
Patent Information
- Application Number
- CN202510013221.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-04-11
AI Technical Summary
In the prior art, virtual scenes are constructed by artificially chunking, and the construction efficiency is low.
Through the user's first input, the properties of each scene plane in the virtual scene are determined, and the areas of the interaction object and the connection object are determined based on these properties. Split the interactive area into interactive units that meet the conditions, and fit the edge line of the interactive unit with the direction line of the connection area to obtain the fitted boundary line, and then merge the interactive area and connection area to build a virtual scene.
The rapid construction of virtual scenes is realized, and the construction efficiency is improved. Users can roughly screen out the interactive area and connection area through simple parameter adjustment or instruction information, and merge them to build a virtual scene.
Smart Images

Figure CN119792942A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of data processing, and more specifically, to a method, device, electronic device and storage medium for constructing a virtual scene. Background Art
[0002] With the rapid development of 3D modeling technology, 3D modeling can also be applied to the construction of virtual scenes in games. In order to increase the volume of the game, some large-capacity virtual scenes will be set up in the game, and these virtual scenes often need to be artificially divided into multiple virtual plots for players to occupy different virtual plots, deploy fortifications or cities, etc., but the construction efficiency of virtual scenes by artificial block construction is low. Summary of the invention
[0003] One purpose of the embodiments of the present disclosure is to provide a new technical solution for constructing a virtual scene.
[0004] According to a first aspect of the present disclosure, a method for constructing a virtual scene is provided, the method comprising:
[0005] Determining first attributes of each scene plane in the virtual scene based on a first input from a user;
[0006] Determine, according to the first attribute, an interactive area corresponding to the interactive object in the virtual scene and a connection area corresponding to the connection object in the virtual scene;
[0007] Setting the interactive area as an interactive unit that meets set conditions;
[0008] Fitting the edge line of the interaction unit with the trend line of the connection area to obtain a fitting boundary line;
[0009] A virtual scene is constructed according to the interaction unit, the connection area and the fitting boundary line.
[0010] In a possible implementation, the first input includes a feature map; and determining the first attribute of each scene plane in the virtual scene based on the first input of the user includes:
[0011] Based on the feature map input by the user, extracting a second attribute in a first color channel of the feature map and a third attribute in a second color channel of the feature map;
[0012] Determine that the second attribute is mapped to a fourth attribute of an interactive object in the virtual scene;
[0013] Writing the third attribute into the virtual scene, and obtaining the fifth attribute of the connection object in the virtual scene;
[0014] According to the fourth attribute and the fifth attribute, the first attribute of each scene plane in the virtual scene is obtained.
[0015] In a possible implementation, determining, according to the first attribute, an interactive area corresponding to the interactive object in the virtual scene and a connection area corresponding to the connection object in the virtual scene includes:
[0016] Filtering out, from each of the scene planes, a first small surface of a first attribute type corresponding to the first attribute and a first scene plane of a second attribute type corresponding to the first attribute;
[0017] Merging the first small surface and the first scene plane as an interactive area corresponding to the interactive object in the virtual scene;
[0018] In each of the scene planes, a second small face of a second attribute type corresponding to the first attribute and a second scene plane of a first attribute type corresponding to the first attribute are selected;
[0019] The second small surface and the second scene plane are merged and used as the connection area corresponding to the connection object.
[0020] In a possible implementation manner, the set condition includes at least one of the number of the interaction units being within a set number range and the area of the interaction units being within a set area range.
[0021] In a possible implementation, the edge line of the interaction unit is fitted with the trend line of the connection area to obtain a fitted boundary line. Before obtaining the fitted boundary line, the method further includes:
[0022] Determining a first edge point group corresponding to the interaction unit;
[0023] Determining an edge line of the interaction unit according to the first edge point group;
[0024] Determining a second edge point group corresponding to the connection area;
[0025] The direction line of the connection area is determined according to the position information of the second edge point group.
[0026] In a possible implementation, the step of fitting the edge line of the interaction unit with the trend line of the connection area to obtain a fitting boundary line includes:
[0027] determining a first position and a first normal of the edge line;
[0028] Adsorbing the edge line along the first normal line and the strike line to each other to obtain a second position of the edge line after adsorption;
[0029] A fitting boundary line is obtained according to the interpolation of the first position and the second position.
[0030] In a possible implementation, the first data of each of the interactive areas in the constructed virtual scene are stored separately, and the method further includes:
[0031] In response to the preview instruction of the interactive area, reading the first data of each of the interactive areas;
[0032] According to the first data, the interaction areas are combined to generate a preview screen;
[0033] A preview screen is shown.
[0034] According to a second aspect of the present disclosure, a device for constructing a virtual scene is also provided, the device comprising:
[0035] A first determining module, used to determine a first attribute of each scene plane in the virtual scene based on a first input of a user;
[0036] A second determining module, configured to determine, according to the first attribute, an interactive area corresponding to the interactive object in the virtual scene and a connection area corresponding to the connection object in the virtual scene;
[0037] A setting module, used for setting the interaction area to an interaction unit that meets set conditions;
[0038] An obtaining module, used for fitting the edge line of the interaction unit with the trend line of the connection area to obtain a fitting boundary line;
[0039] A construction module is used to construct a virtual scene according to the interaction unit, the connection area and the fitting boundary line.
[0040] According to a third aspect of the present disclosure, a computer system is also provided, the computer system includes a processor, when the processor executes a program instruction or code, the computer system implements the game scene control method in the first aspect. Exemplarily, the computer system also includes a memory, the memory is used to store the program instruction or code.
[0041] According to a fourth aspect of the present disclosure, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned virtual scene construction method when running.
[0042] According to a fifth aspect of the present disclosure, there is also provided a computer program product, comprising a game program, wherein when the game program is executed, the computer executes the steps of the above-mentioned method for constructing a virtual scene.
[0043] According to a sixth aspect of the present disclosure, there is also provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the virtual scene construction method through the computer program.
[0044] One beneficial effect of the embodiments of the present disclosure is that the method for constructing a virtual scene provided by the embodiments of the present disclosure can determine the first attribute of each scene plane in the virtual scene according to the first input of the user, and determine the interaction area of the interactive object and the connection area of the connection object in the virtual scene according to the first attribute. Then the interaction area is split into interaction units that meet the conditions, the edge line of the interaction unit and the trend line of the connection area are fitted to obtain a fitting boundary line, and the interaction area and the connection area are merged according to the fitting boundary line to construct a virtual scene. In other words, through the user's simple parameter adjustment or instruction information, the interaction area and the connection area in the virtual scene are roughly screened out, and then the interaction area is split into multiple interaction units that can be operated by the user, and the edges of each interaction unit and the adjacent connection area are fitted into a fitting boundary line, thereby realizing the rapid construction of the virtual scene, and effectively improving the construction efficiency of the virtual scene.
[0045] Features and advantages of the embodiments of the present specification will become apparent from the following detailed description of exemplary embodiments of the present specification with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the specification and, together with the description, serve to explain the principles of the embodiments of the specification.
[0047] Figure 1 A schematic diagram of the hardware structure of an electronic device that can be used to implement the method for constructing a virtual scene according to an embodiment of the present disclosure is shown;
[0048] Figure 2 A schematic diagram showing a flow chart of a method for constructing a virtual scene according to some embodiments;
[0049] Figure 3 A schematic diagram showing the structure of a virtual scene according to some embodiments is shown;
[0050] Figure 4 A schematic structural diagram of a device for constructing a virtual scene according to some embodiments is shown;
[0051] Figure 5 A schematic diagram of the hardware structure of an electronic device according to some embodiments is shown. DETAILED DESCRIPTION
[0052] Various exemplary embodiments of the present specification will now be described in detail with reference to the accompanying drawings.
[0053] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the embodiments of the present specification and its application or uses.
[0054] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0055] It should be noted that all actions of acquiring signals, information or data in the embodiments of the present disclosure are performed in compliance with the corresponding data protection laws and policies of the country where the device is located, and with the authorization given by the owner of the corresponding device.
[0056] The disclosed embodiment provides a new virtual scene construction scheme, which allows the user to roughly screen out the interaction areas and connection areas in the virtual scene through simple parameter adjustment or command information, and then split the interaction areas into multiple interaction units that can be operated by the user, and fit each interaction unit to the edge of the adjacent connection area into a fitting boundary line, thereby realizing the rapid construction of the virtual scene and effectively improving the construction efficiency of the virtual scene.
[0057] Figure 1 A schematic diagram of the hardware structure of an electronic device that can be used to implement the method for constructing a virtual scene according to an embodiment of the present disclosure is shown.
[0058] The electronic device 1000 is a device capable of running games, i.e., a game client. The game may be a local application installed on the electronic device, or a web game, a light application, or a small program, etc., which is not limited here. The electronic device 1000 may be a mobile phone, a tablet computer, a PC, etc., which is not limited here.
[0059] like Figure 1 As shown, the electronic device 1000 may include a processor 1101, a memory 1102, an interface device 1103, a communication device 1104, an output device 1105, an input device 1106, and the like. Figure 1 The hardware configuration shown is merely illustrative and is in no way intended to limit the present disclosure, its application, or uses.
[0060] The processor 1101 is used to execute a computer program, which can be written in an instruction set of an architecture such as x86, Arm, RISC, MIPS, SSE, etc. The memory 1102 includes, for example, ROM (read-only memory), RAM (random access memory), a non-volatile memory such as a hard disk, etc. The interface device 1103 includes, for example, a USB interface, a network cable interface, a headphone interface, etc. The communication device 1104 is capable of wired or wireless communication, for example, and the communication device 1104 may include at least one short-range communication module, for example, any module for short-range wireless communication based on short-range wireless communication protocols such as Hilink protocol, WiFi (IEEE 802.11 protocol), Mesh, Bluetooth, ZigBee, Thread, Z-Wave, NFC, UWB, LiFi, etc. The communication device 1104 may also include a remote communication module, for example, any module for WLAN, GPRS, 2G / 3G / 4G / 5G remote communication. The output device 1105 may include, for example, a liquid crystal display or a touch display, a speaker, etc. The input device 1106 may include, for example, a touch screen, a keyboard, a microphone, various sensors, etc.
[0061] In this embodiment, the memory 1102 of the electronic device 1000 is used to store a computer program, and the computer program is used to control the processor 1101 to operate so as to execute the method for constructing a virtual scene according to any embodiment of the present disclosure.
[0062] Next, Figure 1 Taking the electronic device 1000 as an example of an implementation subject, various embodiments of the method for constructing a virtual scene are described.
[0063] <First Embodiment>
[0064] Figure 2 A method for constructing a virtual scene according to some embodiments is shown. The method for constructing a virtual scene may include the following steps S210 to S250:
[0065] Step S210: determining a first attribute of each scene plane in the virtual scene based on a first input from a user.
[0066] In this embodiment, the virtual scene can be constructed based on three-dimensional computer image software such as Houdini, Maya, Cinema 4D, etc.
[0067] In this embodiment, the virtual scene may be composed of multiple scene planes, such as a 50×50 scene plane, a 100×200 scene plane, or a 500×1000 scene plane. In addition, each scene plane in the virtual scene has a first attribute, which can be divided into an interactive attribute corresponding to an interactive object and a connection attribute corresponding to an interactive object. When the first attribute of a scene plane is an interactive attribute, the scene plane can be interactively operated by the player. For example, if the first attribute of scene plane A1 is an interactive attribute, then the player's virtual character can move to the scene plane A1. When the first attribute of a scene plane is a connection attribute, the scene plane is the plane where at least a part of a decoration or obstacle is located. For example, if the first attribute of scene plane A2 is a connection attribute and the scene plane A2 is the plane where a part of the decoration is located, then the player's virtual character can only pass through the scene plane A2.
[0068] Step S220: determining, according to the first attribute, an interactive area corresponding to the interactive object in the virtual scene and a connection area corresponding to the connection object in the virtual scene.
[0069] In some examples, such as Figure 3 As shown, the interactive object is a plot of land, then the interactive area corresponding to one of the interactive objects is, for example, the interactive area LT, and the connection object is a mountain, and the connection area corresponding to one of the connection objects is, for example, the connection area R1.
[0070] Step S230: setting the interactive area to an interactive unit that meets the set conditions.
[0071] In some embodiments, in order to maintain the occupied space of the virtual scene within a reasonable range, the set condition includes at least one of the number of interaction units being within a set number range and the area of the interaction units being within a set area range.
[0072] In this embodiment, the set number range is, for example, 30-50, 100-120 or 200-300, and the set area range is, for example, 2-5 scene planes, 5-8 scene planes or 10-15 scene planes.
[0073] In some examples, for the interaction area to be split into interaction units within a set number range, a preset Python processing script can be used, which can automatically adjust the parameters of the interaction area Cluster node and keep the number of effective blocks of the interaction area Cluster at 100, that is, the interaction area is split into 100 blocks. The automatic adjustment parameters here are generally adjusted by determining the seed and the step.
[0074] In some examples, the interaction area is split into interaction units within a set number range, specifically: 3.1 Use the null node as the node for external Python to get attributes; 3.2 Use the attribdelete node to delete unnecessary attributes; 3.3 Use the clusterpoints node to split the interaction area into interaction units; 3.4 Use the attribtransfer1 node to transfer necessary attributes for subsequent operations; 3.5 Use the split node, attribwrangle1 node, and attribwrangle2 node to separate the connection area from the interaction unit and count the number of blocks, and Python checks whether it can be output; 3.6 Use the blast node to remove mountains and rivers, and use the attribtransfer node to transfer the attribute data of the interaction unit to the original interaction area and output it.
[0075] Step S240, fitting the edge line of the interaction unit and the trend line of the connection area to obtain a fitting boundary line.
[0076] In this embodiment, the trend line of the connection area can be the center line of the connection area, and the fitting boundary line can be a specific line between the edge line and the trend line, and the first relative distance between the specific line and the edge line is equal to or in a certain proportion to the second relative distance between the specific line and the trend line.
[0077] Step S250, constructing a virtual scene according to the interactive units, the connection areas and the fitted boundary lines.
[0078] In this embodiment, the interactive units and the connection areas are merged according to the fitted boundary lines to construct a virtual scene.
[0079] According to the method for constructing a virtual scene of the first embodiment of the present invention, the problem of low construction efficiency in the prior art of constructing a virtual scene by artificially dividing blocks is solved. Based on this method, the first attribute of each scene plane in the virtual scene can be determined according to the first input of the user, and the interaction area of the interactive object and the connection area of the connection object in the virtual scene can be determined according to the first attribute. Then the interaction area is split into interaction units that meet the conditions, the edge line of the interaction unit and the trend line of the connection area are fitted to obtain a fitting boundary line, and the interaction area and the connection area are merged according to the fitting boundary line to construct a virtual scene. In other words, through the user's simple parameter adjustment or instruction information, the interaction area and the connection area in the virtual scene are roughly screened out, and then the interaction area is split into multiple interaction units that can be operated by the user, and the edges of each interaction unit and the adjacent connection area are fitted into a fitting boundary line, thereby realizing the rapid construction of the virtual scene, and effectively improving the construction efficiency of the virtual scene. .
[0080] <Second Embodiment>
[0081] In this embodiment, in order to improve the processing effect of determining the first attribute of each scene plane, the first input includes a feature map, through which the attribute information of the interactive object and the connection object is set in the same feature map, so that the fourth attribute of the interactive object and the fifth attribute of the connection object can be determined.
[0082] In these embodiments, relative to the first embodiment, before step S220, the method further includes the following steps S310 to S340:
[0083] Step S310: extracting a second attribute in a first color channel of the feature map and a third attribute in a second color channel of the feature map based on the feature map input by the user.
[0084] In this embodiment, the feature map is, for example, a mask image, the first color channel of the feature map is, for example, an R channel of the mask image, and the second color channel of the feature map is, for example, a G channel of the mask image.
[0085] Step S320: Determine that the second attribute is mapped to a fourth attribute of the interactive object in the virtual scene.
[0086] In this embodiment, the second attribute is, for example, a value between 0 and 1, and the fourth attribute is, for example, a value between 0 and 255 and represents a color.
[0087] Step S330, writing the third attribute into the virtual scene, and obtaining the fifth attribute of the connection object in the virtual scene.
[0088] In this embodiment, the third attribute of the second color channel of the feature map is written into the point attribute of the grid of the virtual scene, and this attribute is named Mountain, River, that is, the fifth attribute.
[0089] Step S340: Obtain the first attribute of each scene plane in the virtual scene according to the fourth attribute and the fifth attribute.
[0090] In some examples, to obtain the first attribute of each scene plane in the virtual scene, it can be: 1.1 Use the grid node to provide a carrier for subsequent calculations; 1.2 Use the attrib from map node to write the information of the R channel in the mask image into the point attribute of the grid, and name this attribute Land; 1.3 Use the attrib wrangle node to map the value range of the second attribute to the value range of the fourth attribute, that is, the numerical space of 0-1 is mapped to the color space of 0-255. 1.4 Use the attrib promote node to transform the second attribute from a point-level attribute to a Primitive-level attribute. 1.5 Use the blast node to delete the primitives with Land < 1.1 to obtain the polygon structure corresponding to the R channel in the mask image. 1.6 Use a for loop to traverse all primitives and clean up the erroneous primitive data caused by pixel errors; 1.7 Use the attrib promote node to transform the second attribute from a surface-level attribute to a Detail-level attribute. 1.8 Use the attrib wrangle node to align the second attribute with the color scale map number; 1.9 Use the attribute node to rename the second attribute to ToPython, which will be used as the number of loops in the subsequent python script; 1.10 Use the SinglePass node of foreach to traverse each interaction area, processing only one interaction area at a time. 1.11 Use the grid3 and grid4 nodes to provide a carrier for subsequent calculations; 1.12 Use the attrib rom map3 and attrib from map4 nodes to write the information of the G channel in the mask image into the point attribute of the grid, and name this attribute Mountain, River. 1.13 Use the attribtranster1 and attribtranster2 nodes to transfer the attributes to the current interaction area; 1.14 Use the attrib promote node to promote the Mountain and River attributes to the surface.
[0091] <Third Embodiment>
[0092] In this embodiment, in order to reduce the existence of small surfaces in the virtual scene and ensure that the area of each interactive unit is moderate, small surfaces with different attribute types and scene planes can be merged to obtain interactive areas and connection areas with moderate areas.
[0093] In these embodiments, relative to the first embodiment, step S220 may include the following steps S410 to S440:
[0094] Step S410 , in each scene plane, select a first small surface whose first attribute corresponds to a first attribute type and a first scene plane whose first attribute corresponds to a second attribute type.
[0095] In some examples, the first attribute type is a mountain river type, and the second attribute type is a land surface type.
[0096] Step S420: merge the first small surface and the first scene plane and use them as the interaction area corresponding to the interaction object in the virtual scene.
[0097] Step S430: In each scene plane, select a second small surface whose first attribute corresponds to a second attribute type and a second scene plane whose first attribute corresponds to a first attribute type.
[0098] Step S440: merge the second small surface and the second scene plane and use them as the connection area corresponding to the connection object.
[0099] In some examples, for the first small face and the first scene plane to be merged and the second small face and the second scene plane to be merged, it can be: 2.1 Use the distance_from_border1 node to take a value from 1 to 0 from the model center to the edge of the interaction area; 2.2 Use the group node to mark the edge points; 2.3 Use the attributeWrangle node to clear the Mountain and River attributes of the marked edge points; 2.4 Use the Split node to separate the faces with mountain attributes from those without mountain attributes; 2.5 Use the Split node to separate the faces with River attributes from those without River attributes; 2.6 Use the merge node to merge the faces with River and Mountain attributes into one level; 2.7 Use the remove unconnectedpoints1 node to remove a single point that does not intersect any face; 2.8 Use the delete small face node to remove the single point that does not intersect any face; The parts1 node marks the first small face in the face with mountain and river attributes; 2.9. Use blast1 and blast2 nodes to separate the marked first small face from other faces; 2.10 Use clean to clear the attributes of other faces except the first small face;
[0100] 2.11 Use attrib transfer1 and attrib transfer2 to transfer the Mountain LandRiver class attribute of the merge node to the first small face and other faces except the first small face; 2.12 Use the merge2 node to merge the first small face with Mountain attribute and River attribute with the face without River attribute and the face without Mountain attribute; 2.13 Use the fuse node to merge multiple points at the same position into one point; 2.14 Use the delete small face node to merge the first small face with Mountain attribute and River attribute into one point; The parts1 node marks the second smallest face in the face without mountain and river attributes; 2.15 Use the split3 node to separate the marked face from the unmarked face; 2.16 Use the merge node to merge the marked points with the face with mountain and river attributes; 2.17 Use the attrubwrangle node to give the interaction area LS attribute, all 1; 2.18 Use the measure1 node to measure the area of the interaction area; 2.19 Use the attribwrangle2 node to change the river attribute to 1; 2.20 Use the attribwrangle2 node to change the mountain attribute to 1; 2.21 Use the fuse2 node to merge multiple points at the same position into one point; 2.22 Use the merge4 node to merge all faces; 2.23 Use the fuse3 node to merge multiple points at the same position into one point;
[0101] 2.24 Use the MountainAppend module to process the interactive area again. 1 inputs the geometry of the mountain and the river, and 2 inputs the entire interactive area. 2.24.1 Use the group2 node to select the edges of the mountain and the river. 2.24.2 Use the box1 node to select the bindingbox of the entire interactive area, and use the heightfield1 node to simulate the entire map. 2.24.3 Use the heightfield_cutoutbyobject1 node to cut the virtual scene to the bindingbox size of the current interactive area. 2.24.4 Use the heightfield_maskbyobject1 node to project the geometry of the mountain and the river into the virtual scene in the form of a mask. 2.24.5 Use the heightfield_maskexpand1 node to expand the mask outward. 2.24.6 Use the heightfield_maskexpand2 node to shrink the mask inward. 2.24.7 Use the heightfield1 node to convert the heightfield1 node into a virtual scene. ightfield is converted into geometry; 2.24.8 Use the blast1 node to retain only the geometry with the original mask attributes; 2.24.9 Use the polyextrude2 node to extrude the retained geometry; 2.24.10 Use the center2 node to align the world y-axis to the center of the model; 2.24.11 Use the group node to select the modified mountain and river mask in the interactive area using the geometry with the original mask attributes; 2.24.12 Use the attribwrangle7 node to reassign the selected points to the Mountain attribute; 2.24.13 Use the attribdelete1 node to clean up the redundant attributes; 2.24.14 Use the grouppromote2 node to promote the group4 point group to the face group; 2.24.15 Use the attribwrangle6 node to reassign the group4 face group to the Mountain attribute; 2.25 Use the blast node to retain only the modified mountain geometry; 2.26 Use the attribtransfer3 node to transfer the mountain attribute to the point.
[0102] <Fourth Embodiment>
[0103] In this embodiment, in order to achieve a smooth boundary line between the interaction unit and the connection area to enhance the viewing effect of the virtual scene, the edge line of the interaction unit is determined by the first edge point group of the interaction unit, and the direction line of the connection area is determined by the second edge point group of the connection area.
[0104] In these embodiments, relative to the first embodiment, after step S240, the method further includes the following steps S510 to S540:
[0105] Step S510: determine the first edge point group corresponding to the interaction unit.
[0106] Step S520: determining the edge line of the interaction unit according to the first edge point group.
[0107] In some examples, for determining the edge lines of the interaction units, it can be: 5.1 Use group5, group3 nodes to mark the edge lines of the interaction units; 5.2 Use grouppromote1, grouppromote2 nodes to promote the first edge point from the line level to the point; 5.3 Use the fuse node to merge the interaction units at the nearest point; 5.4 Use the convertline3 node to convert all faces into lines; 5.5 Use the resample1 node to resample the faces; 5.6 Use the grouptransfer2 node to transfer group3 to the points; 5.7 Use group6, groupcombine2 nodes to deselect points as group4 output; 5.8 Use foreach_begin1--foreach_end1 to make a loop, and use group2, convertline2, attribtransfer1 nodes to convert faces into lines one by one; 5.9 Use the grouptransfer1 node to transfer the previous group to the line; 5.10 Use group4, groupcombine1 nodes to deselect points as group4 output.
[0108] Step S530: determine the second edge point group corresponding to the connection area.
[0109] Step S540: determining the direction line of the connection area according to the position information of the second edge point group.
[0110] In some examples, to determine the trend line of the connection area, it can be: 6.1 Use the clean node to clear other attributes; 6.2 Use the delete_small_parts1 node to clear unnecessary hills; 6.3 Use the fuse node to merge the vertices of the connection area nearby; 6.4 Use the connectivity1 node to separate the mountain geometry by continuity; 6.5 Use foreach_begin1--foreach_end1 to traverse the geometry continuity by continuity; 6.6 Use the group node to select the second edge point group; 6.7 Use the convertline node to extract the edge line as a curve; 6.8 Use the polyfill node to re-cover the edge line; 6.9 Use the measure1 node to measure the area of the face; 6.10 Use the blast node to delete the face with an area of 0; 6.11 Use the straight_skeleton_2D2 node to find the center line of the current front as the trend line of the connection area; 6.12 Use the fuse node to clean up the overlapping points.
[0111] In some examples, before determining the edge line of the interaction unit, the method also includes reorganizing the interaction units of the interaction area. For determining the interaction units of the interaction area, the specific steps are: 4.1 Use the attribpromote3 node to promote the cluster attribute from point to surface, so as to prepare the conditions for breaking and combining the "cluster" surfaces one by one; 4.2 Use the foreach_begin2--foreach_end2 nodes to create a loop, breaking and combining the "cluster" surfaces one by one; 4.3 Use the group5 node to select the edge of the current loop geometry; 4.4 Use the convertline node to convert the edge of the geometry to a curve; 4.5 Use remove unconnected Use the points1 node to delete redundant points; 4.6 use the polyfill1 node to seal the curve; 4.7 use the blast node to delete the original curve; 4.8 use the attribtransfer1 node to transfer the original attributes to the newly generated surface; 4.9 use the attribpromote2 node to promote the Cd attribute to the surface attribute; 4.10 use the attribtransfer2 node to transfer the cluster attribute to the newly generated surface; 4.11 use the measure node to calculate the area of each block; 4.12 use the blast2 node to delete the surfaces with an area less than 2.
[0112] <Fifth Embodiment>
[0113] In this embodiment, in order to obtain a fitting boundary line with a moderate position, the edge line of the interactive unit is adsorbed to each other along its normal and the strike line, and the second position of the edge line after adsorption is determined. Then, the first position and the second position of the edge line are interpolated to obtain the fitting boundary line.
[0114] In these embodiments, relative to the fourth embodiment, after step S240, the method further includes the following steps S610 to S630:
[0115] Step S610, determining a first position and a first normal line of an edge line.
[0116] Step S620 , adsorbing the edge line along the first normal line and the strike line to obtain a second position of the edge line after adsorbing.
[0117] Step S630, obtaining a fitting boundary line according to the interpolation of the first position and the second position.
[0118] In some examples, to get the fitted boundary line, it can be: 7.1 null node is meaningless, used for debugging, and can be ignored; 7.1 Use fuse node to merge overlapping points; 7.2 Use polyframe node to assign the first normal to the point; 7.3 Use ray1 node to adsorb the edge line along the first normal to the mountain curve; 7.4 Use ray2 node to adsorb the edge line along the first normal to the mountain curve in the opposite direction; 7.5 Use attribtransfer1 node to transfer the position attribute to the unmodified vertex; 7.6 Use blendshapes1 node to interpolate the coordinates of the point before and after the position is modified; 7.7 Use fo Use the node reach_begin1--foreach_end1 to create a loop for each face; 7.8 Use the node fuse to merge overlapping points; 7.9 Use the node convertline1 to unify primitives; 7.10 Use the node polyfill1 to convert curves into faces; 7.11 Use the node attribpromote1 to promote the Cd attribute to detail; 7.12 Use the node attribpromote1 to promote the Cd attribute to primitives; 7.13 Use the node attribtransfer5 to transfer the attribute to the original primitive ive; 7.14 Use the measure1 node to measure the area of the patch; 7.15 Use the blast1 node to delete the primitive with an area of 0; 7.16 Use the boolean node to subtract the area of the block from the area of the mountain; 7.17 Use the foreach_begin2--foreach_end node 2 to create a cluster-by-cluster loop; 7.18 Use the delete_small_parts1 node to clear the excess points; 7.19 Use the attribpromote5 node to promote the class to the detail level; 7.20 Use the connectivity2 node Node tests its continuity; 7.21 Use attribwrangle2 node to find the number of vertices; 7.22 Use blast3 node to delete faces whose class is not equal to 0; 7.23 Use attribwrangle3 node to determine whether the front and back areas are consistent; 7.24 Use attribtransfer3 node to transfer the result to the unmodified face; 7.25 Use attribpromote6 node to transfer the result to the surface level; 7.26 Use group1 node to mark the problematic faces; 7.27 Use attribtransfer4 node to transfer the result to the unmodified mesh.
[0119] <Sixth Embodiment>
[0120] In this embodiment, in order to reduce the overall storage space occupied by the virtual scene while providing a preview screen of the interactive object, the first data of each interactive area in the constructed virtual scene is stored separately, and when the user needs to preview the interactive area, the various interactive areas can be called up to combine and generate a corresponding preview screen.
[0121] In these embodiments, relative to the first embodiment, after step S250, the method further includes the following steps S710 to S730:
[0122] Step S710, in response to a preview instruction of the interactive area, reading first data of each interactive area.
[0123] In this embodiment, the preview instruction may be triggered by the user, and after the preview instruction is triggered, the first data of each interactive area can be read.
[0124] Step S720: combining the various interactive areas according to the first data and generating a preview screen.
[0125] In this embodiment, the preview screen may be a virtual scene including only one or more interactive areas, or may be a virtual scene including an interactive area and a connection area.
[0126] Step S730: display the preview screen.
[0127] In some examples, for displaying the preview screen, it can be: 8.1 The Drive node is used to drive the entire workflow to perform calculations on each interactive area, indicating the current running status, and pressing LoopStart will start it; 8.2 The FileCreate node is used to read the generated first data and output a path group for the downstream node to facilitate search by color scale; 8.3 FileCreateMountain is used to read the generated second data about the connection area and output a path group for the downstream node to facilitate search by color scale.
[0128] <Device Example>
[0129] Figure 4 FIG. 2 shows a schematic diagram of the composition structure of a device for constructing a virtual scene according to an embodiment of the present disclosure. Figure 4 As shown, the virtual scene construction device 400 includes a first determination module 410 , a second determination module 420 , a setting module 430 , an obtaining module 440 and a construction module 450 .
[0130] The first determination module 410 is used to determine a first attribute of each scene plane in the virtual scene based on a first input of a user;
[0131] The second determination module 420 is used to determine the interaction area corresponding to the interaction object in the virtual scene and the connection area corresponding to the connection object in the virtual scene according to the first attribute;
[0132] The setting module 430 is used to set the interactive area to an interactive unit that meets the set conditions;
[0133] The obtaining module 440 is used to perform fitting processing on the edge line of the interaction unit and the trend line of the connection area to obtain a fitting boundary line;
[0134] The construction module 450 is used to construct a virtual scene according to the interactive units, the connection areas and the fitting boundary lines.
[0135] In some embodiments, the first determination module 410 is also used to extract the second attribute in the first color channel of the feature map and the third attribute in the second color channel of the feature map based on the feature map input by the user; determine the fourth attribute of the second attribute mapped to the interactive object in the virtual scene; write the third attribute into the virtual scene and obtain the fifth attribute of the connecting object in the virtual scene; and obtain the first attribute of each scene plane in the virtual scene according to the fourth attribute and the fifth attribute.
[0136] In some embodiments, the second determination module 420 is also used to screen out, in each scene plane, a first small face of a first attribute corresponding to a first attribute type and a first scene plane of a second attribute corresponding to the first attribute; merge the first small face and the first scene plane and use them as the interaction area corresponding to the interactive object in the virtual scene; and screen out, in each scene plane, a second small face of a first attribute corresponding to the second attribute type and a second scene plane of the first attribute corresponding to the first attribute type; merge the second small face and the second scene plane and use them as the connection area corresponding to the connection object.
[0137] In some embodiments, the virtual scene construction device 400 also includes a third determination module, which is used to determine the first edge point group corresponding to the interaction unit; determine the edge line of the interaction unit based on the first edge point group; determine the second edge point group corresponding to the connection area; and determine the direction line of the connection area based on the position information of the second edge point group.
[0138] In some embodiments, the obtaining module 440 is also used to determine the first position and the first normal of the edge line; adsorb the edge line along the first normal and the strike line to obtain the second position of the edge line after adsorption; and obtain the fitting boundary line based on the interpolation of the first position and the second position.
[0139] In some embodiments, the virtual scene construction device 400 also includes a display module, which is used to respond to the preview instruction of the interaction area, read the first data of each interaction area; combine the various interaction areas according to the first data and generate a preview screen; and display the preview screen.
[0140] <Equipment Embodiment>
[0141] Figure 5 FIG. 1 shows a schematic diagram of the hardware structure of an electronic device according to some other embodiments. Figure 5 As shown, the electronic device 500 includes a processor 510 and a memory 520, wherein the memory 520 is used to store a computer program, and the computer program is used to control the processor 510 to operate so as to control the electronic device 500 to execute the method for constructing a virtual scene according to any embodiment of the present disclosure.
[0142] The embodiments of the present disclosure further provide a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the method for constructing a virtual scene according to any embodiment of the present disclosure is implemented.
[0143] The disclosed embodiment also provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, a method for constructing a virtual scene according to any disclosed embodiment is implemented. The computer program product is, for example, a game client.
[0144] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and equipment embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0145] The above is a description of a specific embodiment of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0146] The embodiments of the present specification may be devices, methods and / or computer program products. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the embodiments of the present specification.
[0147] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0148] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0149] The computer program instructions for executing the operation of the embodiments of this specification may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or the first code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, executed as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of a computer-readable program instruction, and the electronic circuit may execute a computer-readable program instruction, thereby realizing various aspects of the embodiments of this specification.
[0150] Various aspects of the embodiments of the present specification are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (equipment) and computer program products according to the embodiments of the present specification. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0151] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0152] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0153] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of this specification. In this regard, each box in the flowchart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart can be implemented by a dedicated hardware-based system that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. It is well known to those skilled in the art that it is equivalent to implement it by hardware, implement it by software, and implement it by combining software and hardware.
[0154] The embodiments of the present specification have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations are obvious to those of ordinary skill in the art without departing from the scope of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for constructing a virtual scene, the method comprising: Determining first attributes of each scene plane in the virtual scene based on a first input from a user; Determine, according to the first attribute, an interactive area corresponding to the interactive object in the virtual scene and a connection area corresponding to the connection object in the virtual scene; Setting the interactive area as an interactive unit that meets set conditions; Fitting the edge line of the interaction unit with the trend line of the connection area to obtain a fitting boundary line; A virtual scene is constructed according to the interaction unit, the connection area and the fitting boundary line.
2. The method according to claim 1, wherein: The first input includes a feature map; and determining the first attribute of each scene plane in the virtual scene based on the first input of the user includes: Based on the feature map input by the user, extracting a second attribute in a first color channel of the feature map and a third attribute in a second color channel of the feature map; Determine that the second attribute is mapped to a fourth attribute of an interactive object in the virtual scene; Writing the third attribute into the virtual scene, and obtaining the fifth attribute of the connection object in the virtual scene; According to the fourth attribute and the fifth attribute, the first attribute of each scene plane in the virtual scene is obtained.
3. The method according to claim 1, wherein: The determining, according to the first attribute, an interactive area corresponding to the interactive object in the virtual scene and a connecting area corresponding to the connecting object in the virtual scene includes: Filtering out, from each of the scene planes, a first small surface of a first attribute type corresponding to the first attribute and a first scene plane of a second attribute type corresponding to the first attribute; Merging the first small surface and the first scene plane as an interactive area corresponding to the interactive object in the virtual scene; In each of the scene planes, a second small face of a second attribute type corresponding to the first attribute and a second scene plane of a first attribute type corresponding to the first attribute are selected; The second small surface and the second scene plane are merged and used as the connection area corresponding to the connection object.
4. The method according to claim 1, wherein: The set condition includes at least one of the number of the interaction units being within a set number range and the area of the interaction units being within a set area range.
5. The method according to claim 1, wherein: The edge line of the interaction unit is fitted with the trend line of the connection area to obtain a fitted boundary line. Before obtaining the fitted boundary line, the method further includes: Determining a first edge point group corresponding to the interaction unit; Determining an edge line of the interaction unit according to the first edge point group; Determining a second edge point group corresponding to the connection area; The direction line of the connection area is determined according to the position information of the second edge point group.
6. The method according to claim 5, wherein: The step of fitting the edge line of the interaction unit with the trend line of the connection area to obtain a fitting boundary line includes: determining a first position and a first normal of the edge line; Adsorbing the edge line along the first normal line and the strike line to each other to obtain a second position of the edge line after adsorption; A fitting boundary line is obtained according to the interpolation of the first position and the second position.
7. The method according to claim 1, wherein: The first data of each interactive area in the constructed virtual scene is stored separately, and the method further includes: In response to the preview instruction of the interactive area, reading the first data of each of the interactive areas; According to the first data, the interaction areas are combined to generate a preview screen; A preview screen is shown.
8. A device for constructing a virtual scene, wherein: The device comprises: A first determining module, used to determine a first attribute of each scene plane in the virtual scene based on a first input of a user; A second determining module, configured to determine, according to the first attribute, an interactive area corresponding to the interactive object in the virtual scene and a connection area corresponding to the connection object in the virtual scene; A setting module, used for setting the interaction area to an interaction unit that meets set conditions; An obtaining module, used for fitting the edge line of the interaction unit with the trend line of the connection area to obtain a fitting boundary line; A construction module is used to construct a virtual scene according to the interaction unit, the connection area and the fitting boundary line.
9. An electronic device, wherein: The method comprises a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to execute the method steps according to any one of claims 1 to 7 under the control of the computer program.
10. A computer-readable storage medium, the computer-readable storage medium comprising a stored computer program, wherein: When the computer program is executed, the method steps of any one of claims 1 to 7 are performed.