A virtual scene processing method and device, computer equipment and storage medium
By dividing the virtual scene into foreground and background areas, using 3D models and patch models, and adjusting material template values for rendering, the problems of high resource consumption and untidy scenes are solved, achieving efficient virtual scene display.
Patent Information
- Application Number
- CN202211105460.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-09
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-09-09
AI Technical Summary
Existing technologies require the creation of numerous 3D object models when switching game scenes, especially when displaying outdoor scenes through a window view. This results in high resource consumption and an untidy outdoor scene, making it difficult to maintain realism and cleanliness.
By determining the foreground and background areas of translucent objects in the virtual scene, using 3D models and patch models to set the foreground and background areas respectively, and adjusting material template values to render and display the virtual scene, resource consumption is optimized while maintaining scene realism.
It improves the display effect of virtual scenes, reduces resource consumption, ensures the cleanliness and realism of outdoor scenes, and avoids the chaos and continuity errors caused by too many 3D models.
Smart Images

Figure CN115430143B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a virtual scene processing method and device, computer equipment and computer readable storage medium. BACKGROUND
[0002] In the process of game development, the game scene needs to be processed. The game scene includes indoor scene and outdoor scene. Scene switching can be realized by switching the view angle in the game process. For example, the indoor view angle can display the indoor scene, the panoramic view angle can display the indoor scene and the outdoor scene at the same time, or the window view angle can display the indoor scene and the outdoor scene at the same time.
[0003] In the related art, in order to ensure the authenticity of the outdoor scene displayed by the window view angle, and to maintain the neatness of the outdoor scene when the view angle is switched to the outdoor scene, the game producer builds a complete outdoor scene by using three-dimensional models, that is, the object models of each object included in the outdoor scene need to be built, and then the texture coordinates of the object models are created and the texture maps are assigned, and the light is added. Since a large number of three-dimensional object models are created, a large amount of resources is consumed to render the models in real-time rendering games. SUMMARY
[0004] The embodiments of the present application provide a virtual scene processing method and device, computer equipment and computer readable storage medium, which can improve the display effect of the virtual scene.
[0005] The embodiments of the present application provide a virtual scene processing method, which comprises:
[0006] Determine the scene space in the virtual scene under the first view angle, and determine the near scene area and the far scene area according to the light-transmitting object in the scene space;
[0007] Set the near scene area according to the three-dimensional model of the near scene object in the near scene area, and set the far scene area according to the face sheet model of the far scene object in the far scene area;
[0008] Obtain the initial template value of the screen pixel point, the material template value of the light-transmitting object, the near scene object and the far scene object;
[0009] Adjust the initial template value of the screen pixel point, the material template value of the near scene object and the far scene object based on the material template value of the light-transmitting object;
[0010] Render and display the virtual scene based on the material template value of the light-transmitting object, and the adjusted material template value of the near scene object and the far scene object.
[0011] Correspondingly, the embodiment of the present application further provides a virtual scene processing device, comprising:
[0012] a first determining unit configured to determine a scene space in a first perspective in the virtual scene, and determine a near region and a far region according to a light-transmitting object in the scene space;
[0013] a setting unit configured to set the near region according to a three-dimensional model of a near object in the near region, and set the far region according to a patch model of a far object in the far region;
[0014] an obtaining unit configured to obtain an initial template value of a screen pixel point, and material template values of the light-transmitting object, the near object and the far object;
[0015] a first adjusting unit configured to adjust the initial template value of the screen pixel point, the material template values of the near object and the far object respectively based on the material template value of the light-transmitting object;
[0016] a rendering unit configured to render and display the virtual scene based on the material template value of the light-transmitting object, and the material template values of the adjusted near object and the far object.
[0017] Correspondingly, the embodiment of the present application further provides a computer device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the virtual scene processing method provided by any of the embodiments of the present application.
[0018] Correspondingly, the embodiment of the present application further provides a computer readable storage medium, which stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the virtual scene processing method as above.
[0019] The embodiment of the present application determines a scene space in a first perspective in the virtual scene, and determines a near region with a distance less than a preset distance from a light-transmitting object, and a far region with a distance not less than the preset distance from the light-transmitting object in the scene space, and then sets the near region according to a three-dimensional model of a near object in the near region, and sets the far region according to a patch model of a far object in the far region. Further, the embodiment of the present application obtains an initial template value of a screen pixel point, and material template values of the light-transmitting object, the near object and the far object, adjusts the initial template value of the screen pixel point, the material template values of the near object and the far object respectively based on the material template value of the light-transmitting object, and renders and displays the virtual scene based on the material template value of the light-transmitting object, and the material template values of the adjusted near object and the far object, thereby improving the display effect of the virtual scene. BRIEF DESCRIPTION OF DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and all other drawings obtained by those skilled in the art without creative effort based on these drawings also belong to the protection scope of the present application.
[0021] Figure 1 A flowchart of a virtual scene processing method provided by an embodiment of the present application.
[0022] Figure 2 An application scenario diagram of a virtual scene processing method provided by an embodiment of the present application.
[0023] Figure 3 An application scenario diagram of another virtual scene processing method provided by an embodiment of the present application.
[0024] Figure 4 An application scenario diagram of another virtual scene processing method provided by an embodiment of the present application.
[0025] Figure 5 An application scenario diagram of another virtual scene processing method provided by an embodiment of the present application.
[0026] Figure 6 An application scenario diagram of another virtual scene processing method provided by an embodiment of the present application.
[0027] Figure 7 A flowchart of another virtual scene processing method provided by an embodiment of the present application.
[0028] Figure 8 A structure block diagram of a virtual scene processing apparatus provided by an embodiment of the present application.
[0029] Figure 9 A structure diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0030] The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative effort also belong to the protection scope of the present application.
[0031] The embodiment of the present application provides a virtual scene processing method, device, computer readable storage medium and computer equipment. Specifically, the virtual scene processing method of the embodiment of the present application can be executed by a computer equipment, wherein the computer equipment can be a terminal or a server and the like. The terminal can be a smart phone, a tablet computer, a notebook computer, a touch screen, a personal computer (PC), a personal digital assistant (PDA) and the like. The server can be a physical server, a server cluster or a distributed system composed of multiple physical servers, a cloud server providing cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN, and basic cloud computing services such as big data and artificial intelligence platform.
[0032] For example, the computer equipment can be a terminal, which can determine a scene space in a virtual scene under a first perspective, and determine a near scene region and a far scene region according to a light-transmitting object in the scene space; set the near scene region according to a three-dimensional model of a near scene object in the near scene region, and set the far scene region according to a face sheet model of a far scene object in the far scene region; obtain an initial template value of a screen pixel point, a material template value of the light-transmitting object, the near scene object and the far scene object; adjust the initial template value of the screen pixel point, the material template value of the near scene object and the far scene object based on the material template value of the light-transmitting object; and render and display the virtual scene based on the material template value of the light-transmitting object and the adjusted material template value of the near scene object and the far scene object.
[0033] Based on the above problems, the embodiment of the present application provides a first virtual scene processing method, device, computer equipment and computer readable storage medium, which can improve the display effect of the virtual scene.
[0034] The following will be described in detail. It should be noted that the order of the following embodiments is not limited as the preferred order of the embodiments.
[0035] The embodiment of the present application provides a virtual scene processing method, which can be executed by a terminal or a server. The embodiment of the present application takes the virtual scene processing method executed by a terminal as an example to illustrate.
[0036] Please refer to Figure 1 , Figure 1 A flowchart of a virtual scene processing method provided by the embodiment of the present application is shown. The specific process of the virtual scene processing method can be as follows:
[0037] 101. determine a scene space in the virtual scene in the first view angle, and determine a near region and a far region according to the light-transmitting object in the scene space.
[0038] In the embodiments of the present application, the virtual scene can be a game scene, different view angles can be switched according to the operation of a game player, and the virtual scenes captured by the virtual camera in different view angles can be different. For example, the view angles can include an indoor view angle, a panoramic view angle, an outdoor view angle, or a view angle from the indoor view angle through the light-transmitting object, etc.
[0039] The first view angle refers to a view angle from the indoor view angle through the light-transmitting object, and the scene space in the first view angle can refer to part of the virtual scene captured by the first view angle.
[0040] In the embodiments of the present application, the virtual scene can include an indoor scene, an outdoor scene, and a light-transmitting object, and the virtual scene can be a three-dimensional scene. The light-transmitting object can be arranged between the indoor scene and the outdoor scene, and is used for light transmission between the indoor scene and the outdoor scene. For example, the light-transmitting object can be a window, the indoor scene includes objects placed inside a room, and the outdoor scene can include a road, trees, etc.
[0041] For example, please refer to Figure 2 , Figure 2 An application scenario diagram of a virtual scene processing method provided in the embodiments of the present application is shown in FIG. 1. Figure 2 As shown in the virtual scene in FIG. 1, the virtual scene includes an indoor scene and an outdoor scene, the indoor scene includes a light-transmitting object, so that part of the outdoor scene can be observed through the light-transmitting object in the indoor scene. When the scene view angle is an indoor scene view angle, the scene appearing in the view angle includes part of the indoor scene and part of the outdoor scene through the light-transmitting object.
[0042] In some embodiments, there is a panoramic view angle. Please refer to Figure 3 , Figure 3 Another application scenario diagram of a virtual scene processing method provided in the embodiments of the present application is shown in FIG. 2. Figure 3 As shown in FIG. 2, the scene picture in the panoramic view angle includes at least part of the indoor scene and at least part of the outdoor scene.
[0043] In some embodiments, in order to reduce the performance consumption of processing the virtual scene, the step of “determining a near region and a far region according to the light-transmitting object in the scene space” can include the following operations:
[0044] determining the near region based on a region in the scene space with a relative distance from the light-transmitting object less than a preset distance;
[0045] determining the far region based on a region in the scene space with a relative distance from the light-transmitting object not less than the preset distance.
[0046] The scene space in the first view angle can include a partial indoor scene, a light-transmitting object, and an outdoor scene. The close-up region can refer to a region in the outdoor scene of the scene space that is relatively close to the light-transmitting object, and the long shot region can refer to a region in the outdoor scene of the scene space that is relatively far from the light-transmitting object.
[0047] Specifically, first, a partial outdoor scene that can be observed from the indoor scene through the light-transmitting object is determined from the outdoor scene of the scene space, then a region with a distance less than a preset distance from the light-transmitting object is selected from the partial outdoor scene to obtain the close-up region, and a region with a distance greater than or equal to the preset distance from the light-transmitting object is selected from the partial outdoor scene to obtain the long shot region.
[0048] For example, refer to Figure 4 , Figure 4 Another application scenario of the virtual scene processing method provided by the embodiments of the present application is shown in the figure. In Figure 4 the virtual scene shown in the figure, a partial outdoor scene that can be observed through the light-transmitting object is determined from the outdoor scene according to the position of the light-transmitting object in the indoor scene, further, a region with a distance less than a preset distance L from the light-transmitting object is determined as the close-up region, and a region with a distance greater than or equal to the preset distance L from the light-transmitting object is determined as the long shot region based on the partial outdoor scene. Then, the models of the objects are placed according to the close-up region and the long shot region.
[0049] 102. The close-up region is set according to the three-dimensional model of the close-up object in the close-up region, and the long shot region is set according to the patch model of the long shot object in the long shot region.
[0050] After the outdoor scene in the scene space is divided into the close-up region and the long shot region relative to the light-transmitting object, in order to ensure the realistic effect of the scene and reduce the performance consumption of the scene processing, a three-dimensional model of a close-up object can be placed in the close-up region, and a patch model of a long shot object can be placed in the long shot region. The three-dimensional model can be a three-dimensional model of an object built by three-dimensional software, including various buildings, characters, vegetation, machinery, etc.; the patch model refers to a planar model of an object built, which can be a plane or a combination of two planes.
[0051] In some embodiments, the step of "setting the close-up region according to the three-dimensional model of the close-up object in the close-up region, and setting the long shot region according to the patch model of the long shot object in the long shot region" can include the following operations:
[0052] The three-dimensional model of the close-up object is set based on the position of the close-up object in the close-up region;
[0053] Set the surface model of the distant object based on its location within the distant area.
[0054] Specifically, the first position of the foreground object in the foreground area in the virtual scene is determined, and the 3D model of the foreground object is placed at the first position; and the second position of the distant virtual object in the distant area in the virtual scene is determined, and the surface model of the distant object is placed at the second position.
[0055] After determining the foreground area, the virtual objects within the foreground area are identified to obtain the foreground objects. Further, the 3D model of the pre-created foreground objects is obtained, and then the 3D model of the foreground objects is placed at the corresponding position of the foreground objects in the foreground area.
[0056] Furthermore, after determining the background area, the virtual objects within the background area are identified to obtain the background objects. Then, the surface model of the pre-created background object is obtained, and the surface model of the background object is placed at the position corresponding to the background object in the background area.
[0057] 103. Obtain the initial template value of the screen pixels, and the material template values of the light-transmitting object, the foreground object, and the background object.
[0058] Specifically, the initial template values of the stored screen pixels can be obtained from the template buffer.
[0059] Screen pixels include all the pixels on the display screen.
[0060] In this embodiment, the stencil buffer is used to store an unsigned integer value (generally a value between 0 and 255) for each pixel on the screen in the rendering pipeline, which is the initial stencil value. The specific meaning of this value depends on the specific application of the program.
[0061] The template value is used as follows: during rendering, the template value of each screen pixel is compared with a pre-set reference value. Based on the comparison result and pre-set instruction parameters, it is determined whether to update the color value of the corresponding pixel on the screen. This comparison process is called template testing. If the template test passes, the corresponding pixel is updated; otherwise, it is not. When template testing is initiated, pixels that pass the test are replaced in the color buffer and displayed, while those that fail are not saved in the color buffer, thus achieving a filtering function.
[0062] In the rendering program, materials are a combination of various visible attributes of the object model's surface. These visible attributes can include the surface's color, texture, smoothness, transparency, reflectivity, refractive index, luminosity, etc.
[0063] In the embodiments of the present application, a material template value is set in the material of each object included in the virtual scene, and the material template value is used for template testing with the template value of the screen pixel point to determine the object that passes the template testing and is displayed. The material template value of the object created in the material can be a default value, and the default value is in the range of the template value, i.e., 0-255. For example, the default value can be 0.
[0064] In some embodiments, before the initial template value of the screen pixel point and the material template values of the light-transmitting object, the close-range object and the far-range object are obtained, the method can further include the following steps:
[0065] The initial material template value of the light-transmitting object is obtained, and the initial material template value is adjusted to a value different from the initial template value to obtain the material template value of the light-transmitting object.
[0066] Specifically, the material template value of the light-transmitting object is modified from the default value to a first value, and the difference between the first value and the initial template value of the screen pixel point is not equal to the template value difference.
[0067] In the embodiments of the present application, the template value difference that passes the template testing is set in advance. For example, the template value difference can be 0, i.e., the material template value of the object is compared with the template value of the screen pixel point, and if the material template value of the object is equal to the template value of the screen pixel point and the test condition of the template testing is equal to pass, it means that the object passes the template testing, and in combination with the depth testing, the object can be displayed through the screen pixel point.
[0068] In the embodiments of the present application, the instruction for setting the material template value of the light-transmitting object is as follows:
[0069] Stecil{Ref 5 Comp always};
[0070] Wherein, Stecil{} represents the template testing; Ref 5 represents that the material template value of the light-transmitting object is set to 5; Comp is used to specify the comparison function, and the Comp instruction is responsible for setting the condition that the object template value passes the initial template value of the template buffer, and the Comp instruction is set to always, which means that the light-transmitting object always passes the template testing regardless of the material template value.
[0071] Specifically, the obtained material template value of the light-transmitting object can be a first value, and the material template values of the close-range object and the far-range object can be default values.
[0072] 104、Based on the material template value of the light-transmitting object, the initial template value of the screen pixel point, the material template values of the close-range object and the far-range object are adjusted.
[0073] In some embodiments, adjusting the initial template value of the screen pixel, the material template value of the near object and the material template value of the far object based on the material template value of the light-transmitting object respectively comprises:
[0074] determining the pixel to be adjusted corresponding to the position of the light-transmitting object from the screen pixel;
[0075] updating the initial template value of the pixel to be adjusted as the material template value of the light-transmitting object;
[0076] determining the object to be adjusted corresponding to the position of the light-transmitting object from the near object and the far object;
[0077] updating the material template value of the object to be adjusted as the material template value of the light-transmitting object.
[0078] Specifically, adjusting the initial template value of the screen pixel can be template test updating the initial template value of the screen pixel corresponding to the light-transmitting object appearing in the scene space according to the material template value of the light-transmitting object appearing in the scene space, to obtain the updated template value of the template buffer.
[0079] In the embodiments of the present application, the implementation instruction of template test updating the initial template value of the screen pixel corresponding to the light-transmitting object appearing in the scene space can be as follows:
[0080] Pass replace;
[0081] Pass refers to the operation performed when the template test is passed, and replace indicates the operation of replacing the initial template value of the screen pixel, that is, when the material template value of the light-transmitting object appearing in the scene space passes the template test, the template value updating operation of replacing the material template value of the light-transmitting object appearing in the scene space as the initial template value of the screen pixel is performed.
[0082] For example, refer to Figure 5 , Figure 5 Another application scenario diagram of the processing method of the virtual scene provided in the embodiments of the present application is shown in the display screen. Figure 5 As shown in the display screen, it includes the scene space under the first perspective in the virtual scene and the light-transmitting object in the scene space, according to the corresponding position of the light-transmitting object in the display screen, the screen pixel at the corresponding position, that is, the candidate pixel, is obtained, and then the initial template value of these candidate pixels is replaced by the material template value in the material of the light-transmitting object, for example, the initial template value of all screen pixels in the display screen can be 0, and the material template value in the material of the light-transmitting object can be 5, then the initial template value of the candidate pixel in all screen pixels in the display screen is replaced by 5 from 0, and the initial template value of other screen pixels remains unchanged, thereby obtaining the updated template value of the template buffer.
[0083] In the embodiment of the present application, the initial template value of the screen pixel point corresponding to the light-transmitting object is replaced from 0 to 5 (i.e. the material template value of the light-transmitting object is set to 5), which is to make the material template value of the object in the outdoor scene corresponding to the light-transmitting object to be set to the material template value of the light-transmitting object when the material template value of the light-transmitting object satisfies the condition of passing the template test, so that the object can be displayed through the light-transmitting object, and otherwise, the object cannot be displayed.
[0084] Specifically, the adjustment of the material template value of the close-range object and the far-range object can be: modifying the material template value of the three-dimensional model of the close-range object and the patch model of the far-range object corresponding to the position of the light-transmitting object in the scene space to a second value.
[0085] The difference between the second value and the first value is equal to the template value difference corresponding to the passing of the template test, and the difference between the first value and the initial template value is not equal to the template value difference, i.e. the first value is equal to the second value, so as to ensure that when the light-transmitting object passes the template test, the three-dimensional model and / or patch model corresponding to the same pixel point in the screen pixel point can also pass the template test; the second value is not equal to the initial template value, which can ensure that the three-dimensional model and / or patch model in the scene space cannot pass the template test of the initial template value of the screen pixel point. Further, the three-dimensional model and / or patch model in the scene space can only be displayed through the light-transmitting object.
[0086] Specifically, the instructions for setting the material template value of the three-dimensional model or the patch model are as follows:
[0087] Stecil{Ref 5 Comp equal};
[0088] Wherein, Ref 5 represents setting the material template value of the three-dimensional model or the patch model in the outdoor scene to 5, and the Comp instruction is set to equal, which means that the three-dimensional model or the patch model passes the template test when the material template value of the three-dimensional model or the patch model is equal to the template value of the template buffer.
[0089] In some embodiments, the scene space can also include a non-light-transmitting object, and the method can further include the following steps:
[0090] Determining the pixel point corresponding to the non-light-transmitting object from the screen pixel point;
[0091] Adjusting the material template value of the non-light-transmitting object to be the same as the template value of the pixel point corresponding to the non-light-transmitting object.
[0092] Wherein, the non-light-transmitting object can be an object in an indoor scene.
[0093] Firstly, the pixel points corresponding to the positions of the non-light-transmitting objects are determined from the screen pixel points, and the material template value of the non-light-transmitting object is set as the template value of the corresponding pixel point. For example, the material template value of the non-light-transmitting object can be a preset value, and the difference between the preset value and the initial template value is equal to the template difference corresponding to the template test passing. That is, when the indoor scene collected by the scene space of the first view angle includes the light-transmitting object and the non-light-transmitting object, the present scheme sets to display the outdoor scene only through the corresponding pixel points of the light-transmitting object in the screen pixel points, and the corresponding pixel points of the non-light-transmitting object in the screen pixel points only display the non-light-transmitting object.
[0094] 105. rendering the virtual scene based on the material template value of the light-transmitting object and the adjusted material template values of the near object and the far object.
[0095] Specifically, rendering the virtual scene based on the material template value of the light-transmitting object and the adjusted material template values of the near object and the far object can be to respectively perform template tests on the material template value of the light-transmitting object, the material template value of the near object, and the material target value of the far object and the template value of the corresponding screen pixel point, to determine the light-transmitting object, the near object, and the far object displayed through the screen pixel point, and obtain the rendering result of the scene space under the first view angle.
[0096] In some embodiments, rendering the virtual scene based on the material template value of the light-transmitting object and the adjusted material template values of the near object and the far object includes:
[0097] determining the target pixel points corresponding to the light-transmitting object, the near object, and the far object in the screen pixel points, respectively;
[0098] performing template test processing on the material template value of the light-transmitting object, the adjusted material template value of the near object, and the adjusted material template value of the far object and the adjusted template value of the corresponding target pixel point, respectively, to determine the target object displayed through the target pixel point.
[0099] The light-transmitting object is configured to always pass the template test, which can be realized by the comparison instruction of Comp always.
[0100] In the embodiments of the present application, the screen pixel points can constitute a pixel point matrix, and further, the target pixel points corresponding to the positions of the objects (at least including the non-light-transmitting object of the indoor scene and the near / far object of the outdoor scene) in the scene space are determined from the pixel point matrix.
[0101] The target pixel point corresponding to the object of the indoor scene in the scene space and the target pixel point corresponding to the object of the outdoor scene in the scene space can be the same pixel point. Then, the template test is performed on each object in the scene space based on the updated template value of the corresponding target pixel point.
[0102] In some embodiments, the material template value of the light-transmitting object, the adjusted material template value of the close-range object, and the adjusted material template value of the far-range object are respectively compared with the adjusted template value of the corresponding target pixel point.
[0103] The material template value of the light-transmitting object, the adjusted material template value of the close-range object, and the adjusted material template value of the far-range object are respectively compared with the adjusted template value of the corresponding target pixel point.
[0104] The object whose material template value is the same as the adjusted template value of the target pixel point is determined, and the target object displayed through the target pixel point is obtained.
[0105] In some embodiments, in order to make the object corresponding to the light-transmitting object in the outdoor scene pass the template test with the updated template value and then be displayed, the material template value of each object can be compared with the updated template value of the corresponding target pixel point, and a template value comparison result is obtained. Based on the template value comparison result, the object whose material template value is equal to the updated template value of the target pixel point is determined, and the target object in the scene space displayed through the target pixel point is obtained.
[0106] For example, please refer to Figure 6 , Figure 6 Another application scenario diagram of the processing method of the virtual scene provided by the embodiments of the present application is shown in the following figure. Figure 6 In the display screen shown in the figure, the screen pixel points are arranged as a pixel point matrix according to the display screen, including: pixel point 1, pixel point 2, pixel point 3, pixel point 4,..., pixel point 35. The pixel points corresponding to the positions of the light-transmitting object can include: pixel point 9, pixel point 10, pixel point 11, pixel point 16, pixel point 17, and pixel point 18. The updated template value of the pixel point corresponding to the position of the light-transmitting object is the same as the material template value of the light-transmitting object, which can be 5, and the initial template value of the other pixel points is not updated, which can be the initial template value: 0.
[0107] Further, the material template value of each object in the scene space is compared with the template value of the screen pixel point corresponding to each object, and the object of the scene space equal to the template value of the screen pixel point is determined.
[0108] For details, please continue to refer to Figure 6The light-transmitting object and the object corresponding to the positions of the pixel points 9, 10, 11, 16, 17 and 18 in the outdoor scene are displayed, and the non-light-transmitting object in the indoor scene is displayed through other pixel points, so as to realize the effect of displaying the outdoor scene through the light-transmitting object.
[0109] In some embodiments, when the view angle is switched, in order to ensure the performance effect of the virtual scene, the method can further include the following steps:
[0110] If the current view angle is switched from the first view angle to the second view angle, the material template values of the near-view object and the far-view object are adjusted to values different from the template values of the screen pixel points.
[0111] The second view angle can be an outdoor view angle or a panoramic view angle.
[0112] Specifically, after the view angle is switched from the first view angle to the second view angle, the second scene space collected by the virtual camera under the second view angle is obtained, the screen pixel points corresponding to the near-view object and the far-view object in the second scene are further determined, and the material template values of the near-view object and the far-view object in the second scene are adjusted based on the template values of the screen pixel points corresponding to the near-view object and the far-view object.
[0113] In the panoramic view angle, the near-view object and the far-view object in the outdoor scene need to be ensured not to be exposed, so at this time, the near-view object and the far-view object in the outdoor scene are not displayed, and the material template values of the near-view object and the far-view object in the second scene are adjusted to be different from the template values of the corresponding screen pixel points, so that the three-dimensional model of the outdoor scene is not displayed. For example, when the scene view angle is converted from the indoor view angle to the outdoor view angle, the three-dimensional model and the two-dimensional patch model placed outdoors cannot be seen, so as to solve the problem that too many models placed outdoors cause the outdoor scene to be messy and not tidy, and the patch causes the outdoor scene to be exposed.
[0114] In some embodiments, in order to ensure the display effect of displaying the outdoor scene through the light-transmitting object, the method can further include the following steps:
[0115] The material color value of the light-transmitting object is adjusted to realize the transparent effect of the light-transmitting object.
[0116] In the embodiments of the present application, the three-dimensional model and / or two-dimensional patch in the outdoor scene actually need to be seen through the light-transmitting object, so the transparent effect of the light-transmitting object needs to be set, and the specific implementation instruction can be as follows:
[0117] ColorMask0;
[0118] ColorMask0 means that the color value of the light-transmitting object is not written.
[0119] In some embodiments, to ensure the display effect of displaying the outdoor scene through the light-transmitting object, the method can further include the following steps:
[0120] Turning off the depth test of the light-transmitting object, so that all the close-range objects and / or long-range objects in the outdoor scene corresponding to the same pixel point in the screen pixel point as the light-transmitting object are displayed through the light-transmitting object.
[0121] In the embodiments of the present application, to prevent the light-transmitting object from removing the objects behind the light-transmitting object, i.e., to prevent the light-transmitting object from removing all the close-range objects and / or long-range objects in the outdoor scene corresponding to the same pixel point in the screen pixel point as the light-transmitting object, the depth test of the light-transmitting object can be turned off, and the specific implementation instruction can be as follows:
[0122] ZWite OFF;
[0123] ZWite OFF means turning off the depth test and depth writing.
[0124] The embodiments of the present application disclose a processing method of a virtual scene, which includes: determining a scene space in a first view angle in the virtual scene, and determining a close-range region and a long-range region according to a light-transmitting object in the scene space; setting the close-range region according to a three-dimensional model of a close-range object in the close-range region, and setting the long-range region according to a face sheet model of a long-range object in the long-range region; obtaining an initial template value of a screen pixel point, and material template values of the light-transmitting object, the close-range object and the long-range object; adjusting the initial template value of the screen pixel point, the material template values of the close-range object and the long-range object based on the material template value of the light-transmitting object; and rendering and displaying the virtual scene based on the material template value of the light-transmitting object and the adjusted material template values of the close-range object and the long-range object, so as to improve the display effect of the virtual scene.
[0125] According to the above introduction, the processing method of the virtual scene of the present application will be further illustrated by examples. Please refer to Figure 7 , Figure 7 Another flowchart of the processing method of the virtual scene provided by the embodiments of the present application is provided, and the processing method of the virtual scene is taken as an example applied to a server, and the specific process can be as follows:
[0126] 201, the server collects a virtual scene space in a specified view angle in a game scene.
[0127] In the embodiments of the present application, the game scene refers to the complete game scene of the target game, and the game scene can include static or dynamic virtual objects or virtual objects. Since the game scene can be displayed in the form of a picture on the display screen of the terminal device, the game scene can be captured to generate a game picture according to different perspectives, that is, the player's line of sight, and displayed on the display screen in the target game.
[0128] The game play includes many perspectives, such as an indoor perspective, that is, the player's line of sight can only see the indoor scene; a panoramic perspective, that is, the player can see both the indoor scene and the outdoor scene, or a window that can simultaneously see the indoor and outdoor scenes.
[0129] Specifically, the game scene can be a three-dimensional scene, and the game scene can include an indoor scene and an outdoor scene. The indoor scene can be placed with a target virtual object, and the target virtual object can be a glass window, so that the game player can look at the outdoor scene through the glass window of the indoor scene in the game scene.
[0130] The specified perspective can be an indoor-to-outdoor perspective or a panoramic perspective. The virtual scene control is the scene space in the game scene under the specified perspective.
[0131] In the embodiments of the present application, the outdoor scene can be built according to the basic rule of scene building designed in the present application, that is, when building an indoor scene with a large number of glass structures, in order to meet the requirement that the indoor glass window can see the 3D scene of the outdoor, some 3D models can be placed near the close-up of the outdoor scene outside the glass window, and some patches can be placed at the distant view of the outdoor scene, so as to realize the effect of the 3D outdoor scene.
[0132] The object at the distant view is selected in the form of a patch because the patch has relatively fewer vertices and faces than the three-dimensional model, and has better performance for real-time rendering games. In addition, when the player's line of sight looks from the glass window to the outdoor scene, the distant object will be partially blocked by the near object, so the distant object can use some cross patches to visually create the illusion of a complete outdoor scene effect.
[0133] 202. The server acquires the default template value of the screen pixel point stored in the template buffer.
[0134] The default template value refers to the unsigned integer value (with a value of 0-255) corresponding to each pixel stored in the template buffer. The specific use of the default template value can be: comparing the default template value with a pre-set reference value, and determining whether to update the color value of the corresponding pixel according to the comparison result and some special instructions, that is, applied to template testing.
[0135] 203、The server acquires the material template value of each virtual object in the virtual scene space, and performs stencil test update on the default stencil value of the screen pixel point based on the template value of the material of the target virtual object, to obtain the updated stencil value of the screen pixel point.
[0136] In the embodiments of the present application, special materials are added to the target virtual object (glass window) in the virtual scene space and the three-dimensional model and patch in the outdoor scene. The special materials can be made by using the basic rule for solving the problem of the disorder and exposure of the outdoor model after the indoor scene is built. By adding special materials to the glass window and the close-up and long-range models and patches in the outdoor scene, the outdoor scene is made into a pure color space in which no model can be seen. However, the indoor scene can still show the 3D scene effect when viewed from the glass window.
[0137] Specifically, the principle of making the special materials can be as follows: the special materials are mainly realized by using the stencil in the rendering pipeline. The stencil contains many instructions, and by setting the instructions, the pixels on the screen in different cases can be selected for retention. For example, the stencil can include the following instruction functions:
[0138] Ref: setting the stencil value of the object;
[0139] ReadMask: read mask;
[0140] WriteMask: write mask;
[0141] Comp: comparison operation function, that is, under what size condition, the stencil test passes and the pixel can be rendered;
[0142] Pass: test pass, and the operation that can be performed in the stencil buffer;
[0143] Fail: test fail, and the operation performed thereafter;
[0144] ZFail: stencil test pass, and the operation performed after the depth test (used to determine which objects are displayed and which objects are not displayed) fails.
[0145] Further, the stencil value in the stencil buffer and some special instruction functions are set in the materials of the glass window and the outdoor object. Since the default stencil value set in the stencil buffer is 0, that is, Ref is 0, and the outdoor object cannot be displayed in general, that is, it does not pass the Ref value in the default buffer, and can only be displayed through the glass window, that is, it can only pass the Ref value of the glass. Therefore, the Ref value of the glass window and the default stencil buffer cannot be equal.
[0146] First, the glass window material is rendered, the template value corresponding to the glass window in the template buffer is modified, and the template value in the glass window material buffer is set to any value greater than 0, that is, Ref is set to any value greater than 0; in order to make the glass window normally drawn on the screen, the Comp instruction can be set, and Comp is set to always so that the template value of the window always passes;
[0147] The value of Pass is set to Pass replace, that is, the template value in the passed part will replace the default template value in the template buffer.
[0148] Among them, since the glass window should be transparent, the actual need to see the object model outside the window through the transparent glass window, therefore, set any color value of the glass is not written, that is: ColorMask 0. At the same time, close the depth test and depth write ZWite OFF, prevent because of the depth relationship caused by the glass window will be removed behind the glass window object. The other part of the material is normally colored.
[0149] Specifically, the material added to the glass window is implemented as follows:
[0150] Stecil{Ref 5Comp always Pass replace}ColorMask 0ZWrite off.
[0151] Then, the template value of the object material in the outdoor scene outside the glass window is set to the same value as the glass material, that is, Ref is set to any value greater than 0, but the same as the template value of the glass window. Set the comparison command to equal to pass, that is, Comp equal. At this time, only when the template values are equal can they be displayed, so the outdoor objects can only be displayed through the glass window, otherwise they will not be displayed. The other part of the material is normally colored.
[0152] Specifically, the material added to the three-dimensional model and the face model outside the window is implemented as follows:
[0153] Stecil{Ref 5Comp equal}.
[0154] 204、The server performs template testing on each virtual object in the virtual scene space based on the updated template value to determine the target virtual object in the virtual scene space that is displayed through the screen pixel point.
[0155] Further, based on the updated stencil value of the screen pixel point in the stencil buffer, the virtual scene control is tested for each virtual object in the virtual scene, and the target virtual object that passes the stencil test is determined according to the test result, that is, the target virtual object can be rendered through the screen pixel point.
[0156] In the embodiment of the present application, by adding a special material to the glass window and the virtual object in the outdoor scene, the object model in the outdoor scene can only be seen from the glass window material, and when the view angle is switched out of the glass material, the object model in the outdoor scene is hidden and cannot be seen. At this time, what is seen under the outdoor view angle can be a solid color, which can avoid the problem of appearing as a face piece. In this way, the indoor and outdoor scene performances are handled friendly while meeting the performance pressure.
[0157] The present scheme divides the objects in the outdoor scene into a close-up area and a distant area according to the distance between the objects and the light-transmitting object in the indoor scene based on the real-time rendering of the game when the indoor scene and the outdoor scene of the virtual scene are built, and then places a three-dimensional model of the object in the close-up area and a face piece model of the object in the distant area, so as to ensure the display effect of the outdoor scene under the indoor scene view angle and reduce the resources for processing the virtual scene. Further, the present scheme adds a material with a stencil setting to the light-transmitting object, the three-dimensional model, and the face piece model, controls the three-dimensional model and the face piece model of the outdoor scene to be displayed only through the light-transmitting object, so as to ensure that when the indoor scene view angle is switched to the outdoor scene view angle or the panoramic view angle, the three-dimensional model placed in the outdoor scene does not cause the display of the outdoor scene to be messy, and the face piece model does not cause the problem of appearing as a face piece, thereby improving the display effect of the virtual scene.
[0158] The embodiment of the present application discloses a virtual scene processing method, which comprises the following steps: a server collects a virtual scene space under a specified view angle in a game scene, obtains a default stencil value of a screen pixel point stored in a stencil buffer, obtains a material stencil value of each virtual object in the virtual scene space, and performs stencil test and update on the default stencil value of the screen pixel point based on the material stencil value of the target virtual object, to obtain an updated stencil value of the screen pixel point. Based on the updated stencil value, the virtual scene control is tested for each virtual object in the virtual scene space, to determine the target virtual object in the virtual scene space that passes the screen pixel point display. In this way, the display effect of the virtual scene is improved.
[0159] In order to better implement the virtual scene processing method provided by the embodiment of the present application, the embodiment of the present application further provides a virtual scene processing device based on the above virtual scene processing method. The meanings of the terms are the same as those in the above virtual scene processing method, and the specific implementation details can be referred to the description in the method embodiment.
[0160] Referring to Figure 8 , Figure 8 A structural block diagram of a processing device of a virtual scene is provided for an embodiment of the present application, and the device comprises:
[0161] A first determining unit 301 is configured to determine a scene space in a virtual scene under a first view angle, and determine a near region and a far region according to a light-transmitting object in the scene space;
[0162] A setting unit 302 is configured to set the near region according to a three-dimensional model of a near object in the near region, and set the far region according to a patch model of a far object in the far region;
[0163] An obtaining unit 303 is configured to obtain an initial template value of a screen pixel point, and material template values of the light-transmitting object, the near object and the far object;
[0164] A first adjusting unit 304 is configured to adjust the initial template value of the screen pixel point, and the material template values of the near object and the far object based on the material template value of the light-transmitting object, respectively;
[0165] A rendering unit 305 is configured to render and display the virtual scene based on the material template value of the light-transmitting object, and the material template values of the near object and the far object after adjustment.
[0166] In some embodiments, the first determining unit 301 can comprise:
[0167] A first determining sub-unit is configured to determine the near region based on a region in the scene space with a relative distance from the light-transmitting object less than a preset distance;
[0168] A second determining sub-unit is configured to determine the far region based on a region in the scene space with a relative distance from the light-transmitting object not less than the preset distance.
[0169] In some embodiments, the adjusting unit 304 can comprise:
[0170] A third determining sub-unit is configured to determine, from the screen pixel points, a to-be-adjusted pixel point corresponding to a position of the light-transmitting object;
[0171] A first updating sub-unit is configured to update an initial template value of the to-be-adjusted pixel point to the material template value of the light-transmitting object;
[0172] A fourth determining sub-unit is configured to determine, from the near object and the far object, a to-be-adjusted object corresponding to the position of the light-transmitting object;
[0173] The second updating sub-unit is configured to update the material template value of the object to be adjusted to the material template value of the light-transmitting object.
[0174] In some embodiments, the rendering unit 305 can include:
[0175] The fifth determining sub-unit is configured to determine target pixel points corresponding to the light-transmitting object, the near-view object and the far-view object in the screen pixel points.
[0176] The adjusting sub-unit is configured to perform template test processing on the material template value of the light-transmitting object, the adjusted material template value of the near-view object and the adjusted material template value of the far-view object respectively and the adjusted template value of the corresponding target pixel point, and determine a target object displayed through the target pixel point.
[0177] In some embodiments, the adjusting sub-unit can be specifically configured to:
[0178] compare the material template value of the light-transmitting object, the adjusted material template value of the near-view object and the adjusted material template value of the far-view object respectively with the adjusted template value of the corresponding target pixel point;
[0179] determine an object with the same material template value as the adjusted template value of the target pixel point, and obtain a target object displayed through the target pixel point.
[0180] In some embodiments, the device can further include:
[0181] The second adjusting unit is configured to adjust the material template values of the near-view object and the far-view object to values different from the template values of the screen pixel points if the current view angle is switched from the first view angle to a second view angle.
[0182] In some embodiments, the device can further include:
[0183] The third adjusting unit is configured to adjust the material color value of the light-transmitting object to make the light-transmitting object achieve a transparent effect.
[0184] In some embodiments, the setting unit 302 can include:
[0185] The first setting sub-unit is configured to set a three-dimensional model of the near-view object based on a position where the near-view object is located in the near-view region.
[0186] The second setting sub-unit is configured to set a patch model of the far-view object based on a position where the far-view object is located in the far-view region.
[0187] In some embodiments, the device can further include:
[0188] The fourth adjustment unit is used to obtain the initial material template value of the light-transmitting object and adjust the initial material template value to a value different from the initial template value to obtain the material template value of the light-transmitting object.
[0189] In some embodiments, the device may further include:
[0190] The second determining unit is used to determine the pixel corresponding to the non-transparent object from the screen pixels;
[0191] The fifth adjustment unit is used to adjust the material template value of the non-transparent object to be the same as the template value of the pixel corresponding to the non-transparent object.
[0192] This application discloses a virtual scene processing device. A first determining unit 301 determines the scene space in the virtual scene from a first perspective, and determines a near-field region and a far-field region based on translucent objects in the scene space. A setting unit 302 sets the near-field region based on the 3D model of the near-field object in the near-field region, and sets the far-field region based on the surface model of the far-field object in the far-field region. An acquiring unit 303 acquires the initial template value of screen pixels, and the material template values of the translucent object, the near-field object, and the far-field object. A first adjusting unit 304 adjusts the initial template value of the screen pixels, the material template values of the near-field object, and the far-field object based on the material template value of the translucent object. A rendering unit 305 renders and displays the virtual scene based on the material template value of the translucent object and the adjusted material template values of the near-field object and the far-field object. This improves the display effect of the virtual scene.
[0193] Accordingly, embodiments of this application also provide a computer device, which can be a terminal. For example... Figure 9 As shown, Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device 500 includes a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, and a computer program stored on the memory 502 and executable on the processor. The processor 501 and the memory 502 are electrically connected. Those skilled in the art will understand that the computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0194] The processor 501 is a control center of the computer device 500, connects various parts of the computer device 500 through various interfaces and lines, executes various functions of the computer device 500 and processes data by running or loading software programs and / or modules stored in the memory 502 and calling data stored in the memory 502, and thus monitors the computer device 500 as a whole.
[0195] In the embodiments of the present application, the processor 501 in the computer device 500 loads the instructions corresponding to the processes of one or more application programs into the memory 502, and runs the application programs stored in the memory 502 by the processor 501, so as to realize various functions according to the following steps:
[0196] determining a scene space in a first perspective in the virtual scene, and determining a near region and a far region according to a light-transmitting object in the scene space;
[0197] setting the near region according to a three-dimensional model of a near object in the near region, and setting the far region according to a face model of a far object in the far region;
[0198] obtaining an initial template value of a screen pixel, a material template value of the light-transmitting object, the near object and the far object;
[0199] adjusting the initial template value of the screen pixel, the material template value of the near object and the far object based on the material template value of the light-transmitting object, respectively;
[0200] rendering and displaying the virtual scene based on the material template value of the light-transmitting object and the adjusted material template value of the near object and the far object.
[0201] In some embodiments, determining the near region and the far region according to the light-transmitting object in the scene space comprises:
[0202] determining the near region based on a region in the scene space having a relative distance from the light-transmitting object less than a preset distance;
[0203] determining the far region based on a region in the scene space having a relative distance from the light-transmitting object not less than the preset distance.
[0204] In some embodiments, adjusting the initial template value of the screen pixel, the material template value of the near object and the far object based on the material template value of the light-transmitting object, respectively, comprises:
[0205] determining a to-be-adjusted pixel corresponding to a position of the light-transmitting object from the screen pixel;
[0206] updating an initial template value of the to-be-adjusted pixel to a material template value of the light-transmitting object.
[0207] determining the object to be adjusted corresponding to the position of the light-transmitting object from the near-object and the far-object;
[0208] updating the material template value of the object to be adjusted as the material template value of the light-transmitting object.
[0209] In some embodiments, the virtual scene is rendered based on the material template value of the light-transmitting object and the adjusted material template values of the near-object and the far-object, including:
[0210] determining the target pixel corresponding to the light-transmitting object, the near-object and the far-object in the screen pixel;
[0211] performing template test processing on the material template value of the light-transmitting object, the adjusted material template value of the near-object and the adjusted material template value of the far-object respectively with the adjusted template value of the corresponding target pixel, to determine the target object displayed through the target pixel.
[0212] In some embodiments, performing template test processing on the material template value of the light-transmitting object, the adjusted material template value of the near-object and the adjusted material template value of the far-object respectively with the adjusted template value of the corresponding target pixel, to determine the target object displayed through the target pixel, includes:
[0213] comparing the material template value of the light-transmitting object, the adjusted material template value of the near-object and the adjusted material template value of the far-object respectively with the adjusted template value of the corresponding target pixel;
[0214] determining the object with the same material template value as the adjusted template value of the target pixel, to obtain the target object displayed through the target pixel.
[0215] In some embodiments, the method further includes:
[0216] adjusting the material template values of the near-object and the far-object to values different from the template value of the screen pixel if the current view angle is switched from the first view angle to the second view angle.
[0217] In some embodiments, the method further includes:
[0218] adjusting the material color value of the light-transmitting object to achieve the transparent effect of the light-transmitting object.
[0219] In some embodiments, the near region is set according to the three-dimensional model of the near-object in the near region, and the far region is set according to the patch model of the far-object in the far region, including:
[0220] setting a three-dimensional model of the close-range object based on a position where the close-range object in the close-range region is located;
[0221] setting a patch model of the far-range object based on a position where the far-range object in the far-range region is located.
[0222] In some embodiments, before obtaining the initial template value of the screen pixel point, and the material template value of the see-through object, the close-range object and the far-range object, the method further comprises:
[0223] obtaining an initial material template value of the see-through object, and adjusting the initial material template value to a value different from the initial template value to obtain the material template value of the see-through object.
[0224] In some embodiments, the scene space further comprises a non-see-through object, and the method further comprises:
[0225] determining a pixel point corresponding to the non-see-through object from the screen pixel point;
[0226] adjusting the material template value of the non-see-through object to be the same as the template value of the pixel point corresponding to the non-see-through object.
[0227] The embodiments of the present application determine the scene space in the virtual scene under the first perspective, and determine the close-range region where the distance to the see-through object is less than the preset distance, and the far-range region where the distance to the see-through object is not less than the preset distance according to the see-through object in the scene space. Then, the close-range region is set according to the three-dimensional model of the close-range object in the close-range region, and the far-range region is set according to the patch model of the far-range object in the far-range region. Further, the initial template value of the screen pixel point, and the material template value of the see-through object, the close-range object and the far-range object are obtained. The initial template value of the screen pixel point, the material template value of the close-range object and the far-range object are adjusted based on the material template value of the see-through object. The virtual scene is rendered and displayed based on the material template value of the see-through object, and the adjusted material template value of the close-range object and the far-range object, so as to improve the display effect of the virtual scene.
[0228] The specific implementation of each operation can be referred to the foregoing embodiments, which will not be described here.
[0229] Optionally, as shown in Figure 9 The computer device 500 further includes a touch display screen 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506 and a power supply 507. The processor 501 is electrically connected with the touch display screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506 and the power supply 507 respectively. Those skilled in the art can understand that the computer device 500 can further include other components, which will not be described here. Figure 9The computer device structure shown in the figure is not a limitation of the computer device, and can include more or fewer components than shown, or combine certain components, or arrange different components.
[0230] The touch display screen 503 can be used to display a graphical user interface and receive operation instructions generated by user acting on the graphical user interface. The touch display screen 503 can include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user and various graphical user interfaces of the computer device, which can be composed of graphics, guidance information, icons, videos and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. The touch panel can be used to collect touch operations (such as user operations on or near the touch panel using a finger, a stylus or any suitable object or accessory) of the user thereon or therearound, and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel can include two parts of a touch detection device and a touch controller. The touch detection device detects the touch position of the user and detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, and converts it into touch coordinates, and then sends it to the processor 501, and can also receive commands from the processor 501 and execute them. The touch panel can cover the display panel, and when the touch panel detects a touch operation thereon or therearound, it transmits to the processor 501 to determine the type of the touch event, and then the processor 501 provides corresponding visual output on the display panel according to the type of the touch event. In the embodiments of the present application, the touch panel and the display panel can be integrated into the touch display screen 503 to realize input and output functions. However, in some embodiments, the touch panel and the touch panel can realize input and output functions as two independent components. That is, the touch display screen 503 can also realize input functions as part of the input unit 506.
[0231] The radio frequency circuit 504 can be used to transceive radio frequency signals to establish wireless communication with network devices or other computer devices, and transceive signals between network devices or other computer devices.
[0232] The audio circuit 505 can be used to provide an audio interface between a user and the computer device through a speaker and a microphone. The audio circuit 505 can convert received audio data into an electrical signal and transmit the electrical signal to the speaker for conversion into an audible signal. On the other hand, the microphone can collect a sound signal and convert the sound signal into an electrical signal, which is received by the audio circuit 505 and converted into audio data. The audio data can be output to the processor 501 for processing, transmitted to another computer device via the radio frequency circuit 504, or output to the memory 502 for further processing. The audio circuit 505 can also include a jack for a headset to provide communication between the headset and the computer device.
[0233] The input unit 506 can be used to receive inputted digital, character information or user feature information (e.g., fingerprint, iris, face information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user placement and function control.
[0234] The power supply 507 is used to supply power to various components of the computer device 500. Optionally, the power supply 507 can be logically connected to the processor 501 through a power management system, so that the power management system can be used to manage charging, discharging, and power consumption management. The power supply 507 can also include one or more direct current or alternating current power sources, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and any other components.
[0235] Although Figure 9 The computer device 500 can also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which are not shown in the figure.
[0236] In the above embodiments, the description of each embodiment focuses on different aspects, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0237] As can be seen from the above, the computer device provided in the embodiment can determine a scene space in a first perspective in a virtual scene, and determine a near scene region and a far scene region according to a light-transmitting object in the scene space; set the near scene region according to a three-dimensional model of a near scene object in the near scene region, and set the far scene region according to a face model of a far scene object in the far scene region; obtain an initial template value of a screen pixel, a material template value of the light-transmitting object, the near scene object, and the far scene object; adjust the initial template value of the screen pixel, the material template value of the near scene object, and the material template value of the far scene object based on the material template value of the light-transmitting object; and render and display the virtual scene based on the material template value of the light-transmitting object, and the material template values of the near scene object and the far scene object after adjustment.
[0238] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling relevant hardware by instructions, which can be stored in a computer readable storage medium and loaded and executed by a processor.
[0239] To this end, the embodiments of the present application provide a computer readable storage medium, which stores a plurality of computer programs capable of being loaded by a processor to execute the steps in any of the processing methods of the virtual scene provided by the embodiments of the present application. For example, the computer program can execute the following steps:
[0240] determining a scene space in the virtual scene under a first perspective, and determining a near region and a far region according to a light-transmitting object in the scene space;
[0241] setting the near region according to a three-dimensional model of a near object in the near region, and setting the far region according to a face sheet model of a far object in the far region;
[0242] obtaining an initial template value of a screen pixel, a material template value of the light-transmitting object, the near object and the far object;
[0243] adjusting the initial template value of the screen pixel, the material template value of the near object and the far object based on the material template value of the light-transmitting object, respectively;
[0244] rendering and displaying the virtual scene based on the material template value of the light-transmitting object and the adjusted material template value of the near object and the far object.
[0245] In some embodiments, determining the near region and the far region according to the light-transmitting object in the scene space comprises:
[0246] determining the near region based on a region in the scene space having a relative distance from the light-transmitting object less than a preset distance;
[0247] determining the far region based on a region in the scene space having a relative distance from the light-transmitting object not less than the preset distance.
[0248] In some embodiments, adjusting the initial template value of the screen pixel, the material template value of the near object and the far object based on the material template value of the light-transmitting object, respectively, comprises:
[0249] determining a to-be-adjusted pixel corresponding to a position of the light-transmitting object from the screen pixel;
[0250] updating an initial template value of the to-be-adjusted pixel to the material template value of the light-transmitting object;
[0251] determining the to-be-adjusted object corresponding to the position of the light-transmitting object from the near-object and the far-object;
[0252] updating the material template value of the to-be-adjusted object as the material template value of the light-transmitting object.
[0253] In some embodiments, the virtual scene is rendered and displayed based on the material template value of the light-transmitting object and the adjusted material template values of the near-object and the far-object, including:
[0254] determining the target pixel points corresponding to the light-transmitting object, the near-object and the far-object in the screen pixel points;
[0255] performing template test processing on the material template value of the light-transmitting object, the adjusted material template value of the near-object and the adjusted material template value of the far-object respectively and the adjusted template values of the corresponding target pixel points, to determine the target object displayed through the target pixel points.
[0256] In some embodiments, performing template test processing on the material template value of the light-transmitting object, the adjusted material template value of the near-object and the adjusted material template value of the far-object respectively and the adjusted template values of the corresponding target pixel points, to determine the target object displayed through the target pixel points, includes:
[0257] comparing the material template value of the light-transmitting object, the adjusted material template value of the near-object and the adjusted material template value of the far-object respectively with the adjusted template values of the corresponding target pixel points;
[0258] determining the object with the same material template value as the adjusted template value of the target pixel point, to obtain the target object displayed through the target pixel points.
[0259] In some embodiments, the method further includes:
[0260] adjusting the material template values of the near-object and the far-object to values different from the template values of the screen pixel points, if the current view angle is switched from the first view angle to the second view angle.
[0261] In some embodiments, the method further includes:
[0262] adjusting the material color value of the light-transmitting object to make the light-transmitting object achieve a transparent effect.
[0263] In some embodiments, the near-region is set according to the three-dimensional model of the near-object in the near-region, and the far-region is set according to the patch model of the far-object in the far-region, including:
[0264] setting the three-dimensional model of the near-object based on the position of the near-object in the near-region;
[0265] setting a patch model of the long-range object based on a position where the long-range object is located in the long-range region.
[0266] In some embodiments, before obtaining the initial template value of the screen pixel point, the material template value of the light-transmitting object, the near-range object and the long-range object, the method further comprises:
[0267] obtaining an initial material template value of the light-transmitting object, and adjusting the initial material template value to a value different from the initial template value to obtain the material template value of the light-transmitting object.
[0268] In some embodiments, the scene space further comprises a non-light-transmitting object, and the method further comprises:
[0269] determining a pixel point corresponding to the non-light-transmitting object from the screen pixel point;
[0270] adjusting the material template value of the non-light-transmitting object to be the same as the template value of the pixel point corresponding to the non-light-transmitting object.
[0271] The embodiments of the present application determine the scene space in the virtual scene under the first view angle, and determine the near-range region where the distance to the light-transmitting object is less than the preset distance and the long-range region where the distance to the light-transmitting object is not less than the preset distance according to the light-transmitting object in the scene space. Then, the near-range region is set according to the three-dimensional model of the near-range object in the near-range region, and the long-range region is set according to the patch model of the long-range object in the long-range region. Further, the initial template value of the screen pixel point, the material template value of the light-transmitting object, the near-range object and the long-range object are obtained. The initial template value of the screen pixel point, the material template value of the near-range object and the long-range object are adjusted based on the material template value of the light-transmitting object. The virtual scene is rendered and displayed based on the material template value of the light-transmitting object and the adjusted material template value of the near-range object and the long-range object, so as to improve the display effect of the virtual scene.
[0272] The specific implementation of each operation can be referred to the foregoing embodiments, which will not be described here.
[0273] The computer readable storage medium can include a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0274] Due to the computer program stored in the computer readable storage medium, the steps in any one of the processing methods of the virtual scene provided by the embodiments of the present application can be executed, and thus the beneficial effects of any one of the processing methods of the virtual scene provided by the embodiments of the present application can be achieved. Details can be referred to the foregoing embodiments, which will not be described here.
[0275] The processing method and device of a virtual scene, the computer readable storage medium and the computer equipment provided by the embodiments of the present application are described in detail, the principles and implementation manners of the present application are described by applying specific examples, and the above embodiment description is only used to help understand the method and core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation manner and application range will be changed, and the above description should not be understood as the limitation of the present application.
Claims
1. A method of processing a virtual scene, the method comprising: The method comprises: determining a scene space in a first perspective in a virtual scene, and determining a near region and a far region according to a light-transmitting object in the scene space, the scene space in the first perspective comprising a part of an indoor scene and a part of an outdoor scene observed from the indoor scene through the light-transmitting object, the near region and the far region being in the outdoor scene, and the near region being closer to the light-transmitting object than the far region; setting the near region according to a three-dimensional model of a near object in the near region, and setting the far region according to a patch model of a far object in the far region; obtaining an initial template value of a screen pixel, a material template value of the light-transmitting object, the near object and the far object, and the light-transmitting object being configured to always pass a template test; adjusting the initial template value of the screen pixel, the material template values of the near object and the far object based on the material template value of the light-transmitting object; rendering and displaying the virtual scene based on the material template value of the light-transmitting object and the adjusted material template values of the near object and the far object; wherein the determining the near region and the far region according to the light-transmitting object in the scene space comprises: determining the near region based on a region in the scene space having a relative distance to the light-transmitting object less than a preset distance; determining the far region based on a region in the scene space having a relative distance to the light-transmitting object not less than the preset distance; wherein the adjusting the initial template value of the screen pixel, the material template values of the near object and the far object based on the material template value of the light-transmitting object comprises: determining a to-be-adjusted pixel corresponding to a position of the light-transmitting object from the screen pixel; updating an initial template value of the to-be-adjusted pixel to the material template value of the light-transmitting object; determining a to-be-adjusted object corresponding to the position of the light-transmitting object from the near object and the far object; updating a material template value of the to-be-adjusted object to the material template value of the light-transmitting object, so that when the light-transmitting object passes the template test, a near object and / or a far object corresponding to the same pixel as the light-transmitting object in the screen pixel also pass the template test; the method further comprises: if a current perspective is switched from the first perspective to a second perspective, adjusting the material template values of the near object and the far object to values different from a template value of the screen pixel, so that the near object and the far object do not pass the template test, wherein the second perspective is an outdoor perspective or a panoramic perspective.
2. The method of claim 1, wherein, the rendering and displaying the virtual scene based on the material template value of the light-transmitting object and the adjusted material template values of the near object and the far object comprises: determining target pixels corresponding to the light-transmitting object, the near object and the far object respectively in the screen pixel; The material template value of the light-transmitting object, the adjusted material template value of the near-object, and the adjusted material template value of the far-object are respectively compared with the adjusted template value of the corresponding target pixel point.
3. The method of claim 2, wherein, The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises:
4. The method of claim 1, wherein, Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises:
5. The method of claim 1, wherein, Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect.
6. The method of claim 1, wherein, The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect.
7. The method of claim 6, wherein, The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises:
8. A processing apparatus of a virtual scene, characterized by, Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material color value of the light-transmitting object to achieve a transparent effect. The method further comprises: Adjusting the material The setting unit is configured to set the close-range region according to a three-dimensional model of a close-range object in the close-range region, and set the long-range region according to a patch model of a long-range object in the long-range region; The obtaining unit is configured to obtain initial template values of screen pixels, material template values of the see-through object, the close-range object, and the long-range object; The first adjusting unit is configured to adjust the initial template values of the screen pixels, the material template values of the close-range object, and the material template values of the long-range object based on the material template values of the see-through object, respectively; The rendering unit is configured to render and display the virtual scene based on the material template values of the see-through object, and the adjusted material template values of the close-range object and the long-range object; The first adjusting unit is further configured to: determine to-be-adjusted pixels corresponding to the position of the see-through object from the screen pixels; update the initial template values of the to-be-adjusted pixels to the material template values of the see-through object; determine to-be-adjusted objects corresponding to the position of the see-through object from the close-range object and the long-range object; update the material template values of the to-be-adjusted objects to the material template values of the see-through object, so that when the see-through object passes the template test, the close-range object and / or the long-range object corresponding to the same pixels of the screen pixels also pass the template test; The device is further configured to: if the current view angle is switched from the first view angle to a second view angle, adjust the material template values of the close-range object and the long-range object to values different from the template values of the screen pixels, so that the close-range object and the long-range object do not pass the template test, wherein the second view angle is an outdoor view angle or a panoramic view angle.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein, The processor implements the processing method of the virtual scene according to any one of claims 1 to 7 when executing the program.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a plurality of instructions adapted to be loaded by the processor to execute the processing method of the virtual scene according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method for quickly rendering and roaming plant scene
CN101661628A