Scene object generation method and device, computing equipment, medium and program product
By acquiring and processing pixel offset information in the scene depth map, it solves the problem that traditional technology cannot accurately reflect the changes in the fine structure and depth level of the object surface, achieves more realistic scene object generation, and improves material texture and visual effects.
Patent Information
- Application Number
- CN202410937955.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-10-22
AI Technical Summary
Traditional lighting models and texture mapping technologies cannot accurately reflect the fine structure and depth level changes of the object surface in complex scenes, resulting in visual unreality. In particular, static textures cannot accurately reflect changes in occlusion relationships when the viewing angle changes.
By obtaining the scene information and scene depth map of the target scene, perform line-of-sight stepping processing, obtain the pixel offset information of each pixel fragment in the object map, and perform depth offset processing based on this information to generate more realistic scene objects.
It improves the material texture and realism of the object surface in the target scene, ensures accurate offset of pixel depth, and enhances the authenticity of scene objects.
Smart Images

Figure CN118823213A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of computer technology, and in particular, to a method, apparatus, computing device, medium, and program product for generating a scene object. Background Art
[0002] With the rapid development of 3D computer graphics processing and virtual reality technology, the requirements for realistic simulation of material texture and depth in complex scenes are becoming increasingly higher.
[0003] Although traditional lighting models and texture mapping techniques can improve visual effects to a certain extent, they still have limitations for the fine structures and depth levels of the object surface. In particular, when the viewing angle changes, the static texture cannot accurately reflect the changes in occlusion relationships caused by the change in viewing angle, resulting in visual unreality. Therefore, there is an urgent need for a scene object generation method that can improve the material texture and realism of the object surface in the target scene. Summary of the invention
[0004] In view of this, an embodiment of this specification provides a method for generating a scene object. One or more embodiments of this specification also relate to a scene object generation device, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects existing in the prior art.
[0005] According to a first aspect of an embodiment of this specification, a method for generating a scene object is provided, comprising:
[0006] Acquire scene information and a scene depth map of a target scene, wherein the scene information includes an object map of at least one target object in the target scene;
[0007] Based on the scene depth map, performing line of sight stepping processing on the object map to obtain pixel offset information of each pixel fragment in the object map;
[0008] According to the pixel offset information of each pixel fragment in the object map, depth offset processing is performed on each pixel fragment to obtain the scene object of the target scene.
[0009] According to a second aspect of an embodiment of this specification, there is provided a scene object generating device, including:
[0010] An acquisition module is configured to acquire scene information and a scene depth map of a target scene, wherein the scene information includes an object map of at least one target object in the target scene;
[0011] A step processing module is configured to perform line of sight step processing on the object map based on the scene depth map to obtain pixel offset information of each pixel fragment in the object map;
[0012] The offset processing module is configured to perform depth offset processing on each pixel fragment according to the pixel offset information of each pixel fragment in the object map to obtain the scene object of the target scene.
[0013] According to a third aspect of an embodiment of this specification, a computing device is provided, including:
[0014] Memory and processor;
[0015] The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above-mentioned scene object generation method are implemented.
[0016] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the instruction is executed by a processor, the steps of the above-mentioned scene object generation method are implemented.
[0017] According to a fifth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instruction, which, when executed by a processor, implements the steps of executing the above-mentioned scene object generation method.
[0018] An embodiment of the present specification obtains scene information and a scene depth map of a target scene, wherein the scene information includes an object map of at least one target object in the target scene; based on the scene depth map, the object map is subjected to line-of-sight stepping processing to obtain pixel offset information of each pixel fragment in the object map; according to the pixel offset information of each pixel fragment in the object map, each pixel fragment is subjected to depth offset processing to obtain a scene object of the target scene. By performing line-of-sight stepping processing on the acquired scene depth map of the target scene, the pixel offset information of each pixel fragment in the object map is obtained, and depth offset processing is performed on each pixel fragment based on the pixel offset information, so that the pixel depth of each target object in the scene object of the target scene is truly offset, thereby improving the material texture and realism of the surface of each target object. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1a It is a schematic diagram of displaying a current scene object provided by an embodiment of this specification;
[0020] Figure 1b It is a schematic diagram showing the occlusion relationship of the current scene object provided by an embodiment of the present specification;
[0021] Figure 1c It is a schematic diagram of projection display in a current scene object provided by an embodiment of this specification;
[0022] Figure 2 is a flow chart of a scene object generation method provided by an embodiment of this specification;
[0023] Figure 3a is a schematic diagram of a grid display of a model in a scene object generation method provided by an embodiment of this specification;
[0024] Figure 3b It is a schematic diagram of initial rendering display of a model in a scene object generation method provided by an embodiment of this specification;
[0025] Figure 3c is a schematic diagram of displaying a scene object in a scene object generation method provided by an embodiment of this specification;
[0026] Figure 3d This is a schematic diagram of model physical object rendering display in a scene object generation method provided by an embodiment of this specification;
[0027] Figure 4 is a structural schematic diagram of a scene object generation device provided by an embodiment of this specification;
[0028] Figure 5 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0029] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0030] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0031] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0032] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0033] With the rapid development of 3D computer graphics processing and virtual reality technology, the requirements for realistic simulation of material texture and depth in complex scenes are becoming increasingly higher.
[0034] Although traditional lighting models and texture mapping techniques can improve visual effects to a certain extent, they still have limitations for the fine structures and depth levels of object surfaces.
[0035] For example, a simple 2D height field can be virtualized through texture, and by ray stepping this height field, the texture sampling is offset with the virtual height field, which produces a false bump effect in perception, see Figure 1a , Figure 1a 1 shows a schematic diagram of a current scene object display provided by an embodiment of the present specification, wherein the left side is a rendering object in the shape of a cube, the right side is a shadow map reference in the shape of a sphere, and the surface of the rendering object has various letters obtained by processing the lighting model and texture mapping technology; see Figure 1b , Figure 1b A schematic diagram showing the occlusion relationship display of a current scene object provided by an embodiment of the present specification is shown, wherein the above Figure 1a , the letters on the surface of the rendered object cannot be correctly adjusted based on the occlusion relationship of the shadow; see Figure 1c , Figure 1c A schematic diagram of projection display in a current scene object provided by an embodiment of the present specification is shown, wherein the above Figure 1a , when the letters on the surface of the rendering object appear raised visually, the raised English letters cannot produce projections, which is a false concave-convex effect.
[0036] When the observation angle changes, the static texture cannot accurately reflect the changes in occlusion relationships caused by the change in viewing angle, resulting in visual unreality. Therefore, there is an urgent need for a scene object generation method that can improve the material texture and realism of the object surface in the target scene.
[0037] In this specification, a scene object generation method is provided. This specification also relates to a scene object generation device, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.
[0038] See also Figure 2 , Figure 2 A flow chart of a scene object generation method provided by an embodiment of this specification is shown, which specifically includes the following steps.
[0039] Step 202: Acquire scene information and a scene depth map of a target scene, wherein the scene information includes an object map of at least one target object in the target scene.
[0040] Specifically, the target scene refers to a multifunctional complex scene including multiple target objects, target environments, etc., such as desert scenes, rainforest scenes, etc. in games. Scene information refers to the object map of the target object to be rendered. The target object to be rendered can be any three-dimensional solid object in the target scene, for example, the target object can be a house, a stone, a tree, etc. The scene depth map refers to a target scene image including multiple pixel values. Each pixel value in the scene depth map represents the vertical height of the surface of a pixel fragment relative to a smooth surface. The black in the scene depth map represents the lowest point and the white represents the highest point. The scene depth map is a grayscale image designed based on the viewing angle of the screen. Pixel fragments refer to the basic image units that constitute a digital image. In the context of the rendering pipeline, when rendering in a pixel shader, pixel fragments can be more accurately called fragments. A pixel shader is a program executed on a graphics processor that is responsible for calculating and determining the final color and characteristics of each fragment.
[0041] The method for obtaining the scene information and scene depth map of the target scene can be that the user uploads it through the front end; or the user uploads it to the storage space, and then obtains it from the storage space when receiving the request for scene object generation; or the trigger conditions for triggering the generation of the scene object can be pre-set, and the scene information and scene depth map are obtained when it is detected that the trigger conditions are met. For example, the trigger condition can be that the front-end user operates the game character to move or rotate in the target scene.
[0042] Among them, the scene depth map can be data scanned from the real world, an image hand-drawn by an artist, or generated by a certain algorithm.
[0043] Step 204: Based on the scene depth map, perform line-of-sight stepping processing on the object map to obtain pixel offset information of each pixel fragment in the object map.
[0044] Specifically, the pixel offset information is used to guide the depth offset degree of the pixel fragment, and the pixel offset information may include a depth offset value, a depth offset direction, and the like.
[0045] Based on the scene depth map, the object map is subjected to line of sight stepping processing to obtain the pixel offset information of each pixel fragment in the object map. The implementation method may be to perform line of sight stepping processing on the object map based on the scene depth map to obtain at least one basic reference parameter of each pixel fragment in the object map, and generate the pixel offset information of each pixel fragment in the object map based on the at least one basic reference parameter, wherein the basic reference parameter may be a parallax offset and a stepping depth; or an algorithm unit may be set, the algorithm unit being used to calculate the pixel offset information of each pixel fragment in the object map based on the scene depth map, and the algorithm unit is called through its interface.
[0046] Based on the scene depth map, the object map is subjected to line-of-sight stepping processing to obtain at least one basic reference parameter of each pixel fragment in the object map. The implementation method may be to determine the height value of each pixel fragment in the object map based on the scene depth map; based on the object map, determine the viewing angle vector between the target viewpoint and each pixel fragment in the object map and the reference line of the surface where each pixel fragment is located; according to the viewing angle vector, the reference line and the height value, perform line-of-sight stepping processing on each pixel fragment to obtain the parallax offset and stepping depth of each pixel fragment.
[0047] An implementation method for generating pixel offset information of each pixel fragment in an object map based on at least one basic reference parameter may be to generate a target offset vector for each pixel fragment based on the parallax offset and step depth of each pixel fragment; and determine the pixel offset information of each pixel fragment in the object map according to the target offset vector.
[0048] The performing of sight-line stepping processing on the object map may be performing of sight-line stepping processing on the object map under perspective projection.
[0049] In an optional embodiment of the present specification, the above steps perform line of sight stepping processing on the object map based on the scene depth map to obtain pixel offset information of each pixel fragment in the object map, including the following steps:
[0050] Based on the scene depth map, determine the height value of each pixel fragment in the object map;
[0051] Based on the object map, determining a viewing angle vector between a target viewpoint and each pixel fragment in the object map and a reference line of a surface where each pixel fragment is located;
[0052] Perform line of sight stepping processing on each pixel fragment according to the viewing angle vector, the reference line and the height value to obtain the parallax offset and stepping depth of each pixel fragment;
[0053] Based on the disparity offset and the step depth of each pixel fragment, pixel offset information of each pixel fragment in the object map is determined.
[0054] Specifically, the height value refers to the pixel value recorded corresponding to each pixel fragment in the scene depth map. The target viewpoint refers to the viewpoint at which the screen observes the target scene. The viewing angle vector is the vector pointing from the target viewpoint to the position of the pixel fragment. The reference line refers to the surface normal of the surface corresponding to the pixel fragment. The parallax offset characterizes the amount by which each pixel fragment in the object map is offset relative to the scene depth map. The parallax offset can be a texture coordinate offset. For example, the parallax offset can be composed of U and V. The step depth refers to the distance between the target viewpoint and each pixel fragment.
[0055] The method for determining the height value of each pixel fragment in the object map based on the scene depth map may be to read the height value of each pixel fragment from the scene depth map to obtain the height value of each pixel fragment in the object map.
[0056] The method for determining the viewing angle vector between the target viewpoint and each pixel fragment in the object map and the reference line of the surface where each pixel fragment is located based on the object map can be to determine the position of the target viewpoint and the position of each pixel fragment, and determine the viewing angle vector between the target viewpoint and the position of each pixel fragment based on the position of the target viewpoint and the position of each pixel fragment; determine the surface where each pixel fragment is located based on the object map, generate the normal of each surface, and obtain the reference line of the surface where each pixel fragment is located.
[0057] Among them, based on the position of the target viewpoint and the position of each pixel fragment, the method for determining the viewing angle vector between the target viewpoint and each pixel fragment in the object map can be to subtract the position of each pixel fragment from the position of the target viewpoint to obtain the viewing angle vector between the target viewpoint and each pixel fragment in the object map.
[0058] According to the viewing angle vector, the reference line and the height value, each pixel fragment is subjected to line of sight stepping processing to obtain the disparity offset and stepping depth of each pixel fragment. The implementation method can be to construct a test vector for each pixel fragment according to the viewing angle vector and the reference line; for the target pixel fragment, the line of sight stepping is performed based on the target test vector of the target pixel fragment to determine the intersection estimation point where the target test vector intersects with the height value of the target pixel fragment, wherein the target pixel fragment is any one of the pixel fragments; based on the coordinate information of the intersection estimation point and the viewing angle vector, the disparity offset and stepping depth of the target pixel fragment are determined.
[0059] The implementation method for determining the pixel offset information of each pixel fragment in the object map based on the disparity offset and step depth of each pixel fragment can be to generate a target offset vector for each pixel fragment based on the disparity offset and step depth of each pixel fragment; and determine the pixel offset information of each pixel fragment in the object map according to the target offset vector.
[0060] Through the height value of each pixel fragment recorded in the scene depth map, the viewing vector and reference line of each pixel fragment in the object map, the line of sight stepping is performed on each pixel fragment to obtain the pixel offset information of each pixel fragment, thereby ensuring the high correlation between the pixel offset information and the scene depth map and object map, and ensuring the accuracy of the calculated pixel offset information.
[0061] In an optional embodiment of the present specification, the above steps perform sight-stepping processing on each pixel fragment according to the viewing angle vector, the reference line and the height value to obtain the parallax offset and step depth of each pixel fragment, including the following steps:
[0062] Constructing a test vector for each pixel fragment according to the viewing angle vector and the reference line;
[0063] For a target pixel segment, performing line of sight stepping based on a target test vector of the target pixel segment, and determining an estimated intersection point where the target test vector intersects with a height value of the target pixel segment, wherein the target pixel segment is any one of the pixel segments;
[0064] Based on the coordinate information of the intersection estimation point and the viewing angle vector, the disparity offset and the step depth of the target pixel fragment are determined.
[0065] Specifically, the test vector provides a test benchmark for the line of sight stepping. The intersection estimation point refers to the estimated position point where the test vector intersects with the height value, and the intersection estimation point corresponds to coordinate information, which may be a texture coordinate.
[0066] The test vector of each pixel fragment may be constructed according to the viewing angle vector and the reference line by constructing a test space according to the reference line; and converting the viewing angle vector into the test space to obtain the test vector of each pixel fragment.
[0067] The method of performing line of sight stepping based on the target test vector of the target pixel fragment to determine the intersection estimation point where the target test vector intersects the height value of the target pixel fragment can be to gradually sample the scene depth map along the target test vector of the target pixel fragment, and determine the intersection estimation point where the target test vector intersects the height value of the target pixel fragment based on the sampling result.
[0068] The implementation method of gradually sampling the scene depth map along the target test vector of the target pixel segment may be to perform texture sampling on the scene depth map multiple times, and adjust the sampling position according to the depth value of the previous sampling each time.
[0069] The implementation method of determining the disparity offset and step depth of the target pixel fragment based on the coordinate information of the intersection estimation point and the viewing angle vector can be to determine the coordinate information of the intersection estimation point as the disparity offset of the target pixel fragment; calculate the vector length of the viewing angle vector, and determine the vector length as the step depth.
[0070] The test vector for line of sight stepping of each pixel fragment is determined by the viewing angle vector and the reference line, and line of sight stepping is performed based on the test vector to obtain the intersection estimation point. The disparity offset and stepping depth of each pixel fragment are determined based on the intersection estimation point and the viewing angle vector. This provides a specific implementation of line of sight stepping for pixel fragments, ensuring the correct generation of scene objects in the target scene.
[0071] In an optional embodiment of the present specification, the above steps construct a test vector for each pixel segment according to the viewing angle vector and the reference line, including the following steps:
[0072] Construct the test space according to the reference line;
[0073] The view vector is converted to the test space to obtain the test vector of each pixel fragment.
[0074] Specifically, the test space refers to a space in which line of sight stepping is performed. For example, the test space may be a tangent space, which is a coordinate system aligned with a reference line, and the reference line is (0, 0, 1) in the test space.
[0075] The implementation method of constructing the test space according to the reference line can be to generate a coordinate system of the test space based on the reference line, and generate a test space corresponding to the coordinate system based on the coordinate system; it can also be to determine the conversion method between the reference line and the reference vector, and generate the test space based on the conversion method, wherein the reference vector can be (0,0,1).
[0076] The method of converting the perspective vector to the test space to obtain the test vector of each pixel fragment can be to obtain the perspective space of the perspective vector, determine the space conversion mechanism between the perspective space and the test space, and convert the perspective vector based on the space conversion mechanism to obtain the test vector of each pixel fragment.
[0077] By converting the viewing angle vector into a test space corresponding to a reference line suitable for line-of-sight stepping, it is convenient to perform line-of-sight stepping on each pixel fragment, thereby improving the efficiency of line-of-sight stepping and further improving the efficiency of generating scene objects.
[0078] In an optional embodiment of the present specification, the above steps determine the pixel offset information of each pixel fragment in the object map based on the parallax offset and the step depth of each pixel fragment, including the following steps:
[0079] Generate a target offset vector for each pixel fragment based on the disparity offset and the step depth of each pixel fragment;
[0080] According to the target offset vector, the pixel offset information of each pixel fragment in the object map is determined.
[0081] Specifically, the target offset vector refers to a vector for performing offset control on the depth of each pixel fragment, and the target offset vector is a three-dimensional vector.
[0082] An implementation method for generating a target offset vector for each pixel fragment based on the disparity offset and step depth of each pixel fragment may be to determine a target value corresponding to each dimension of each pixel fragment in three-dimensional space based on the disparity offset and step depth of each pixel fragment; and to construct a three-dimensional vector based on the target value of each pixel fragment in three-dimensional space to obtain a target offset vector for each pixel fragment.
[0083] The implementation method for determining the pixel offset information of each pixel fragment in the object map according to the target offset vector can be to calculate the vector length of the target offset vector based on the target offset vector, and determine the vector length of the target offset vector corresponding to each pixel fragment as the pixel offset information of each pixel fragment.
[0084] The target offset vector of each pixel fragment is generated through the disparity offset vector and step depth of each pixel fragment, and the pixel offset information of each pixel fragment in the object map is determined according to the target offset vector. Specific implementation steps of the pixel offset information of each pixel fragment generated based on the disparity offset vector and step depth are provided, which ensures the accuracy of the generated scene object, and further ensures the material texture and realism of the surface of each target object in the scene object.
[0085] In an optional embodiment of the present specification, the above steps generate a target offset vector for each pixel fragment based on the disparity offset and the step depth of each pixel fragment, including the following steps:
[0086] Determine a target value corresponding to each dimension of each pixel fragment in the three-dimensional space based on the parallax offset and the step depth of each pixel fragment;
[0087] Based on the target value of each pixel fragment in the three-dimensional space, a three-dimensional vector is constructed to obtain a target offset vector of each pixel fragment.
[0088] Specifically, the target value refers to the length value corresponding to each dimension in the three-dimensional space. For example, the three-dimensional space is composed of x, y, and z. The length value of a corresponding vector on x, y, and z is the target value corresponding to each dimension of the vector in the three-dimensional space.
[0089] An implementation method for determining a target value corresponding to each dimension of each pixel fragment in the three-dimensional space based on the disparity offset and step depth of each pixel fragment may be to parse the disparity offset of each pixel fragment to obtain the target value corresponding to the first dimension and the second dimension of each pixel fragment in the three-dimensional space; and parse the step depth to obtain the target value corresponding to the third dimension of each pixel fragment in the three-dimensional space.
[0090] Exemplarily, the parallax offsets are a and b, where a is the offset of texture coordinate U, b is the offset of texture coordinate V, and the step depth is c. Then, the target values corresponding to each dimension of each pixel fragment in the three-dimensional space are a, b, and c.
[0091] Based on the target values of each pixel fragment in the three-dimensional space, a three-dimensional vector is constructed to obtain the target offset vector of each pixel fragment. The implementation method can be to construct a three-dimensional vector composed of the target values of each pixel fragment in the three-dimensional space based on the numerical representation, and obtain the target offset vector of each pixel fragment based on the three-dimensional vector; it can also be to construct a three-dimensional vector composed of the target values of each pixel fragment in the three-dimensional space based on the vector representation, and obtain the target offset vector of each pixel fragment based on the three-dimensional vector; use a programming language to construct a three-dimensional vector composed of the target values of each pixel fragment in the three-dimensional space, and obtain the target offset vector of each pixel fragment based on the three-dimensional vector.
[0092] The target offset vector of each pixel segment may be obtained based on the three-dimensional vector by determining the three-dimensional vector of each pixel segment as the target offset vector of each pixel segment.
[0093] A three-dimensional vector is constructed according to the disparity offset vector and the step depth, and the target offset vector of each pixel fragment is obtained. Specific implementation steps for generating the target offset vector are provided to ensure the correct generation of the target offset vector, thereby ensuring the material texture and realism of the surface of each target object in the scene object.
[0094] Step 206: Perform depth offset processing on each pixel fragment according to the pixel offset information of each pixel fragment in the object map to obtain the scene object of the target scene.
[0095] Specifically, a scene object refers to an object image contained in a target scene presented on a two-dimensional plane, and multiple target objects in the target scene become scene objects after depth offset processing.
[0096] Before performing depth offset processing on each pixel fragment according to the pixel offset information of each pixel fragment in the object map to obtain the scene object of the target scene, the pixel offset information of each pixel fragment can be adjusted based on the display attribute of each pixel fragment in the object map. Based on the adjusted pixel offset information, depth offset processing is performed on each pixel fragment to obtain the scene object of the target scene.
[0097] Among them, the implementation method of adjusting the pixel offset information of each pixel fragment based on the display attributes of each pixel fragment in the object map can be to calculate the pixel change parameter between any pixel fragment and the adjacent pixel fragment for any pixel fragment among the pixel fragments, wherein the adjacent pixel fragment refers to the pixel fragment adjacent to any pixel fragment in the object map; determine the depth level corresponding to any pixel fragment according to the pixel change parameter; and adjust the pixel offset information of any pixel fragment based on the depth level to obtain the adjusted pixel offset information of any pixel fragment.
[0098] The implementation method of performing depth offset processing on each pixel fragment according to the pixel offset information of each pixel fragment in the object map to obtain the scene object of the target scene may be to perform depth offset processing on each pixel fragment according to the pixel offset information of each pixel fragment in the object map, perform lighting calculation on the image obtained by the depth offset processing, and perform image rendering based on the lighting calculation result to obtain the scene object of the target scene.
[0099] The method for implementing illumination calculation on the image obtained by depth offset processing may be to perform illumination calculation on the image obtained by depth offset processing based on light source information.
[0100] Before performing image rendering based on the illumination calculation result to obtain the scene object of the target scene, shadow calculation based on the illumination calculation result may also be included. The implementation method of performing image rendering based on the illumination calculation result to obtain the scene object of the target scene may be to perform image rendering based on the shadow calculation result and the illumination calculation result to obtain the scene object of the target scene.
[0101] In an optional embodiment of the present specification, before the above step of performing depth offset processing on each pixel fragment according to the pixel offset information of each pixel fragment in the object map to obtain the scene object of the target scene, the following step is also included:
[0102] For any pixel fragment among the pixel fragments, a pixel variation parameter between the pixel fragment and an adjacent pixel fragment is calculated, wherein the adjacent pixel fragment refers to a pixel fragment adjacent to the pixel fragment in the object map;
[0103] Determine the depth level corresponding to any pixel fragment according to the pixel change parameter;
[0104] Based on the depth level, pixel offset information of any pixel fragment is adjusted to obtain adjusted pixel offset information of any pixel fragment.
[0105] Specifically, the pixel change parameter represents the rate of change of pixels between adjacent pixel fragments. The pixel change parameter may be a texture coordinate change rate. For example, if the texture coordinates of any pixel fragment are (u, v) and the texture coordinates of an adjacent pixel fragment are (u, v+1), then the texture coordinate change rate is dFdy(u, v)=(u, v+1)-(u, v); for another example, if the texture coordinates of any pixel fragment are (u, v) and the texture coordinates of an adjacent pixel fragment are (u+1, v), then the texture coordinate change rate is dFdx(u, v)=(u+1, v)-(u, v).
[0106] The implementation method for determining the depth level corresponding to any pixel fragment according to the pixel change parameters may be to search the depth level corresponding to the pixel change parameters from the depth level storage information according to the pixel change parameters, wherein the depth level storage information records the correspondence between the pixel change parameters and the depth level.
[0107] Based on the depth level, the pixel offset information of any pixel fragment is adjusted to obtain the adjusted pixel offset information of any pixel fragment. The implementation method may be to convert the pixel offset information of any pixel fragment into an offset dimension corresponding to the depth level to obtain the adjusted pixel offset information of any pixel fragment.
[0108] For any pixel fragment, the depth level corresponding to any pixel fragment is determined based on the pixel change parameters between any pixel fragment and the adjacent pixel fragments, and the pixel offset information is adjusted according to the depth level, which fully considers the display relationship between each target object in the object map and ensures the material texture and realism of the surface of each target object in the scene object.
[0109] In an optional embodiment of the present specification, after the above step of adjusting the pixel offset information of any pixel fragment based on the depth level and obtaining the adjusted pixel offset information of any pixel fragment, the following step is further included:
[0110] Determine a target distance of any pixel fragment from a target viewpoint;
[0111] Determine an offset parameter of any pixel fragment based on the target distance;
[0112] The offset parameter of any pixel segment and the adjusted pixel offset information are determined as the pixel offset information of any pixel segment.
[0113] Specifically, the offset parameter refers to the ratio between the pixel offset information and the pixel depth of the pixel fragment.
[0114] The target distance between any pixel fragment and the target viewpoint may be determined by measuring the target distance between the position of any pixel fragment and the position of the target viewpoint.
[0115] The implementation method of determining the offset parameter of any pixel fragment based on the target distance may be to obtain a nonlinear ratio generation strategy, determine the target ratio corresponding to the target distance based on the nonlinear ratio generation strategy, and determine the target ratio as the offset parameter of any pixel fragment, wherein the nonlinear ratio generation strategy is used to calculate the ratio of the pixel depth change corresponding to each pixel fragment in the object map in the rendering display.
[0116] Exemplarily, if the target distance is m and the pixel offset information is 1, the corresponding pixel depth is adjusted by 10 units; if the target distance is n and the pixel offset information is 1, the corresponding pixel is adjusted by 1 unit, wherein m is less than n.
[0117] The offset parameter of any pixel segment is written into the adjusted pixel offset information to obtain the pixel offset information of any pixel segment.
[0118] The offset parameter of any pixel fragment is determined by the target distance between any pixel fragment and the target viewpoint, and the pixel offset information of any pixel fragment is determined based on the offset parameter and the pixel offset information, so that when depth offset is subsequently performed based on the pixel offset information, accurate offset can be performed based on the offset parameter in the pixel offset information, thereby ensuring the accuracy of depth offset.
[0119] In an optional embodiment of the present specification, the above steps perform depth offset processing on each pixel fragment according to the pixel offset information of each pixel fragment in the object map to obtain the scene object of the target scene, including the following steps:
[0120] According to the pixel offset information of each pixel fragment in the object map, depth offset processing is performed on each pixel fragment to obtain an image to be rendered;
[0121] Acquire light source information, and based on the light source information, perform lighting calculation for the image to be rendered to obtain lighting information of the image to be rendered;
[0122] Based on the illumination information, shadow calculation is performed on the image to be rendered to obtain shadow information of the image to be rendered;
[0123] According to the lighting information and shadow information, the image to be rendered is rendered to obtain the scene object of the target scene.
[0124] According to the pixel offset information of each pixel fragment in the object map, the pixel depth of each pixel fragment is offset to obtain the image to be rendered.
[0125] The light source information may be uploaded by a front-end user; it may also be generated based on the natural display degree of the scene, wherein the light source included in the light source information may be one, two or more light sources, and the light source may be lamplight, sunlight, etc.
[0126] Based on the light source information, a lighting calculation is performed on the image to be rendered to obtain the lighting information of the image to be rendered. The implementation method can be to determine the light source properties based on the light source information, and establish a lighting model based on the light source properties. Based on the lighting model, a lighting calculation is performed on the image to be rendered to obtain the lighting information of the image to be rendered.
[0127] Among them, based on the illumination model, the illumination calculation is performed on the image to be rendered to obtain the illumination information of the image to be rendered. It can be implemented by sequentially calculating the ambient illumination, diffuse illumination and specular illumination of the image to be rendered based on the illumination model to obtain the ambient illumination component, diffuse illumination component and specular illumination component, and obtaining the illumination information of the image to be rendered based on the ambient illumination component, diffuse illumination component and specular illumination component.
[0128] Based on the illumination information, shadow calculation is performed on the image to be rendered to obtain the shadow information of the image to be rendered. The implementation method may be to obtain the illumination scene information and illumination depth map of the target scene, wherein the illumination scene information includes an illumination object map of at least one target object in the target scene, and the illumination object map is a map with the light source as the viewpoint; based on the illumination depth map, line of sight stepping is performed on the illumination object map to obtain illumination pixel offset information of each illumination pixel fragment in the illumination object map; according to the illumination pixel offset information of each illumination pixel fragment in the illumination object map, depth offset processing is performed on each illumination pixel fragment to obtain the illuminated image to be rendered of the target scene; the illumination depth map is compared with the illuminated image to be rendered to determine the occlusion information between each target object in the illuminated image to be rendered; based on the occlusion information, the shadow information of the image to be rendered is determined.
[0129] In actual applications, after obtaining the light source information, the light angle of the light source in the current frame can be compared with the light angle of the light source during the previous lighting calculation. When the difference in the angle comparison does not exceed the preset difference threshold, the image is rendered directly based on the results of the previous lighting calculation and shadow calculation. There is no need to frequently perform lighting calculations and shadow calculations, so as to reduce the cost of computing resources.
[0130] In the embodiments of the present specification, shadow calculation is performed after illumination calculation, so that the rendering steps of at least one target object after line of sight stepping processing match the rendering process of other objects that have not undergone line of sight stepping processing, providing a powerful systematic method for scene object generation and ensuring accurate generation of scene objects.
[0131] According to the pixel offset information, depth offset calculation is performed on each pixel fragment to obtain the image to be rendered, and lighting calculation and shadow calculation are performed on the image to be rendered. The image to be rendered is rendered based on the lighting calculation results and the shadow calculation results, thereby ensuring the comprehensiveness of scene information of the rendered scene image.
[0132] In an optional embodiment of the present specification, the above steps perform shadow calculation on the image to be rendered based on the illumination information to obtain shadow information of the image to be rendered, including the following steps:
[0133] Acquire illumination scene information and an illumination depth map of a target scene, wherein the illumination scene information includes an illumination object map of at least one target object in the target scene, and the illumination object map is a map with a light source as a viewpoint;
[0134] Based on the illumination depth map, performing line of sight stepping processing on the illumination object map to obtain illumination pixel offset information of each illumination pixel fragment in the illumination object map;
[0135] According to the illumination pixel offset information of each illumination pixel fragment in the illumination object map, depth offset processing is performed on each illumination pixel fragment to obtain an illumination image to be rendered of the target scene;
[0136] Comparing the illumination depth map with the illumination image to be rendered, and determining occlusion information between target objects in the illumination image to be rendered;
[0137] Based on the occlusion information, shadow information of the image to be rendered is determined.
[0138] Among them, the specific implementation method of this embodiment of the present specification is the same or similar to the above-mentioned implementation steps of obtaining the scene information and scene depth map of the target scene until the image to be rendered of the target scene is obtained. Please refer to the above description for details, and this specification will not repeat them here.
[0139] The line-of-sight stepping process for the light object map may be to perform line-of-sight stepping process for the light object map under orthographic projection.
[0140] The method for comparing the illumination depth map with the illuminated image to be rendered and determining the occlusion information between target objects in the illuminated image to be rendered may be to compare the illumination depth map with the pixel depth of each illuminated pixel fragment in the illuminated image to be rendered, determine the object area information of the target objects occluded in the illuminated image to be rendered, and determine the object area information as the occlusion information between the target objects in the illuminated image to be rendered.
[0141] The shadow information of the image to be rendered may be determined based on the occlusion information by generating a region coordinate range of the target object occluded in the image to be rendered based on the occlusion information to obtain the shadow information of the image to be rendered.
[0142] When calculating the shadow of the image to be rendered based on the lighting information, the line of sight is stepped with the light source as the viewpoint to obtain the corresponding illuminated image to be rendered, and the illuminated image to be rendered is compared with the lighting depth map to determine the occlusion information between the target objects, so that the shadow information of the image to be rendered is obtained based on the occlusion information, thereby ensuring the correspondence between the generated shadow information and the light source, and ensuring the accuracy of the generated shadow information.
[0143] In an optional embodiment of the present specification, the above steps perform depth offset processing on each illuminated pixel fragment according to the illuminated pixel offset information of each illuminated pixel fragment in the illuminated object map to obtain an illuminated image to be rendered of the target scene, including the following steps:
[0144] Get the depth offset constant and read the surface parameters of the surface where each illuminated pixel fragment is located from the illuminated object map;
[0145] Determining an additional depth offset value for each illuminated pixel fragment according to the depth offset constant and the surface parameter;
[0146] Determine illumination target pixel offset information based on the added depth offset value and illumination pixel offset information of each illumination pixel fragment in the illumination object map;
[0147] Based on the illumination target pixel offset information, depth offset processing is performed on each illumination pixel fragment to obtain an illumination image to be rendered of the target scene.
[0148] Specifically, the depth migration constant is a base offset, ensuring sufficient migration even in areas with low slopes. Surface parameters may include the rate of change and the surface slope.
[0149] The additional depth offset value of each illuminated pixel fragment is determined according to the depth offset constant and the surface parameters. The reference offset value can be determined based on the normal change rate and the surface slope; and the additional depth offset value of each illuminated pixel fragment can be determined based on the depth offset constant and the reference offset value.
[0150] The reference offset value may be determined based on the normal change rate and the surface slope by multiplying the change rate and the surface slope to obtain the reference offset value.
[0151] Based on the depth offset constant and the reference offset value, an implementation method for determining the additional depth offset value of each illuminated pixel fragment can be to select the larger one from the depth offset value and the reference offset value as the additional depth offset value of the illuminated pixel fragment to obtain the additional depth offset value of each illuminated pixel fragment.
[0152] An implementation method for determining the illumination target pixel offset information based on the additional depth offset value and the illumination pixel offset information of each illumination pixel fragment in the illumination object map may be to add the additional depth offset value and the illumination pixel offset information of each illumination pixel fragment in the illumination object map to obtain the illumination target pixel offset information of each illumination pixel fragment in the illumination object map.
[0153] The depth offset value is additionally calculated using the depth offset constant and the surface parameters read from the illumination object map, so that depth offset processing is performed on each illumination pixel fragment based on the additional depth offset value and the illumination pixel offset information to obtain the illumination image to be rendered of the target scene, thereby avoiding the occurrence of self-shadowing after rendering based on the shadow information determined by the illumination image to be rendered.
[0154] See also Figure 3a and Figure 3b , Figure 3a A schematic diagram of a grid display of a model in a scene object generation method provided by an embodiment of this specification is shown; Figure 3b A schematic diagram of initial rendering display of a model in a scene object generation method provided by an embodiment of this specification is shown.
[0155] based on Figure 3a The display schematic diagram shown is rendered to obtain Figure 3b The diagram shows an initial rendering of the included model, where Figure 3a The mesh density of the model is smaller.
[0156] See also Figure 3c , Figure 3c FIG. 1 shows a schematic diagram of scene object display in a scene object generation method provided by an embodiment of the present specification. Figure 3d , Figure 3d A schematic diagram of model physical rendering display in a scene object generation method provided by an embodiment of this specification is shown.
[0157] By applying the solution of the embodiments of the present specification, the pixel offset information of each pixel fragment in the object map is obtained by performing line of sight stepping processing on the acquired scene depth map of the target scene, and depth offset processing is performed on each pixel fragment based on the pixel offset information, so that the pixel depth of each target object in the scene object of the target scene is truly offset, thereby improving the material texture and realism of the surface of each target object.
[0158] Corresponding to the above method embodiment, this specification also provides a scene object generation device embodiment, Figure 4 FIG. 1 is a schematic diagram showing the structure of a scene object generation device provided by an embodiment of the present specification. Figure 4 As shown, the device comprises:
[0159] An acquisition module 402 is configured to acquire scene information and a scene depth map of a target scene, wherein the scene information includes an object map of at least one target object in the target scene;
[0160] The step processing module 404 is configured to perform line of sight step processing on the object map based on the scene depth map to obtain pixel offset information of each pixel fragment in the object map;
[0161] The offset processing module 406 is configured to perform depth offset processing on each pixel fragment according to the pixel offset information of each pixel fragment in the object map to obtain the scene object of the target scene.
[0162] Optionally, the step processing module 404 is further configured to determine the height value of each pixel fragment in the object map based on the scene depth map; determine the viewing angle vector between the target viewpoint and each pixel fragment in the object map and the reference line of the surface where each pixel fragment is located based on the object map; perform line of sight stepping processing on each pixel fragment according to the viewing angle vector, the reference line and the height value to obtain the disparity offset and step depth of each pixel fragment; determine the pixel offset information of each pixel fragment in the object map based on the disparity offset and step depth of each pixel fragment.
[0163] Optionally, the step processing module 404 is further configured to construct a test vector for each pixel fragment based on the viewing angle vector and the reference line; for the target pixel fragment, perform line of sight stepping based on the target test vector of the target pixel fragment, and determine an intersection estimation point where the target test vector intersects with the height value of the target pixel fragment, wherein the target pixel fragment is any one of the pixel fragments; based on the coordinate information of the intersection estimation point and the viewing angle vector, determine the disparity offset and step depth of the target pixel fragment.
[0164] Optionally, the step processing module 404 is further configured to construct a test space according to the reference line; convert the viewing angle vector to the test space, and obtain a test vector for each pixel segment.
[0165] Optionally, the step processing module 404 is further configured to generate a target offset vector for each pixel fragment based on the parallax offset and the step depth of each pixel fragment; and determine pixel offset information of each pixel fragment in the object map according to the target offset vector.
[0166] Optionally, the step processing module 404 is further configured to determine the target value corresponding to each dimension of each pixel fragment in the three-dimensional space based on the parallax offset and the step depth of each pixel fragment; construct a three-dimensional vector based on the target value of each pixel fragment in the three-dimensional space, and obtain the target offset vector of each pixel fragment.
[0167] Optionally, the scene object generation device also includes an adjustment module, which is configured to calculate, for any pixel fragment in each pixel fragment, a pixel change parameter between any pixel fragment and an adjacent pixel fragment, wherein the adjacent pixel fragment refers to a pixel fragment adjacent to any pixel fragment in the object map; determine a depth level corresponding to any pixel fragment according to the pixel change parameter; and adjust pixel offset information of any pixel fragment based on the depth level to obtain adjusted pixel offset information of any pixel fragment.
[0168] Optionally, the scene object generation device also includes a determination module configured to determine a target distance of any pixel fragment from a target viewpoint; determine an offset parameter of any pixel fragment based on the target distance; and determine the offset parameter of any pixel fragment and the adjusted pixel offset information as the pixel offset information of any pixel fragment.
[0169] Optionally, the offset processing module 406 is further configured to perform depth offset processing on each pixel fragment according to the pixel offset information of each pixel fragment in the object map to obtain the image to be rendered; obtain light source information, and based on the light source information, perform lighting calculation on the image to be rendered to obtain the lighting information of the image to be rendered; based on the lighting information, perform shadow calculation on the image to be rendered to obtain the shadow information of the image to be rendered; render the image to be rendered according to the lighting information and the shadow information to obtain the scene object of the target scene.
[0170] Optionally, the offset processing module 406 is further configured to obtain lighting scene information and a lighting depth map of the target scene, wherein the lighting scene information includes a lighting object map of at least one target object in the target scene, and the lighting object map is a map with the light source as the viewpoint; based on the lighting depth map, performing line of sight stepping processing on the lighting object map to obtain lighting pixel offset information of each lighting pixel fragment in the lighting object map; performing depth offset processing on each lighting pixel fragment according to the lighting pixel offset information of each lighting pixel fragment in the lighting object map to obtain a lighting image to be rendered of the target scene; comparing the lighting depth map and the lighting image to be rendered to determine occlusion information between each target object in the lighting image to be rendered; and determining shadow information of the image to be rendered based on the occlusion information.
[0171] Optionally, the offset processing module 406 is further configured to obtain a depth offset constant and read surface parameters of the surface where each illuminated pixel fragment is located from the illuminated object map; determine an additional depth offset value for each illuminated pixel fragment based on the depth offset constant and the surface parameters; determine the illumination target pixel offset information based on the additional depth offset value and the illumination pixel offset information of each illuminated pixel fragment in the illuminated object map; perform depth offset processing on each illuminated pixel fragment based on the illumination target pixel offset information to obtain an illuminated image to be rendered of the target scene.
[0172] By applying the solution of the embodiments of the present specification, the pixel offset information of each pixel fragment in the object map is obtained by performing line of sight stepping processing on the acquired scene depth map of the target scene, and depth offset processing is performed on each pixel fragment based on the pixel offset information, so that the pixel depth of each target object in the scene object of the target scene is truly offset, thereby improving the material texture and realism of the surface of each target object.
[0173] The above is a schematic scheme of a scene object generation device of this embodiment. It should be noted that the technical scheme of the scene object generation device and the technical scheme of the scene object generation method described above belong to the same concept, and the details not described in detail in the technical scheme of the scene object generation device can be referred to the description of the technical scheme of the scene object generation method described above.
[0174] Figure 5 The block diagram of a computing device provided by one embodiment of the present specification is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and the database 550 is used to store data.
[0175] The computing device 500 also includes an access device 540, which enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0176] In one embodiment of the present specification, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 5 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0177] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 500 may also be a mobile or stationary server.
[0178] The processor 520 is used to execute the following computer program / instructions, which, when executed by the processor, implement the steps of the above-mentioned scene object generation method.
[0179] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned scene object generation method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned scene object generation method.
[0180] An embodiment of the present specification also provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned scene object generation method when executed by a processor.
[0181] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned scene object generation method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned scene object generation method.
[0182] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned scene object generation method when executed by a processor.
[0183] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above-mentioned scene object generation method belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above-mentioned scene object generation method.
[0184] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0185] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0186] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0187] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0188] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A method for generating a scene object, characterized in that: include: Acquire scene information and a scene depth map of a target scene, wherein the scene information includes an object map of at least one target object in the target scene; Based on the scene depth map, performing line of sight stepping processing on the object map to obtain pixel offset information of each pixel fragment in the object map; According to the pixel offset information of each pixel fragment in the object map, depth offset processing is performed on each pixel fragment to obtain the scene object of the target scene.
2. The method according to claim 1, characterized in that The performing sight-stepping processing on the object map based on the scene depth map to obtain pixel offset information of each pixel fragment in the object map includes: Determining a height value of each pixel fragment in the object map based on the scene depth map; Based on the object map, determining a viewing angle vector between a target viewpoint and each pixel fragment in the object map and a reference line of a surface where each pixel fragment is located; Performing line-of-sight stepping processing on each pixel fragment according to the viewing angle vector, the reference line and the height value to obtain a parallax offset and a stepping depth of each pixel fragment; Pixel offset information of each pixel fragment in the object map is determined based on the disparity offset and the step depth of each pixel fragment.
3. The method according to claim 2, characterized in that The performing sight-line stepping processing on each pixel fragment according to the viewing angle vector, the reference line and the height value to obtain the parallax offset and the stepping depth of each pixel fragment includes: Constructing a test vector for each pixel segment according to the viewing angle vector and the reference line; For a target pixel fragment, performing line of sight stepping based on a target test vector of the target pixel fragment, and determining an estimated intersection point where the target test vector intersects with a height value of the target pixel fragment, wherein the target pixel fragment is any one of the pixel fragments; Based on the coordinate information of the intersection estimation point and the viewing angle vector, a disparity offset and a step depth of the target pixel fragment are determined.
4. The method according to claim 3, characterized in that The constructing the test vector of each pixel segment according to the viewing angle vector and the reference line includes: Constructing a test space according to the reference line; The viewing angle vector is converted into the test space to obtain a test vector of each pixel segment.
5. The method according to claim 2, characterized in that: The determining pixel offset information of each pixel fragment in the object map based on the parallax offset and the step depth of each pixel fragment includes: generating a target offset vector for each pixel fragment based on the disparity offset and the step depth of each pixel fragment; Pixel offset information of each pixel fragment in the object map is determined according to the target offset vector.
6. The method according to claim 5, characterized in that The generating a target offset vector for each pixel fragment based on the disparity offset and the step depth of each pixel fragment comprises: Determining target values corresponding to each dimension of each pixel fragment in a three-dimensional space based on the parallax offset and the step depth of each pixel fragment; Based on the target values of the pixel fragments in the three-dimensional space, a three-dimensional vector is constructed to obtain the target offset vector of the pixel fragments.
7. The method according to any one of claims 1 to 6, characterized in that: Before performing depth offset processing on each pixel fragment according to the pixel offset information of each pixel fragment in the object map to obtain the scene object of the target scene, the method further includes: For any pixel fragment among the pixel fragments, calculating a pixel variation parameter between the pixel fragment and an adjacent pixel fragment, wherein the adjacent pixel fragment refers to a pixel fragment adjacent to the pixel fragment in the object map; Determining a depth level corresponding to any pixel segment according to the pixel change parameter; Based on the depth level, the pixel offset information of any one of the pixel fragments is adjusted to obtain adjusted pixel offset information of any one of the pixel fragments.
8. The method according to claim 7, characterized in that After adjusting the pixel offset information of any pixel fragment based on the depth level to obtain the adjusted pixel offset information of any pixel fragment, the method further includes: Determining a target distance between any pixel fragment and a target viewpoint; Determining an offset parameter of any one of the pixel fragments based on the target distance; The offset parameter of any pixel segment and the adjusted pixel offset information are determined as the pixel offset information of any pixel segment.
9. The method according to any one of claims 1 to 6, characterized in that: The step of performing depth offset processing on each pixel fragment according to pixel offset information of each pixel fragment in the object map to obtain the scene object of the target scene includes: According to the pixel offset information of each pixel fragment in the object map, performing depth offset processing on each pixel fragment to obtain an image to be rendered; Acquiring light source information, and performing illumination calculation on the image to be rendered based on the light source information to obtain illumination information of the image to be rendered; Based on the illumination information, shadow calculation is performed on the image to be rendered to obtain shadow information of the image to be rendered; The image to be rendered is rendered according to the illumination information and the shadow information to obtain a scene object of the target scene.
10. The method according to claim 9, characterized in that The step of performing shadow calculation on the image to be rendered based on the illumination information to obtain shadow information of the image to be rendered includes: Acquire illumination scene information and an illumination depth map of the target scene, wherein the illumination scene information includes an illumination object map of at least one target object in the target scene, and the illumination object map is a map with a light source as a viewpoint; Based on the illumination depth map, performing line of sight stepping processing on the illumination object map to obtain illumination pixel offset information of each illumination pixel fragment in the illumination object map; According to illumination pixel offset information of each illumination pixel fragment in the illumination object map, performing depth offset processing on each illumination pixel fragment to obtain an illumination image to be rendered of the target scene; Comparing the illuminated depth map with the illuminated image to be rendered, and determining occlusion information between target objects in the illuminated image to be rendered; Based on the occlusion information, shadow information of the image to be rendered is determined.
11. The method according to claim 10, characterized in that The step of performing depth offset processing on each illuminated pixel fragment according to the illuminated pixel offset information of each illuminated pixel fragment in the illuminated object map to obtain the illuminated image to be rendered of the target scene comprises: Obtaining a depth offset constant, and reading surface parameters of the surface where each illuminated pixel fragment is located from the illuminated object map; Determining an additional depth offset value for each illuminated pixel fragment according to the depth offset constant and the surface parameter; Determining illumination target pixel offset information based on the additional depth offset value and illumination pixel offset information of each illumination pixel fragment in the illumination object map; Based on the illumination target pixel offset information, depth offset processing is performed on each illumination pixel fragment to obtain an illumination image to be rendered of the target scene.
12. A scene object generating device, characterized in that: include: An acquisition module is configured to acquire scene information and a scene depth map of a target scene, wherein the scene information includes an object map of at least one target object in the target scene; A step processing module is configured to perform line of sight step processing on the object map based on the scene depth map to obtain pixel offset information of each pixel fragment in the object map; The offset processing module is configured to perform depth offset processing on each pixel fragment according to the pixel offset information of each pixel fragment in the object map to obtain the scene object of the target scene.
13. A computing device, characterized in that: include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the scene object generation method described in any one of claims 1 to 11 are implemented.
14. A computer-readable storage medium, characterized in that: It stores a computer program / instruction, which, when executed by a processor, implements the steps of the scene object generation method described in any one of claims 1 to 11.
15. A computer program product, characterized in that The method comprises a computer program / instruction, which, when executed by a processor, implements the steps of the scene object generation method according to any one of claims 1 to 11.
Citation Information
Cited By
Content generation method and system based on AI
CN119671911A
