Game scene resource generation method and device
By baking the top view single-channel height map and the height color value update of the operation control, the problem of high resource consumption in the falling snow and rain areas in the existing technology is solved, and efficient game scene resource generation is achieved, reducing human and material resource consumption is reduced. , improves the production efficiency and fidelity of the game scene.
Patent Information
- Application Number
- CN202311652876.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-05
- Publication Date
- 2025-01-10
AI Technical Summary
When the prior art distinguishes between falling snow and falling rain areas and unsnow and unsnow areas, adding the vertex color of the shading model will lead to an increase in system memory consumption and require a large amount of manpower and material resources, resulting in production errors and inefficiency.
By baking a single-channel height map of the game scene based on the top view, obtaining the operation coordinates of the operation control, determining the height information of the target pixel point, and updating the height information through the selected height color value, generating the game scene resources to be rendered, using encoding and Decoding technology optimizes color value storage, and combines the mean fuzzy algorithm for processing to reduce editing cumbersomeness.
It reduces the resource consumption of rain and snow areas in game development, improves the production efficiency of game scenes, reduces the consumption of human and material resources, simplifies editing operations, and improves the flexibility and fidelity of scene production.
Smart Images

Figure CN119292503A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of game development, and in particular to a method and device for generating game scene resources. Background Art
[0002] In the development of large-scale Internet games, realistic game scenes are developed to simulate the real world in order to show realistic visual effects, such as game scenes with falling snow or rain. When making a game scene with falling snow effects, it is necessary to distinguish between areas where snow has fallen and areas where snow has not fallen, so that the snow elements can be realistically covered on the surface of the scene in a scattered form.
[0003] At present, when distinguishing between snowing and raining areas and non-snowing and non-raining areas, it is usually necessary to add occluders or add vertex colors to the vertices of the occluder model, so as to identify the occluders in the height map generated in real time through the top view, thereby distinguishing which areas are non-snowing or non-raining areas. However, adding vertex colors to the model with occluders will greatly increase system memory consumption, and require a large number of vertex color modification operations, consume a lot of manpower and material resources, and also increase production errors. Therefore, a method for generating game scene resources is urgently needed to solve the above problems. Summary of the invention
[0004] In view of this, the present invention provides a method and device for generating game scene resources, the main purpose of which is to solve the problem of large resource consumption in the existing game production by distinguishing between snowy or rainy areas.
[0005] According to one aspect of the present invention, a method for generating game scene resources is provided, comprising:
[0006] Baking a single-pass heightmap of the game scene based on a top-down view;
[0007] Acquire the operation coordinates of the operation control in the game scene editing area, and determine the height information of the target pixel point in the single-channel height map based on the operation coordinates;
[0008] The height information is updated by the height color value selected by the operation control to generate a game scene resource to be rendered.
[0009] Further, the obtaining of the operation coordinates of the operation control in the game scene editing area, and determining the height information of the target pixel point in the single-channel height map based on the operation coordinates includes:
[0010] Under the condition that the operation area of the operation control in the game scene editing area collides with the scene object, determining the collision point position where the operation area collides with the scene object, and determining the world coordinates of the collision point position as the operation coordinates of the operation control;
[0011] The operation coordinates are converted into the single-channel height map, the target pixel point is determined, and the height information of the target pixel point in the single-channel height map is obtained.
[0012] Furthermore, converting the operation coordinates into the single-channel height map, determining the target pixel point, and obtaining height information of the target pixel point in the single-channel height map includes:
[0013] Perform a product operation on the operation coordinates and the projection matrix of the virtual camera to obtain clipping coordinates;
[0014] Performing a conversion operation on the clipping coordinates according to a preset conversion relationship to obtain pixel coordinates, and determining the target pixel in the single-channel height map based on the pixel coordinates;
[0015] The texture coordinates of the target pixel in the single-channel height map are obtained, and the height information is determined based on the texture coordinates.
[0016] Furthermore, the single-channel height map is a 16-bit red channel height map. After baking the single-channel height map of the game scene based on the top view, the method further includes:
[0017] The first eight color values in the single-channel height map are stored in the green channel by encoding, and the last eight color values in the single-channel height map are stored in the blue channel, so that the color values stored in the green channel and the blue channel in the single-channel height map are retrieved by decoding.
[0018] Furthermore, the height information is updated by the height color value selected by the operation control to generate a game scene resource to be rendered, including:
[0019] Obtaining the height color value selected by the operation control, parsing the target channel in the height color value, and updating the color value;
[0020] Decoding the color values stored in the green channel and the blue channel in the single-channel height map, and updating the color values in the green channel and the blue channel based on the target channel and the updated color value;
[0021] Under the condition that the color values in the green channel and the blue channel are updated, baking is performed based on the green channel and the blue channel to generate a scene height map with updated height color values, which is determined as the game scene resource.
[0022] Furthermore, before determining the game scene resource, the method further includes:
[0023] The material parameters selected based on the operation control are obtained, and the scene height map is updated by fuzzy processing using a mean fuzzy algorithm and the material parameters, so as to determine the game scene resources based on the fuzzy scene height map.
[0024] Furthermore, after generating the game scene resources to be rendered, the method further includes:
[0025] Under the condition of rendering the game scene, calling the game scene resource and determining at least one identification pixel point of the rain and snow elements to be rendered;
[0026] Determine the unobstructed area of the rain and snow element by using the height information and world coordinates of the identified pixel points in the game scene resource;
[0027] The scene rendering of the rain and snow elements is performed in the unobstructed area to complete the production of the game scene.
[0028] Furthermore, the determining of the unobstructed area of the rain and snow element by using the height information and world coordinates of the identified pixel points in the game scene resources includes:
[0029] Under the condition that the world coordinate is greater than or equal to the height information, determining that the identified pixel point is a pixel in an unobstructed area in the game scene;
[0030] The unoccluded area is generated based on at least one of the unoccluded area pixels.
[0031] According to another aspect of the present invention, there is provided a device for generating game scene resources, comprising:
[0032] Baking module for baking single-pass heightmaps of game scenes based on top view;
[0033] An acquisition module, used to acquire the operation coordinates of the operation control in the game scene editing area, and determine the height information of the target pixel point in the single-channel height map based on the operation coordinates;
[0034] A generation module is used to update the height information through the height color value selected by the operation control to generate a game scene resource to be rendered.
[0035] Furthermore, the acquisition module includes:
[0036] a determination unit, configured to determine a collision point position where the operation area collides with the scene object under the condition that the operation area of the operation control in the game scene editing area collides with the scene object, and determine the world coordinates of the collision point position as the operation coordinates of the operation control;
[0037] An acquisition unit is used to convert the operation coordinates into the single-channel height map, determine the target pixel point, and acquire height information of the target pixel point in the single-channel height map.
[0038] Furthermore, the acquisition unit is specifically used to multiply the operation coordinates by the projection matrix of the virtual camera to obtain clipping coordinates; perform a conversion operation on the clipping coordinates according to a preset conversion relationship to obtain pixel coordinates, and determine the target pixel in the single-channel height map based on the pixel coordinates; obtain the texture coordinates of the target pixel in the single-channel height map, and determine the height information based on the texture coordinates.
[0039] Furthermore, the single-channel height map is a 16-bit red channel height map, and the device further comprises:
[0040] The storage module is used to store the first eight color values of the single-channel height map in the green channel by encoding, and store the last eight color values of the single-channel height map in the blue channel, so as to retrieve the color values stored in the green channel and the blue channel in the single-channel height map by decoding.
[0041] Furthermore, the generating module comprises:
[0042] A parsing unit, used to obtain the height color value selected by the operation control, and parse the target channel in the height color value and update the color value;
[0043] An updating unit, configured to decode the color values stored in the green channel and the blue channel in the single-channel height map, and update the color values in the green channel and the blue channel based on the target channel and the updated color value;
[0044] The baking unit is used to bake based on the green channel and the blue channel under the condition that the color values in the green channel and the blue channel are updated, generate a scene height map for updating the height color value, and determine it as the game scene resource.
[0045] Furthermore, the acquisition module is also used to obtain material parameters selected based on the operation control, and to fuzzy the updated scene height map through a mean fuzzy algorithm and the material parameters, so as to determine the game scene resources based on the blurred scene height map.
[0046] Furthermore, the device also includes:
[0047] A calling module, used to call the game scene resources under the condition of rendering the game scene, and determine at least one identification pixel point of the rain and snow elements to be rendered;
[0048] A determination module, used to determine the unobstructed area of the rain and snow element through the height information of the identified pixel point in the game scene resource and the world coordinates;
[0049] A rendering module is used to perform scene rendering of the rain and snow elements in the unobstructed area to complete the production of the game scene.
[0050] Furthermore, the determination module is specifically used to determine that the identified pixel point is an unobstructed area pixel in the game scene under the condition that the world coordinate is greater than or equal to the height information; and generate the unobstructed area based on at least one of the unobstructed area pixels.
[0051] According to another aspect of the present invention, a storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute operations corresponding to the above-mentioned method for generating game scene resources.
[0052] According to another aspect of the present invention, there is provided a terminal, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;
[0053] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above-mentioned method for generating game scene resources.
[0054] By means of the above technical solution, the technical solution provided by the embodiment of the present invention has at least the following advantages:
[0055] The present invention provides a method and device for generating game scene resources. Compared with the prior art, the embodiment of the present invention bakes a single-channel height map of the game scene based on a top view; obtains the operation coordinates of an operation control in a game scene editing area, and determines the height information of a target pixel point in the single-channel height map based on the operation coordinates; updates the height information through a height color value selected by the operation control, generates game scene resources to be rendered, and achieves the purpose of flexibly editing rainy and snowy areas based on the height map, reduces the tediousness of editing the update challenge of rainy and snowy areas, and greatly reduces the human and material resources of game development with the height map, thereby improving the production efficiency of game scenes.
[0056] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0058] Figure 1 A flow chart of a method for generating game scene resources provided by an embodiment of the present invention is shown;
[0059] Figure 2 A flow chart of another method for generating game scene resources provided by an embodiment of the present invention is shown;
[0060] Figure 3 A flow chart of another method for generating game scene resources provided by an embodiment of the present invention is shown;
[0061] Figure 4 A block diagram showing a device for generating game scene resources provided by an embodiment of the present invention;
[0062] Figure 5 A schematic diagram of the structure of a terminal provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0063] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0064] The embodiment of the present invention provides a method for generating game scene resources, such as Figure 1 As shown, the method includes:
[0065] 101. Bake a single-channel height map of the game scene based on the top view.
[0066] In an embodiment of the present invention, the current execution subject, as the execution server of the game development, can be a terminal server or a cloud server, so as to generate game scene resources in combination with the game engine, so as to produce the game scene. Among them, the top view is obtained by shooting with a scene top-view camera, that is, the camera located at the top of the scene takes a downward photo of the top view of the game scene, and bakes it into a single-channel height map of the game scene. At this time, the single-channel height map is the R channel height map in the R (red) G (green) B (blue) channel, so as to represent the scene height by the color value in this single-channel height map. For example, the larger the color value of the pixel point in the single-channel height map, the larger the height corresponding to this pixel point. The embodiment of the present invention does not make specific limitations.
[0067] 102. Obtain the operation coordinates of the operation control in the game scene editing area, and determine the height information of the target pixel point in the single-channel height map based on the operation coordinates.
[0068] In an embodiment of the present invention, in order to realize the convenient adjustment of the height information, so as to obtain the efficient production effect of the snowfall area or the rainfall area scene in the game scene, the current execution end obtains the content of updating the height information by enabling the game scene editor in the game engine. Among them, the operation control can be a mouse or a touch screen. At this time, the operation coordinates are the range moved by the user in the game scene editing area through the mouse or the touch screen, and in the game editing area, the expression form of the operation control can be configured, for example, configured as a brush form, which is not specifically limited in the embodiment of the present invention. In addition, the width, range, etc. of the operation coordinates obtained by moving the operation control can be configured for the expression form of the operation control, such as pre-adjusting the thickness of the configuration brush, so as to obtain the corresponding operation coordinates based on the width of the brush, which is not specifically limited in the embodiment of the present invention. Furthermore, the pixels in the single-channel height map can be calibrated through the operation coordinates, and at least one target pixel point is determined, so as to determine the height information according to the color value of this target pixel point.
[0069] It should be noted that the game engine in the embodiment of the present invention can be a UE4 engine, that is, the editing component is started in the UE4 engine to display the screen editing window, so as to provide the developer with the function of obtaining and updating the height information through the operation control configured in the window. In addition, when determining the target pixel point, since the thickness of the brush can be adjusted based on the operating habits or operating requirements of the development user, the target pixel point obtained by controlling the brush is selected according to the thickness of the brush, and the embodiment of the present invention does not make specific limitations.
[0070] 103. Update the height information by using the height color value selected by the operation control to generate a game scene resource to be rendered.
[0071] In an embodiment of the present invention, since the height information is determined based on the color value in the single-channel height map, the color required to adjust the height can be selected through the operation control, that is, as the height color value, to update the height information. At this time, the height color value can be selected through the operation control to update the height information.
[0072] It should be noted that when the update of the height information in the single-channel height map is completed, the operation coordinates obtained by each operation control can be updated to a new single-channel height map, and the next time the height information of the target pixel point is updated by moving the operation coordinates obtained by the operation control, a new single-channel height map is generated accordingly, so that the original single-channel height map can be returned one by one. The embodiment of the present invention does not make specific limitations.
[0073] An embodiment of the present invention provides a method for generating game scene resources, which achieves the purpose of flexibly editing rain and snow areas based on height maps, reduces the tediousness of editing updates for rain and snow areas, and greatly reduces the human and material resources for game development with height maps, thereby improving the efficiency of game scene production.
[0074] The embodiment of the present invention provides another method for generating game scene resources, such as Figure 2 As shown, the method includes:
[0075] 201. Baking a single-channel height map of the game scene based on the top view.
[0076] In the embodiment of the present invention, step 201 is the same as step 101 and will not be described in detail herein.
[0077] 202. Store the first eight color bits of the single-channel height map in the green channel by encoding, and store the last eight color bits of the single-channel height map in the blue channel.
[0078] In order to reduce the system operation consumption, the single-channel height map obtained based on the top view baking is a sixteen-bit red channel height map, that is, the R channel height map, which means that one R channel stores 2 to the power of 16 gray levels. The current execution end encodes the sixteen-bit channel values into the first eight-bit color values stored in the green channel, and the last eight-bit color values stored in the blue channel, and stores this single-channel height map, so that when the single-channel height map is called, the color values stored in the green channel and the blue channel are obtained by decoding.
[0079] 203. Under the condition that the operation area of the operation control in the game scene editing area collides with the scene object, determine the collision point position where the operation area collides with the scene object, and determine the world coordinates of the collision point position as the operation coordinates of the operation control.
[0080] In order to achieve custom editing of falling snow and rain areas, thereby improving the production efficiency of falling rain and snow scenes, the current execution end starts the game scene editing component in the game engine. At this time, the game scene editing component can show the developer the editing area of the game scene to be rendered, such as scene maps, so as to obtain the area of falling rain and snow to be edited selected by the developer through the operation control. Among them, after the current execution end detects the movement of the operation control, it obtains the operation area. At this time, since the operation control can be a control with width such as a brush, the line width that constitutes the operation area can be configured based on the line thickness of the brush, thereby meeting the flexibility and customization requirements of different developers for area selection. In addition, for the operation area of the operation control, the developer can also select a filled rectangle, circle, etc. For example, directly select a rectangle or circle of the same size as the current brush and directly cover it in the editing area as the operation area to determine whether there is a collision with the scene object.
[0081] It should be noted that after the current execution end obtains the operation area, it performs a collision judgment with the scene objects in the game scene. At this time, the scene objects can be buildings in rainy and snowy scenes, including but not limited to bridges, houses, plants, etc., which are not specifically limited in the embodiments of the present invention. When it is determined that the operation area collides with the scene object, the collision point position is determined. This collision point position is the position where the height information needs to be updated. Therefore, the world coordinates of the collision point position are determined as the operation coordinates to convert the operation coordinates to the corresponding target pixel points in the single-channel height map. In addition, when performing collision detection, a ray detection can be performed based on the operation position of the operation control. For example, a ray detection is performed at the mouse position to determine whether the ray intersects with the model vertex of the scene object as the collision detection result. The embodiments of the present invention do not make specific limitations.
[0082] 204. Convert the operation coordinates into the single-channel height map, determine the target pixel point, and obtain height information of the target pixel point in the single-channel height map.
[0083] Since the editing area is divided according to the game scene, and the single-channel height map is obtained from the top view, when converting, the operation coordinates of the collision can correspond to a pixel point in the game scene. At this time, the operation coordinates can be converted to the single-channel height map by projection, corresponding to a target pixel point. Then, the height information of this target pixel point is obtained through the single-channel height map, so as to realize accurate mapping of the height information and thus accurate update of the height information.
[0084] In another embodiment of the present invention, for further explanation and limitation, the step of converting the operation coordinates into the single-channel height map, determining the target pixel point, and obtaining the height information of the target pixel point in the single-channel height map includes:
[0085] Perform a product operation on the operation coordinates and the projection matrix of the virtual camera to obtain clipping coordinates;
[0086] Performing a conversion operation on the clipping coordinates according to a preset conversion relationship to obtain pixel coordinates, and determining the target pixel in the single-channel height map based on the pixel coordinates;
[0087] The texture coordinates of the target pixel in the single-channel height map are obtained, and the height information is determined based on the texture coordinates.
[0088] In order to achieve the purpose of convenient height editing and ensure that the height in the single-channel height map can be adjusted through the operation in the editing area, when the operation coordinates are converted to the single-channel height map to determine the target pixel point, specifically, the operation coordinates are multiplied by the projection matrix of the virtual camera to obtain the clipping coordinates. Among them, the virtual camera is an orthogonal camera used for top-view shooting. When the operation coordinates are multiplied by the projection matrix of the virtual camera, the two-dimensional coordinates in the editing screen are converted to the projection coordinates corresponding to the virtual camera, that is, the clipping coordinates, and the clipping coordinates have a value range of [-1,1]. In addition, the preset conversion relationship is the conversion relationship for converting the clipping coordinates to the single-channel height map. At this time, the preset conversion relationship is the operation relationship of multiplying a plus b. A and b are conversion coefficients, which can be set to 0.5, that is, multiplying the clipping coordinates by 0.5 and then adding 0.5 to obtain the pixel coordinates in the single-channel height map. At this time, the pixel coordinates belong to the interval [0, 1], and the pixel corresponding to this pixel coordinate is used as the target pixel corresponding to the operation area selected by the editor through the operation control.
[0089] It should be noted that after the current execution end determines the target pixel point in the single-channel height map, in order to update and adjust the height, the current execution end obtains the texture coordinates of the target pixel point in the single-channel height map. At this time, the texture coordinates are represented by the height information of the target pixel point in the single-channel height map, that is, the color value of the target pixel point, which is not specifically limited in the embodiment of the present invention.
[0090] 205. Obtain the height color value selected by the operation control, parse the target channel in the height color value, and update the color value.
[0091] Since the developer can select the operation area through the editing area, at this time, in addition to selecting the operation area by moving the operation control, the color value can also be selected or configured as the height color value to be updated, and the embodiment of the present invention does not make specific limitations. In addition, since the single-channel height map is a color value encoded and stored in the green channel and the blue channel, in order to adjust the height information in the single-channel color map based on the selected height color value, the current execution end parses the target channel of the selected height color value and updates the color value. Among them, the target channel can be any channel of the R, G, and B channels, any two or three channels, that is, it is determined by splitting the channel of the height color value, and the corresponding updated color value in each target channel is obtained, and the embodiment of the present invention does not make specific limitations.
[0092] 206. Decode the color values stored in the green channel and the blue channel in the single-channel height map, and update the color values in the green channel and the blue channel based on the target channel and the updated color value.
[0093] Since the color values are encoded and stored in the green channel and the blue channel after the single-channel height map is generated, in order to update it, at this time, the color values stored in the green channel and the blue channel in the single-channel height map are first decoded, so that the color values in the green channel and the blue channel are updated based on the target channel and the updated color value, and the embodiment of the present invention is not specifically limited. For example, if the target channel is the blue channel and the corresponding updated color value is a, the original color value in the blue channel is updated to a, and the embodiment of the present invention is not specifically limited. In addition, the update of the corresponding color value in the embodiment of the present invention can be to increase the color value or to reduce the color value, so as to achieve flexible adjustment of the height, and then when judging the shielded area, the adjustment and editing of the rain or snow area can be flexibly realized, which greatly improves the efficiency of scene production of rain and snow.
[0094] 207. Under the condition that the color values in the green channel and the blue channel are updated, baking is performed based on the green channel and the blue channel to generate a scene height map for updating the height color value, and the map is determined as the game scene resource.
[0095] Specifically, after the color values in the green channel and the blue channel are completed, the single-channel height map is re-baked according to the updated green channel and the blue channel to obtain a new game scene resource. In addition, in the embodiment of the present invention, since each time the control brush operation selects the operation area and then performs a color update, a corresponding new single-channel height map can be generated as a game scene resource, therefore, after generating a game scene resource, it can be selected for caching once, thereby obtaining multiple game scene resources, and according to the undo operation selected by the developer in the editing component, return to the previous one, or even the previous one, corresponding game scene resource, to achieve flexible height editing requirements, greatly simplifying the cumbersomeness of editing game scene resources.
[0096] In another embodiment of the present invention, for further explanation and limitation, before the step is determined as the game scene resource, the method further includes:
[0097] The material parameters selected based on the operation control are obtained, and the scene height map is updated by fuzzy processing using a mean fuzzy algorithm and the material parameters, so as to determine the game scene resources based on the fuzzy scene height map.
[0098] In order to meet the flexible editing requirements for the falling snow and rain game scenes, and to improve the realistic display effect of the game scene production based on the game scene resources, the current execution end can also obtain the material parameters selected based on the operation control, such as the material ball, and adjust the parameters of the material ball, which is not specifically limited in the embodiment of the present invention. At the same time, the scene height map after the color value is updated is blurred by the mean fuzzy algorithm combined with the material parameters, so that the edge transition of the area for falling snow and rain in the height map is softer, so as to increase the realism of the falling rain and snow effects in the game scene.
[0099] An embodiment of the present invention provides another method for generating game scene resources to achieve the purpose of flexibly editing rain and snow areas based on height maps, reducing the tediousness of editing updates for rain and snow areas, and greatly reducing the human and material resources for game development with height maps, thereby improving the efficiency of game scene production.
[0100] The embodiment of the present invention provides another method for generating game scene resources, such as Figure 3 As shown, the method includes:
[0101] 301. Baking a single-channel height map of the game scene based on the top view.
[0102] 302. Obtain the operation coordinates of the operation control in the game scene editing area, and determine the height information of the target pixel point in the single-channel height map based on the operation coordinates.
[0103] 303. Update the height information by using the height color value selected by the operation control to generate a game scene resource to be rendered.
[0104] 304. Under the condition of rendering the game scene, retrieve the game scene resource and determine at least one identified pixel point of the rain and snow element to be rendered;
[0105] 305. Determine the unobstructed area of the rain and snow element through the height information and world coordinates of the identified pixel point in the game scene resource;
[0106] 306. Perform scene rendering of the rain and snow elements in the unblocked area to complete the production of the game scene.
[0107] In an embodiment of the present invention, steps 301-303 are implemented in the same manner as steps 101-103, and are not described in detail herein. Furthermore, after generating the game scene resources to be rendered, when the current execution end renders the game scene, the stored game scene resources are first retrieved to produce a rain or snow scene based on the height information in the game resource scene. Among them, the identification pixel point is the target pixel point to be determined whether the rain and snow elements need to be rendered. Each pixel point in the game scene can be traversed as the identification pixel point to retrieve the height information corresponding to the identification pixel point from the game scene resource. At the same time, the world coordinates corresponding to the identification pixel point can be extracted based on the game scene produced by the game engine, that is, the world coordinates are the coordinates of the identification pixel point in the game scene world, so as to determine whether the identification pixel point is a pixel point in the area where the rain and snow elements are blocked, thereby dividing which areas are the areas where the rain and snow are blocked, and which areas are the areas where the rain and snow are not blocked. When an unobstructed area is determined based on the identified pixel points, it means that the scene rendering of rain and snow elements can be performed in this area, and a game scene covered with rain and snow effects is obtained. In addition, the rain and snow elements in the embodiment of the present invention include but are not limited to rain elements, snow elements, and elements composed of rain and snow, so as to show the scene production effect of realistic rain and snow weather in nature and increase the accurate identification of rain and snow areas.
[0108] In another embodiment of the present invention, for further explanation and limitation, step 305, determining the unobstructed area of the rain and snow element by using the height information and world coordinates of the identified pixel point in the game scene resource includes:
[0109] Under the condition that the world coordinate is greater than or equal to the height information, determining that the identified pixel point is a pixel in an unobstructed area in the game scene;
[0110] The unoccluded area is generated based on at least one of the unoccluded area pixels.
[0111] In order to achieve realistic production of rain and snow scenes based on custom height information in game scene resources, the current execution end determines whether it is an unobstructed area of rain and snow elements based on the height information of the identified pixel point and the world coordinates. Specifically, the world coordinates are compared with the height information. When the world coordinates are greater than or can match the height information, it means that the identified pixel point is not obstructed. Therefore, the identified pixel point can be determined as an unobstructed area pixel, and then the obtained area can be used as the unobstructed area when rendering rain and snow. Correspondingly, if the world coordinates are less than the height information, it means that the identified pixel point is obstructed. Therefore, the identified pixel point is determined as an obstructed area pixel, so that the rain and snow effects are not produced for this area when rendering the game scene, which greatly reduces the complexity of producing rain or snow scenes.
[0112] The embodiment of the present invention provides a method for generating game scene resources. Compared with the prior art, the embodiment of the present invention bakes a single-channel height map of the game scene based on the top view; obtains the operation coordinates of the operation control in the game scene editing area, and determines the height information of the target pixel point in the single-channel height map based on the operation coordinates; updates the height information through the height color value selected by the operation control, generates game scene resources to be rendered, and achieves the purpose of flexibly editing the rain and snow areas based on the height map, reduces the tediousness of editing the update challenges of the rain and snow areas, and greatly reduces the human and material resources of game development with the height map, thereby improving the production efficiency of the game scene.
[0113] Furthermore, as a response to the above Figure 1 The embodiment of the present invention provides a device for generating game scene resources, such as Figure 4 As shown, the device comprises:
[0114] A baking module 41, for baking a single-channel height map of a game scene based on a top view;
[0115] An acquisition module 42 is used to acquire the operation coordinates of the operation control in the game scene editing area, and determine the height information of the target pixel point in the single-channel height map based on the operation coordinates;
[0116] The generating module 43 is used to update the height information through the height color value selected by the operating control, and generate a game scene resource to be rendered.
[0117] Furthermore, the acquisition module includes:
[0118] a determination unit, configured to determine a collision point position where the operation area collides with the scene object under the condition that the operation area of the operation control in the game scene editing area collides with the scene object, and determine the world coordinates of the collision point position as the operation coordinates of the operation control;
[0119] An acquisition unit is used to convert the operation coordinates into the single-channel height map, determine the target pixel point, and acquire height information of the target pixel point in the single-channel height map.
[0120] Furthermore, the acquisition unit is specifically used to multiply the operation coordinates by the projection matrix of the virtual camera to obtain clipping coordinates; perform a conversion operation on the clipping coordinates according to a preset conversion relationship to obtain pixel coordinates, and determine the target pixel in the single-channel height map based on the pixel coordinates; obtain the texture coordinates of the target pixel in the single-channel height map, and determine the height information based on the texture coordinates.
[0121] Furthermore, the single-channel height map is a 16-bit red channel height map, and the device further comprises:
[0122] The storage module is used to store the first eight color values of the single-channel height map in the green channel by encoding, and store the last eight color values of the single-channel height map in the blue channel, so as to retrieve the color values stored in the green channel and the blue channel in the single-channel height map by decoding.
[0123] Furthermore, the generating module comprises:
[0124] A parsing unit, used to obtain the height color value selected by the operation control, and parse the target channel in the height color value and update the color value;
[0125] An updating unit, configured to decode the color values stored in the green channel and the blue channel in the single-channel height map, and update the color values in the green channel and the blue channel based on the target channel and the updated color value;
[0126] The baking unit is used to bake based on the green channel and the blue channel under the condition that the color values in the green channel and the blue channel are updated, generate a scene height map for updating the height color value, and determine it as the game scene resource.
[0127] Furthermore, the acquisition module is also used to obtain material parameters selected based on the operation control, and to fuzzy the updated scene height map through a mean fuzzy algorithm and the material parameters, so as to determine the game scene resources based on the blurred scene height map.
[0128] Furthermore, the device also includes:
[0129] A calling module, used to call the game scene resources under the condition of rendering the game scene, and determine at least one identification pixel point of the rain and snow elements to be rendered;
[0130] A determination module, used to determine the unobstructed area of the rain and snow element through the height information of the identified pixel point in the game scene resource and the world coordinates;
[0131] A rendering module is used to perform scene rendering of the rain and snow elements in the unobstructed area to complete the production of the game scene.
[0132] Furthermore, the determination module is specifically used to determine that the identified pixel point is an unobstructed area pixel in the game scene under the condition that the world coordinate is greater than or equal to the height information; and generate the unobstructed area based on at least one of the unobstructed area pixels.
[0133] An embodiment of the present invention provides a device for generating game scene resources. Compared with the prior art, the embodiment of the present invention bakes a single-channel height map of the game scene based on a top view; obtains the operation coordinates of an operation control in a game scene editing area, and determines the height information of a target pixel point in the single-channel height map based on the operation coordinates; updates the height information through a height color value selected by the operation control, generates game scene resources to be rendered, and achieves the purpose of flexibly editing rainy and snowy areas based on the height map, reduces the tediousness of editing the challenge of updating rainy and snowy areas, and greatly reduces the human and material resources of game development with the height map, thereby improving the production efficiency of game scenes.
[0134] According to an embodiment of the present invention, a storage medium is provided, wherein the storage medium stores at least one executable instruction, and the computer executable instruction can execute the method for generating game scene resources in any of the above method embodiments.
[0135] Figure 5 A schematic diagram of the structure of a terminal provided according to an embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the terminal.
[0136] like Figure 5 As shown, the terminal may include: a processor (processor) 502 , a communication interface (Communications Interface) 504 , a memory (memory) 506 , and a communication bus 508 .
[0137] The processor 502 , the communication interface 504 , and the memory 506 communicate with each other via a communication bus 508 .
[0138] The communication interface 504 is used to communicate with other devices such as clients or other servers.
[0139] The processor 502 is used to execute the program 510, and specifically can execute the relevant steps in the above-mentioned embodiment of the method for generating game scene resources.
[0140] Specifically, the program 510 may include program codes, which include computer operation instructions.
[0141] The processor 502 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiment of the present invention. The one or more processors included in the terminal may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0142] The memory 506 is used to store the program 510. The memory 506 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0143] The program 510 may be specifically configured to enable the processor 502 to perform the following operations:
[0144] Baking a single-pass heightmap of the game scene based on a top-down view;
[0145] Acquire the operation coordinates of the operation control in the game scene editing area, and determine the height information of the target pixel point in the single-channel height map based on the operation coordinates;
[0146] The height information is updated by the height color value selected by the operation control to generate a game scene resource to be rendered.
[0147] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0148] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for generating game scene resources, characterized in that: include: Baking a single-pass heightmap of the game scene based on a top-down view; Acquire the operation coordinates of the operation control in the game scene editing area, and determine the height information of the target pixel point in the single-channel height map based on the operation coordinates; The height information is updated by the height color value selected by the operation control to generate a game scene resource to be rendered.
2. The method according to claim 1, characterized in that The obtaining of the operation coordinates of the operation control in the game scene editing area, and determining the height information of the target pixel point in the single-channel height map based on the operation coordinates includes: Under the condition that the operation area of the operation control in the game scene editing area collides with the scene object, determining the collision point position where the operation area collides with the scene object, and determining the world coordinates of the collision point position as the operation coordinates of the operation control; The operation coordinates are converted into the single-channel height map, the target pixel point is determined, and the height information of the target pixel point in the single-channel height map is obtained.
3. The method according to claim 2, characterized in that The converting the operation coordinates into the single-channel height map, determining the target pixel point, and obtaining the height information of the target pixel point in the single-channel height map includes: Perform a product operation on the operation coordinates and the projection matrix of the virtual camera to obtain clipping coordinates; Performing a conversion operation on the clipping coordinates according to a preset conversion relationship to obtain pixel coordinates, and determining the target pixel in the single-channel height map based on the pixel coordinates; The texture coordinates of the target pixel in the single-channel height map are obtained, and the height information is determined based on the texture coordinates.
4. The method according to claim 1, characterized in that: The single-channel height map is a 16-bit red channel height map. After baking the single-channel height map of the game scene based on the top view, the method further includes: The first eight color values in the single-channel height map are stored in the green channel by encoding, and the last eight color values in the single-channel height map are stored in the blue channel, so that the color values stored in the green channel and the blue channel in the single-channel height map are retrieved by decoding.
5. The method according to claim 4, characterized in that The updating of the height information by the height color value selected by the operation control to generate a game scene resource to be rendered includes: Obtaining the height color value selected by the operation control, parsing the target channel in the height color value, and updating the color value; Decoding the color values stored in the green channel and the blue channel in the single-channel height map, and updating the color values in the green channel and the blue channel based on the target channel and the updated color value; Under the condition that the color values in the green channel and the blue channel are updated, baking is performed based on the green channel and the blue channel to generate a scene height map with updated height color values, which is determined as the game scene resource.
6. The method according to claim 5, characterized in that Before determining the game scene resource, the method further includes: The material parameters selected based on the operation control are obtained, and the scene height map is updated by fuzzy processing using a mean fuzzy algorithm and the material parameters, so as to determine the game scene resources based on the fuzzy scene height map.
7. The method according to any one of claims 1 to 6, characterized in that: After generating the game scene resources to be rendered, the method further includes: Under the condition of rendering the game scene, calling the game scene resource and determining at least one identification pixel point of the rain and snow elements to be rendered; Determine the unobstructed area of the rain and snow element by using the height information and world coordinates of the identified pixel points in the game scene resource; The scene rendering of the rain and snow elements is performed in the unobstructed area to complete the production of the game scene.
8. The method according to claim 7, characterized in that The determining of the unobstructed area of the rain and snow element by using the height information of the identified pixel point in the game scene resource and the world coordinates includes: Under the condition that the world coordinate is greater than or equal to the height information, determining that the identified pixel point is a pixel in an unobstructed area in the game scene; The unoccluded area is generated based on at least one of the unoccluded area pixels.
9. A device for generating game scene resources, characterized in that: include: Baking module for baking single-pass heightmaps of game scenes based on top view; An acquisition module, used to acquire the operation coordinates of the operation control in the game scene editing area, and determine the height information of the target pixel point in the single-channel height map based on the operation coordinates; A generation module is used to update the height information through the height color value selected by the operation control to generate a game scene resource to be rendered.
10. A storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute operations corresponding to the method for generating game scene resources as described in any one of claims 1-8.
11. A terminal, comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute an operation corresponding to the method for generating game scene resources as described in any one of claims 1-8.