A method for automatically converting a planar map into a curved surface map
By establishing a Shader syntax analyzer and automated processing flow in the game, the problems of complex surface map production process and high maintenance costs are solved, and the automatic conversion of the plan map to the surface map is realized, which improves efficiency and reduces costs.
Patent Information
- Application Number
- CN202410630849.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2044-05-20
AI Technical Summary
The production process of surface maps in existing games is complicated and the maintenance cost is high.
By establishing a syntax analyzer for Shader, automates processing of static resources, encapsulates switching interfaces, and establishes visual tools to automatically convert the floor map into a surface map.
Improve work efficiency, reduce maintenance costs, and realize rapid switching and standardized processing of surface maps.
Smart Images

Figure CN118491090B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of game development, and particularly relates to a method for automatically converting a planar map into a curved surface map. Background Art
[0002] A curved surface map is a special display scheme for maps. The representative game using this scheme is "Microsoft Flight Simulator" ( Figure 1 ). Different from conventional planar maps, curved surface maps have a greater depth of field, better long-distance performance, and a sense of space. However, the implementation scheme of curved surface maps in traditional games is generally achieved by modifying vertex offsets in each Shader that requires curved surface performance. Since map components, as well as characters and special effects presented on the map, all need to be processed, the production process is complex and the maintenance cost is high. Therefore, the present application provides a method for automatically converting a planar map into a curved surface map to meet the requirements. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a method for automatically converting a planar map into a curved surface map to solve the problems of complex existing production processes and high maintenance costs.
[0004] To solve the above technical problems, the present invention provides the following technical solutions:
[0005] A method for automatically converting a planar map into a curved surface map, comprising the following steps:
[0006] S1, establish a syntax analyzer for Shader;
[0007] S2, automatically process all static resources;
[0008] S3, encapsulate a switching interface, and in the form of a macro switch, switch the performance of the same resource in the planar map and the curved surface map with one key;
[0009] S4, establish a visualization tool to facilitate artists to quickly check and view the effects.
[0010] In a possible implementation manner, the syntax analyzer in S1 includes the processing of Shader by the curved surface map. The processing of Shader by the curved surface map is mainly divided into two parts:
[0011] a, correct the Y value of the vertex through a specific formula;
[0012] b, correct the alpha of the pixel output color.
[0013] In a possible implementation, the syntax analyzer in S1 further includes semantic analysis. The semantic analysis mainly finds the corresponding keywords and performs syntax block and matching analysis. The keywords involved in the two parts of the Shader processing by the surface map are Position in the vertex structure and return in the PixelShader respectively.
[0014] In a possible implementation, the Position keyword corresponds to the vertex coordinates to be processed. The subsequent vertex coordinate processing link includes various MVP conversion logics of the VertexShader. The vertex coordinate processing link needs to perform syntax block replacement. The return keyword in the PixelShader needs to add special processing for the alpha value of the return value before returning.
[0015] In a possible implementation, the syntax analyzer in S1 further includes a Shader template for processing certain special syntax implementations. For example, the clip function has a direct sequence relationship with the alpha of the color, and the relevant syntax segments need to be shifted.
[0016] In a possible implementation, the syntax analyzer in S1 further includes the Unity's SurfaceShader, and the Unity's SurfaceShader requires special syntax logic.
[0017] In a possible implementation, S2 specifically includes the following steps:
[0018] S21, taking the camera Layer as a distinguishing mark, in a non-running environment, statically scan the resources and analyze the Shaders used by the resources;
[0019] S22, using the syntax analyzer of S1 and substituting a templated processing method, automatically generate a surface version for the Shaders that need surface conversion and replace the corresponding materials.
[0020] In a possible implementation, the automated process in S2 will judge the situation where the map resources and the interface resources use the same material, and generate a new material to ensure the uniqueness of the surface material.
[0021] Compared with the prior art, the present invention has at least the following beneficial effects:
[0022] Through the syntax analyzer for Shader, the vertex processing code segment and the pixel alpha assignment code segment can be located, and the templatized replacement of the surface processing logic can be performed. On this basis, a set of standard Shader templates are constructed, with the camera Layer as the distinguishing mark. In the non-runtime environment, the resources are statically scanned, the Shaders used by the resources are analyzed, and in a templatized processing manner, the Shaders that need to perform surface conversion are automatically generated with surface versions and the corresponding materials are replaced, which improves work efficiency and reduces maintenance costs at the same time. Brief Description of the Drawings
[0023] The accompanying drawings incorporated herein and constituting a part of the specification illustrate embodiments of the present disclosure and, together with the specification, are further used to explain the principles of the present disclosure and enable those skilled in the relevant art to implement and use the present disclosure.
[0024] Figure 1 It is a flowchart of the method of the present invention.
[0025] As shown in the figure, in order to clearly implement the structure of the embodiments of the present invention, specific structures and devices are marked in the figure, but this is only for illustrative purposes and is not intended to limit the present invention to this specific structure, device and environment. According to specific needs, those of ordinary skill in the art can adjust or modify these devices and environments, and the adjustments or modifications made are still included in the scope of the appended claims. Detailed Description of the Embodiments
[0026] The following describes in detail a method for automatically converting a planar map into a surface map provided by the present invention in conjunction with the accompanying drawings and specific embodiments. At the same time, it should be noted here that in order to make the embodiments more detailed, the following embodiments are the best and preferred embodiments. For some well-known technologies, those skilled in the art can also adopt other alternative methods for implementation; moreover, the accompanying drawings are only for more specifically describing the embodiments and are not intended to specifically limit the present invention.
[0027] It should be pointed out that in the specification, references to "an embodiment", "embodiments", "exemplary embodiments", "some embodiments", etc. indicate that the described embodiments may include specific features, structures or characteristics, but not necessarily every embodiment includes the specific feature, structure or characteristic. Additionally, when combining embodiments to describe a specific feature, structure or characteristic, implementing such feature, structure or characteristic in combination with other embodiments (whether explicitly described or not) should be within the knowledge of those skilled in the relevant art.
[0028] Generally, terms can be understood, at least in part, from their use in context. For example, depending at least in part on the context, the term "one or more" as used herein can be used to describe any feature, structure, or characteristic in a singular sense, or can be used to describe a combination of features, structures, or characteristics in a plural sense. Additionally, the term "based on" can be understood to not necessarily be intended to convey a set of exclusive factors, but rather, at least in part depending on the context, can allow for the presence of other factors that are not necessarily expressly described.
[0029] It will be understood that the meanings of "on", "above", and "over" in the present disclosure should be construed in the broadest manner such that "on" not only means "directly on" something, but also includes the meaning of being "on" something with intervening features or layers therebetween, and "above" or "over" not only means "above" or "over" something, but can also include the meaning of being "above" or "over" something with no intervening features or layers therebetween.
[0030] In addition, spatial relative terms such as "under", "below", "lower", "above", "upper", etc. may be used herein for convenience of description to describe the relationship of one element or feature to another or other elements or features, as shown in the drawings. The spatial relative terms are intended to cover different orientations in the use or operation of the device in addition to the orientation depicted in the drawings. The device may be otherwise oriented, and the spatial relative descriptors used herein may be interpreted accordingly.
[0031] As Figure 1 shown, embodiments of the present invention provide a method for automatically converting a planar map into a curved surface map, including the following steps:
[0032] S1. Establish a syntax analyzer for Shader. The syntax analyzer includes the processing of Shader by the surface map, semantic analysis, Shader templates, and Unity's SurfaceShader. The processing of Shader by the surface map mainly includes correcting the Y value of vertices through a specific formula and correcting the alpha of the pixel output color. Semantic analysis requires finding the corresponding keywords for syntax block matching analysis. The keywords involved in the two parts of the Shader processing by the surface map are Position in the vertex structure and return in PixelShader respectively. The Position keyword corresponds to the vertex coordinates to be processed. The subsequent vertex coordinate processing link includes various MVP conversion logics of VertexShader. The vertex coordinate processing link requires syntax block replacement. The return keyword in PixelShader needs to add special processing for the alpha of the return value before returning. Shader templates are used to process certain special syntax implementations. For example, the clip function has a direct sequence relationship with the alpha of color, and relevant syntax segments need to be shifted. Unity's SurfaceShader requires special syntax logic;
[0033] S2. Automatically process all static resources. The steps for processing static resources are as follows:
[0034] S21. Using the camera layer as a distinguishing marker, in a non-running environment, statically scan the resources and analyze the Shaders used by the resources;
[0035] S22. Using the syntax analyzer in S1 and substituting a templated processing method, automatically generate a surface version for the Shaders that need surface conversion and replace the corresponding materials;
[0036] Among them, the automated process will judge the situation where the map resources and interface resources use the same material and generate a new material to ensure the uniqueness of the surface material;
[0037] S3. Package a switching interface and, in the form of a macro switch, switch the performance of the same resource in the planar map and the surface map with one key;
[0038] S4. Establish a visualization tool to facilitate artists to quickly check and view the effects;
[0039] Among them, both S3 and S4 are existing technologies and will not be elaborated here.
[0040] The technical solution provided by the present invention establishes a set of Shader syntax analyzers to automatically convert conventional Shaders into surface Shaders, and can dynamically judge the usage of objects, quickly switch the map and the elements in the map between the two display schemes of the surface map and the plane map with one key, improving work efficiency while reducing maintenance costs.
[0041] The present invention covers any substitutions, modifications, equivalent methods and solutions made within the spirit and scope of the present invention. In order to enable the public to have a thorough understanding of the present invention, specific details are described in detail in the following preferred embodiments of the present invention, and those skilled in the art can fully understand the present invention without these detailed descriptions. In addition, in order to avoid unnecessary confusion to the essence of the present invention, well-known methods, processes, procedures, components and circuits are not described in detail.
[0042] Those of ordinary skill in the art can understand that all or part of the steps in implementing the above method embodiments can be completed by instructing relevant hardware through a program, and this program can be stored in a computer-readable storage medium, such as: ROM / RAM, magnetic disk, optical disk, etc.
[0043] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A method for automatically converting a flat map into a curved map, characterized in that: The following steps are involved: S1. Establish a syntax analyzer for Shader. The syntax analyzer includes the processing of Shader by surface map, semantic analysis, Shader template and Unity's SurfaceShader. The processing of Shader by surface map is mainly divided into the correction of the Y value of vertex through formula and the correction of alpha of pixel output color. Semantic analysis needs to find the corresponding keywords for syntax block and matching analysis. The keywords involved in the two parts of Shader processing by surface map are Position in vertex structure and return in PixelShader. The Position keyword corresponds to the vertex coordinates to be processed. The subsequent vertex coordinate processing includes various MVP conversion logics of VertexShader. The vertex coordinate processing needs to replace syntax blocks. The return keyword in PixelShader needs to add special processing of alpha of return value before returning. Shader template is used to handle some special syntax implementations. The clip function has a direct sequence relationship with the alpha of color, and the relevant syntax segments need to be shifted. Unity's SurfaceShader requires special syntax logic. S2, automatically processes all static resources; S21, using the camera layer as a distinguishing mark, statically scans the resources in a non-runtime environment and analyzes the shaders used by the resources; S22, using the syntax analyzer of S1, substitutes the templated processing method to automatically generate a surface version for the shader that needs surface conversion and replace the corresponding material; S3, encapsulation switching interface, in the form of macro switch, one-click switching of the same resource in flat map and curved map; S4, establish visualization tools to facilitate artists to quickly check and view the effects.
2. The method for automatically converting a flat map into a curved map according to claim 1, characterized in that: The syntax analyzer in S1 includes the processing of the surface map to the shader, and the processing of the surface map to the shader is mainly divided into two parts: a. Correct the Y value of the vertex using the formula; b. Correct the alpha of the pixel output color.
3. The method for automatically converting a flat map into a curved map according to claim 1, characterized in that: The syntax analyzer in S1 also includes semantic analysis, which mainly finds corresponding keywords and performs syntax block and matching analysis. The keywords involved in the two parts of Shader processing of the surface map are Position in the vertex structure and return in PixelShader.
4. The method for automatically converting a flat map into a curved map according to claim 3, characterized in that: The Position keyword corresponds to the vertex coordinates that need to be processed. The subsequent vertex coordinate processing steps include various MVP conversion logics of VertexShader. The vertex coordinate processing steps require syntax block replacement. The return keyword in the PixelShader requires special processing of the alpha of the return value before returning.
5. The method for automatically converting a flat map into a curved map according to claim 1, characterized in that: The syntax analyzer in S1 also includes a Shader template for processing certain special syntax implementations. The clip function has a direct order relationship with the alpha of color, and the relevant syntax segments need to be shifted.
6. The method for automatically converting a flat map into a curved map according to claim 1, characterized in that: The syntax analyzer in S1 also includes Unity's SurfaceShader, which requires special syntax logic.
7. The method for automatically converting a flat map into a curved map according to claim 1, characterized in that: The automated process in S2 will determine if the map resources and interface resources use the same material, and generate a new material to ensure the uniqueness of the surface material.
Citation Information
Patent Citations
Three-dimensional tile construction method for fusing massive map data and building information model
CN111221933A
Map generation method and device, equipment and storage medium
CN116416399A