Target object rendering method and device, computer equipment and readable storage medium
By selecting an appropriate rendering method based on the distance and roughness attributes of the target object, and using pre-stored spherical harmonic parameters to replace cubemap sampling, the bandwidth consumption and device heat generation issues in IBL technology are resolved, thus achieving performance improvement.
Patent Information
- Application Number
- CN202311234746.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-22
- Publication Date
- 2025-01-10
AI Technical Summary
IBL technology causes high bandwidth consumption and device overheating issues due to cubemap sampling during rendering.
The appropriate rendering method is selected based on the properties of the target object. For distant and near targets, the rendering method based on pre-stored spherical harmonic parameters and the rendering method based on IBL technology are used respectively to replace Cubemap sampling.
While ensuring rendering quality, it reduces bandwidth consumption and device heat generation, and improves the performance of IBL lighting.
Smart Images

Figure CN119299409A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to a method, device, computer equipment and readable storage medium for rendering a target object. Background Art
[0002] IBL (Image based lighting) technology is used to represent the ambient light specular reflection in the PBR (PhysicallyBase Rendering) process. It obtains the lighting information of the surrounding environment by sampling a Cubemap that captures the surrounding environment.
[0003] When rendering, IBL technology needs to sample the Cubemap at least once for each pixel. The sampling of the Cubemap results in additional bandwidth consumption, and mobile devices will incur higher performance consumption, causing the device to heat up. Summary of the invention
[0004] In view of this, the present application provides a target object rendering method, apparatus, computer equipment and readable storage medium, which improve the performance of IBL lighting while ensuring the rendering effect, avoid additional bandwidth consumption and heating of the device.
[0005] In a first aspect, an embodiment of the present application provides a method for rendering a target object, the method comprising:
[0006] Get the object properties of the object to be rendered;
[0007] Determining a rendering method of the target object to be rendered according to the target object attribute of the target object to be rendered;
[0008] The target object to be rendered is rendered based on the rendering method; wherein the rendering method includes a first rendering method based on image lighting technology and / or a second rendering method based on pre-stored spherical harmonic parameters.
[0009] According to the above method of the embodiment of the present application, the following additional technical features may also be provided:
[0010] In the above technical solution, optionally, the object attribute of the target object to be rendered includes a distance attribute of the target object to be rendered; and determining the rendering mode of the target object to be rendered according to the object attribute includes:
[0011] If the target object to be rendered is a distant target object, the rendering mode of the target object to be rendered is determined to be the second rendering mode.
[0012] In any of the above technical solutions, optionally, the object property of the target object to be rendered further includes a roughness property of the target object to be rendered; and determining the rendering method of the target object to be rendered according to the object property further includes:
[0013] If the target object to be rendered is a near-view target object, and the roughness of the target object to be rendered is greater than a preset threshold, it is determined that the rendering mode of the target object to be rendered is the second rendering mode.
[0014] In any of the above technical solutions, optionally, determining the rendering method of the target object to be rendered according to the target object attribute further includes:
[0015] If the target object to be rendered is a near-view target object, and the roughness of the target object to be rendered is less than or equal to a preset threshold, it is determined that the rendering mode of the target object to be rendered is the first rendering mode.
[0016] In any of the above technical solutions, optionally, if the rendering mode of the target object to be rendered is the first rendering mode, then rendering the target object to be rendered based on the rendering mode includes:
[0017] Obtaining a first cubic map sampling result of the surrounding environment of the target object to be rendered, and calculating an ambient light specular reflection result according to the first cubic map sampling result;
[0018] The target object to be rendered is rendered based on the ambient light specular reflection result.
[0019] In any of the above technical solutions, optionally, if the rendering mode of the target object to be rendered is the second rendering mode, then rendering the target object to be rendered based on the rendering mode includes:
[0020] Calculating a fitted specular reflection effect according to the pre-stored spherical harmonic parameters and a normal of a given surface on the target object to be rendered;
[0021] According to the fitted specular reflection effect, an ambient light specular reflection result is calculated, and the target object to be rendered is rendered based on the ambient light specular reflection result.
[0022] In any of the above technical solutions, optionally, before obtaining the object properties of the object to be rendered, the method further includes:
[0023] Acquire a second cubic map sampling result of the surrounding environment of the target object to be rendered, and determine a plurality of picture levels corresponding to the second cubic map sampling result, where maps of different coarseness of the second cubic map sampling result are stored in different picture levels;
[0024] The texture stored in the target picture level in the plurality of picture levels is fitted by a spherical harmonic function to obtain the spherical harmonic parameters, and the spherical harmonic parameters are stored.
[0025] In a second aspect, an embodiment of the present application provides a target object rendering device, the device comprising:
[0026] An attribute acquisition module, used to acquire the object attributes of the object to be rendered;
[0027] A rendering mode determining module, used for determining a rendering mode of the target object to be rendered according to the target object attributes of the target object to be rendered;
[0028] A rendering module is used to render the target object to be rendered based on the rendering method; wherein the rendering method includes a first rendering method based on image lighting technology and / or a second rendering method based on pre-stored spherical harmonic parameters.
[0029] In a third aspect, an embodiment of the present application provides a computer device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be executed on the processor, and when the programs or instructions are executed by the processor, the steps of the method of the first aspect are implemented.
[0030] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method of the first aspect are implemented.
[0031] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method of the first aspect.
[0032] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method of the first aspect.
[0033] In an embodiment of the present application, at least one target object to be rendered in the device screen is determined, and the target object properties of the target object to be rendered are determined. The target object properties include the distance property, roughness property, etc. of the target object to be rendered, which can reflect the display situation of the target object to be rendered in the device screen. Based on the target object properties of the target object to be rendered, a rendering mode for rendering the target object to be rendered is determined, and the rendering mode includes a first rendering mode and a second rendering mode, and then the pixels on the target object to be rendered are rendered according to the determined rendering mode. In other words, it is possible to determine whether to use the first rendering mode or the second rendering mode to render the target object to be rendered according to the target object properties of the target object to be rendered. It should be noted that the first rendering mode refers to a rendering mode based on IBL technology, and the rendering mode based on IBL technology has a better rendering effect; the second rendering mode is different from the first rendering mode, and refers to a rendering mode based on pre-stored spherical harmonic parameters. The rendering mode based on pre-stored spherical harmonic parameters does not require the acquisition of sampling cubemaps, which can improve performance.
[0034] In the embodiment of the present application, for the target object that uses the sampled skylight Cubemap for IBL lighting, based on its properties, it is determined to use IBL lighting for rendering, or to use the lighting calculated by the spherical harmonic parameters of the skylight to replace the Cubemap sampling for rendering, so as to improve the performance of IBL lighting while ensuring the rendering effect as much as possible, and avoid additional consumption of bandwidth and heating of the equipment.
[0035] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0037] Figure 1 One of the flowcharts of the target object rendering method according to an embodiment of the present application is shown;
[0038] Figure 2 The second flowchart of the target object rendering method according to the embodiment of the present application is shown;
[0039] Figure 3 A structural block diagram of a target object rendering device according to an embodiment of the present application is shown;
[0040] Figure 4 A structural block diagram of a computer device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0042] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0043] The target object rendering method, apparatus, computer device and readable storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0044] The present application embodiment provides a method for rendering a target object, such as Figure 1 As shown, the method includes:
[0045] Step 101, obtaining the object properties of the object to be rendered;
[0046] Step 102, determining a rendering method of the target object to be rendered according to the target object properties of the target object to be rendered;
[0047] Step 103, rendering the target object to be rendered based on the rendering method; wherein the rendering method includes a first rendering method based on image illumination technology and / or a second rendering method based on pre-stored spherical harmonic parameters.
[0048] In this embodiment, at least one target object to be rendered in the device screen is determined, and the target object properties of the target object to be rendered are determined. The target object properties include the distance property, the roughness property, etc. of the target object to be rendered, which can reflect the display condition of the target object to be rendered in the device screen. Based on the target object properties of the target object to be rendered, a rendering mode for rendering the target object to be rendered is determined, and the rendering mode includes a first rendering mode and a second rendering mode, and then the pixels on the target object to be rendered are rendered according to the determined rendering mode. In other words, it can be determined whether to render the target object to be rendered using the first rendering mode or the second rendering mode according to the target object properties of the target object to be rendered.
[0049] It should be noted that the first rendering method refers to a rendering method based on IBL technology, which has a better rendering effect; the second rendering method is different from the first rendering method, and refers to a rendering method based on pre-stored spherical harmonic parameters. The rendering method based on pre-stored spherical harmonic parameters does not require sampling cubemap, which can improve performance.
[0050] In the embodiment of the present application, for the target object that uses the sampled skylight Cubemap for IBL lighting, based on its properties, it is determined to use IBL lighting for rendering, or to use the lighting calculated by the spherical harmonic parameters of the skylight to replace the Cubemap sampling for rendering, so as to improve the performance of IBL lighting while ensuring the rendering effect as much as possible, and avoid additional consumption of bandwidth and heating of the equipment.
[0051] In one embodiment of the present application, the object property of the object to be rendered includes a distance property of the object to be rendered; and determining the rendering mode of the object to be rendered according to the object property includes:
[0052] If the target object to be rendered is a distant target object, the rendering mode of the target object to be rendered is determined to be the second rendering mode.
[0053] In this embodiment, the object attributes of the target object to be rendered include distance attributes, that is, the distance of the target object to be rendered from the camera. The distance is generally determined according to the size of the target object in the device screen space. The larger the proportion in the screen space, the closer the distance is, which is a near-view target object; the smaller the proportion, the farther the distance is, which is a far-view target object.
[0054] For distant objects, it is not easy to notice the change in the display effect, and if an object is far away from the camera, the pixels on the object will be processed uniformly. Therefore, for distant objects, the second rendering method using the pre-stored spherical harmonic parameters is used for rendering, that is, the pre-obtained spherical harmonic parameters are used for specular reflection fitting, so that there is no need to sample the cubemap, and performance is improved by saving cubemap sampling.
[0055] In one embodiment of the present application, the object property of the target object to be rendered further includes a roughness property of the target object to be rendered; and determining the rendering mode of the target object to be rendered according to the object property further includes:
[0056] If the target object to be rendered is a near-view target object, and the roughness of the target object to be rendered is greater than a preset threshold, it is determined that the rendering mode of the target object to be rendered is the second rendering mode.
[0057] In this embodiment, for the target object with high roughness in the foreground, the effect does not change significantly, so the second rendering method of the pre-stored spherical harmonic parameters is used for rendering, that is, the pre-obtained spherical harmonic parameters are used for mirror reflection fitting, so that there is no need to sample the cubemap, and performance is improved by saving cubemap sampling.
[0058] In one embodiment of the present application, determining the rendering mode of the target object to be rendered according to the target object attribute further includes:
[0059] If the target object to be rendered is a near-view target object, and the roughness of the target object to be rendered is less than or equal to a preset threshold, it is determined that the rendering mode of the target object to be rendered is the first rendering mode.
[0060] In this embodiment, for a target object with low roughness (ie, high smoothness) in the near scene, the effect changes more obviously, so in order to ensure the rendering effect of the low-roughness target object in the near scene, IBL lighting is used for rendering.
[0061] In one embodiment of the present application, if the rendering mode of the target object to be rendered is the first rendering mode, then rendering the target object to be rendered based on the rendering mode includes:
[0062] Obtaining a first cubic map sampling result of the surrounding environment of the target object to be rendered, and calculating an ambient light specular reflection result according to the first cubic map sampling result;
[0063] The target object to be rendered is rendered based on the ambient light specular reflection result.
[0064] In this embodiment, when rendering is performed using the first rendering method, a first cube map sampling result ReflectionCubeSample of the surrounding environment of the target object to be rendered is obtained, and then the ambient light mirror reflection result ImageBasedReflections is calculated based on the first cube map sampling result ReflectionCubeSample, and then the ambient light mirror reflection result ImageBasedReflections is used to achieve the rendering of the target object to be rendered.
[0065] The calculation method of the ambient light specular reflection result is: ImageBasedReflections = ReflectionCubeSample×IndirectSpecularOcclusion×MixingWeight, where IndirectSpecularOcclusion is the indirect light specular reflection occlusion and MixingWeight is the mixing weight based on surface information.
[0066] In the embodiment of the present application, the target object with low roughness in the foreground is rendered using IBL lighting to ensure its rendering effect.
[0067] In one embodiment of the present application, if the rendering mode of the target object to be rendered is the second rendering mode, then rendering the target object to be rendered based on the rendering mode includes:
[0068] Calculating a fitted specular reflection effect according to the pre-stored spherical harmonic parameters and a normal of a given surface on the target object to be rendered;
[0069] According to the fitted specular reflection effect, an ambient light specular reflection result is calculated, and the target object to be rendered is rendered based on the ambient light specular reflection result.
[0070] In this embodiment, when the second rendering method is used for rendering, the fitted specular reflection effect SphericalHarmonics is calculated according to the pre-stored spherical harmonic parameters and the normal of a given surface on the target object to be rendered, and then the ambient light specular reflection result ImageBasedReflections is calculated according to the fitted specular reflection effect SphericalHarmonics, and finally the ambient light specular reflection result ImageBasedReflections is used to render the target object to be rendered.
[0071] The calculation method of ambient light specular reflection result is: ImageBasedReflections = SphericalHarmonics × IndirectSpecularOcclusion × MixingWeight, where IndirectSpecularOcclusion is the indirect light specular reflection occlusion and MixingWeight is the mixing weight based on surface information. SphericalHarmonics is obtained by the following function:
[0072] float3 GetSkySHDiffuseSimple(float3 Normal)
[0073] {
[0074] float4 NormalVector=float4(Normal,1);
[0075] float3 Intermediate0;
[0076] Intermediate0.x=dot(SkyIrradianceEnvironmentMap[0],NormalVector);
[0077] Intermediate0.y=dot(SkyIrradianceEnvironmentMap[1],NormalVector);
[0078] Intermediate0.z=dot(SkyIrradianceEnvironmentMap[2],NormalVector);
[0079] / / max to not get negative colors
[0080] return max(0,Intermediate0);
[0081] }
[0082] The function GetSkySHDiffuseSimple is used to obtain the spherical harmonic parameters of the skylight. The input is a three-dimensional vector Normal, which represents the normal direction of the surface. By adding an extra 1 to the normal vector, it is converted to a four-dimensional vector NormalVector, because four-dimensional vectors are usually used to represent pure vectors. Four-dimensional vectors include xyzw or RG BA, where w or A is usually 1.
[0083] Then, the dot product of the three channels of SkyIrradianceEnvironmentMap (usually RGB) and the normal vector is calculated to obtain a three-dimensional vector Intermediate0, where SkyIrradianceEnvironmentMap[0], SkyIrradianceEnvironmentMap[1], and SkyIrradianceEnvironmentMap[2] are the second-order spherical harmonic parameters of the three RGB channels respectively. The three dot product results Intermediate0.x, Intermediate0.y, and Intermediate0.z can be regarded as the "irradiance" or "brightness" of the corresponding color values and normal vectors in the environment map. The three dot product results are the dot product results of the spherical harmonic parameters and the normal, which is the fitting specular reflection effect SphericalHarmonics.
[0084] Finally, the maximum value of each element in Intermediate0 compared with 0 is returned. This means that the returned color value is non-negative. Because in color encoding, negative values usually represent black or shadows, and environment mapping usually represents lighting or reflection, non-negative values are used here.
[0085] Subsequently, the ambient light specular reflection result is obtained by fitting the product of the specular reflection effect Spherical Harmonics and Indirect Specular Occlusion and Mixing Weight.
[0086] In the embodiment of the present application, the objects with high roughness in the distant view and the near view are rendered using the rendering method of pre-stored spherical harmonic parameters to ensure improved performance.
[0087] In the embodiment of the present application, for nearby low-roughness targets to be rendered, the IBL technology is still used to render the ambient light specular reflection. For nearby high-roughness and distant targets to be rendered, the stored spherical harmonic coefficients are used with the normal of the current surface to obtain a fitted specular reflection effect, and the Cubemap sampling result is replaced to participate in the rendering calculation of the ambient light specular reflection.
[0088] Since the high roughness in the near distance and the target to be rendered in the distance use the pre-obtained spherical harmonic coefficients for specular reflection fitting without sampling the cubemap, this application can improve the performance of IBL lighting while ensuring the rendering effect, avoiding additional bandwidth consumption and heating of the device.
[0089] As a refinement and extension of the above embodiment, the embodiment of the present invention provides another object rendering method, such as Figure 2 As shown, the method includes:
[0090] Step 201, obtaining a second cubic map sampling result of the surrounding environment of the target object to be rendered, and determining a plurality of picture levels corresponding to the second cubic map sampling result, wherein different pictures store maps of different roughness of the second cubic map sampling result;
[0091] Step 202, fitting the texture stored in the target picture level in the plurality of picture levels by means of a spherical harmonic function to obtain the spherical harmonic parameters, and storing the spherical harmonic parameters;
[0092] Step 203, obtaining the object properties of the object to be rendered;
[0093] Step 204, determining a rendering method of the target object to be rendered according to the target object properties of the target object to be rendered;
[0094] Step 205 , rendering the target object to be rendered based on the rendering method; wherein the rendering method includes a first rendering method based on image illumination technology and / or a second rendering method based on pre-stored spherical harmonic parameters.
[0095] Among them, step 203 to step 205 are the same as or similar to step 101 to step 103 in the above embodiment, and are not described in detail again.
[0096] In this embodiment, the spherical harmonic parameters are determined offline. Specifically, the second cubemap sampling result of the surrounding environment of the target object to be rendered is obtained, that is, the Cubemap of IBL is generated. The Cubemap of IBL can be generated by capturing the environment to the rendering target (RenderTarget), which will be built into the engine.
[0097] Determine multiple picture levels (i.e., mipmap levels) of the second cube map sampling result, and different picture levels store maps of different roughness of the second cube map sampling result (i.e., specular reflection sampling results), wherein the lowest level of picture level stores the specular reflection sampling result corresponding to the highest roughness. The picture level is not fixed, and varies according to the resolution of the second cube map sampling result. For example, for a 256×256×6 map, the number of mipmap levels is 8, and mipmap generation is performed level by level, and each level is obtained by downsampling the previous level.
[0098] Furthermore, based on the texture stored in the target picture level in the multiple picture levels, a spherical harmonic function is used for fitting to obtain spherical harmonic parameters, and the spherical harmonic parameters are stored for subsequent use.
[0099] In one embodiment, the target image level is the level corresponding to the 32×32 size (i.e., resolution). The number of mipmap levels is determined by the size of the Cubemap image. For example, for an image of 1024 pixels, 32×32 is the 5th level, and for an image of 512 pixels, 32×32 is the 4th level. The 32×32 level can balance the effect and calculation. The 32×32 size retains more original image information and does not generate too much calculation when generating spherical harmonic parameters.
[0100] It should be noted that the purpose of collecting Cubemap images offline is to obtain the spherical harmonic coefficients in advance. However, in actual operation, there is no need to sample cubemap for nearby high roughness and distant objects to be rendered. During operation, spherical harmonic coefficients are used instead of cubemap images for nearby high roughness and distant objects to be rendered.
[0101] Furthermore, as a specific implementation of the above-mentioned target object rendering method, an embodiment of the present application provides a target object rendering device. Figure 3 As shown, the target object rendering device 300 includes: an attribute acquisition module 301 , a rendering mode determination module 302 and a rendering module 303 .
[0102] The attribute acquisition module 301 is used to acquire the object attributes of the object to be rendered;
[0103] A rendering mode determining module 302 is used to determine a rendering mode of the target object to be rendered according to the target object attributes of the target object to be rendered;
[0104] The rendering module 303 is used to render the target object to be rendered based on the rendering method; wherein the rendering method includes a first rendering method based on image illumination technology, or a second rendering method based on pre-stored spherical harmonic parameters.
[0105] In this embodiment, at least one target object to be rendered in the device screen is determined, and the target object properties of the target object to be rendered are determined. The target object properties include the distance property, the roughness property, etc. of the target object to be rendered, which can reflect the display condition of the target object to be rendered in the device screen. Based on the target object properties of the target object to be rendered, a rendering mode for rendering the target object to be rendered is determined, and the rendering mode includes a first rendering mode and a second rendering mode, and then the pixels on the target object to be rendered are rendered according to the determined rendering mode. In other words, it can be determined whether to render the target object to be rendered using the first rendering mode or the second rendering mode according to the target object properties of the target object to be rendered.
[0106] It should be noted that the first rendering method refers to a rendering method based on IBL technology, which has a better rendering effect; the second rendering method is different from the first rendering method, and refers to a rendering method based on pre-stored spherical harmonic parameters. The rendering method based on pre-stored spherical harmonic parameters does not require sampling cubemap, which can improve performance.
[0107] In the embodiment of the present application, for the target object that uses the sampled skylight Cubemap for IBL lighting, based on its properties, it is determined to use IBL lighting for rendering, or to use the lighting calculated by the spherical harmonic parameters of the skylight to replace the Cubemap sampling for rendering, so as to improve the performance of IBL lighting while ensuring the rendering effect as much as possible, and avoid additional consumption of bandwidth and heating of the equipment.
[0108] Furthermore, the object attribute of the object to be rendered includes the distance attribute of the object to be rendered; the rendering mode determination module 302 is specifically used to:
[0109] If the target object to be rendered is a distant target object, the rendering mode of the target object to be rendered is determined to be the second rendering mode.
[0110] Furthermore, the object properties of the object to be rendered further include a roughness property of the object to be rendered; the rendering mode determination module 302 is specifically used to:
[0111] If the target object to be rendered is a near-view target object, and the roughness of the target object to be rendered is greater than a preset threshold, it is determined that the rendering mode of the target object to be rendered is the second rendering mode.
[0112] Furthermore, the rendering mode determination module 302 is specifically configured to:
[0113] If the target object to be rendered is a near-view target object, and the roughness of the target object to be rendered is less than or equal to a preset threshold, it is determined that the rendering mode of the target object to be rendered is the first rendering mode.
[0114] Further, if the rendering mode of the target object to be rendered is the first rendering mode, the rendering module 303 is specifically configured to:
[0115] Obtaining a first cubic map sampling result of the surrounding environment of the target object to be rendered, and calculating an ambient light specular reflection result according to the first cubic map sampling result;
[0116] The target object to be rendered is rendered based on the ambient light specular reflection result.
[0117] Further, if the rendering mode of the target object to be rendered is the second rendering mode, the rendering module 303 is specifically configured to:
[0118] Calculating a fitted specular reflection effect according to the pre-stored spherical harmonic parameters and a normal of a given surface on the target object to be rendered;
[0119] According to the fitted specular reflection effect, an ambient light specular reflection result is calculated, and the target object to be rendered is rendered based on the ambient light specular reflection result.
[0120] Furthermore, the device also includes:
[0121] a parameter generation module, configured to obtain a second cubic map sampling result of the surrounding environment of the target object to be rendered, and determine a plurality of picture levels corresponding to the second cubic map sampling result, wherein maps of different roughness of the second cubic map sampling result are stored in different picture levels;
[0122] The texture stored in the target picture level in the plurality of picture levels is fitted by a spherical harmonic function to obtain the spherical harmonic parameters, and the spherical harmonic parameters are stored.
[0123] The target object rendering device 300 in the embodiment of the present application can be a computer device, or a component in the computer device, such as an integrated circuit or a chip. The computer device can be a terminal, or other devices other than a terminal. Exemplarily, the computer device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted computer device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (Augmented Reality, AR) / virtual reality (Virtual Reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (Ultra-Mobile Personal Computer, UMPC), a netbook or a personal digital assistant (Personal Digital Assistant, PDA), etc. It can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (Personal Computer, PC), a television (Television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0124] The target object rendering device 300 provided in the embodiment of the present application can achieve Figure 1 and Figure 2To avoid repetition, the various processes implemented in the target object rendering method embodiment are not described here.
[0125] The present application also provides a computer device, such as Figure 4 As shown, the computer device 400 includes a processor 401 and a memory 402. The memory 402 stores programs or instructions that can be executed on the processor 401. When the program or instruction is executed by the processor 401, the various steps of the above-mentioned target object rendering method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0126] It should be noted that the computer device in the embodiment of the present application includes the above-mentioned mobile computer device and non-mobile computer device.
[0127] The memory 402 can be used to store software programs and various data. The memory 402 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 402 may include a volatile memory or a non-volatile memory, or the memory 402 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 402 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0128] The processor 401 may include one or more processing units; optionally, the processor 401 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 401.
[0129] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned target object rendering method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0130] An embodiment of the present application also provides a chip, which includes a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned target object rendering method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0131] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0132] An embodiment of the present application also provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned target object rendering method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0133] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0134] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A method for rendering a target object, characterized in that: The method comprises: Get the object properties of the object to be rendered; Determining a rendering method of the target object to be rendered according to the target object attribute of the target object to be rendered; The target object to be rendered is rendered based on the rendering method; wherein the rendering method includes a first rendering method based on image lighting technology and / or a second rendering method based on pre-stored spherical harmonic parameters.
2. The method according to claim 1, characterized in that The object property of the object to be rendered includes a distance property of the object to be rendered; and determining the rendering method of the object to be rendered according to the object property includes: If the target object to be rendered is a distant target object, the rendering mode of the target object to be rendered is determined to be the second rendering mode.
3. The method according to claim 1, characterized in that The object property of the object to be rendered further includes a roughness property of the object to be rendered; and determining the rendering method of the object to be rendered according to the object property further includes: If the target object to be rendered is a near-view target object, and the roughness of the target object to be rendered is greater than a preset threshold, it is determined that the rendering mode of the target object to be rendered is the second rendering mode.
4. The method according to claim 1, characterized in that: The determining, according to the target object attributes, a rendering method of the target object to be rendered further includes: If the target object to be rendered is a near-view target object, and the roughness of the target object to be rendered is less than or equal to a preset threshold, it is determined that the rendering mode of the target object to be rendered is the first rendering mode.
5. The method according to claim 1, characterized in that If the rendering mode of the target object to be rendered is the first rendering mode, then rendering the target object to be rendered based on the rendering mode includes: Obtaining a first cubic map sampling result of the surrounding environment of the target object to be rendered, and calculating an ambient light specular reflection result according to the first cubic map sampling result; The target object to be rendered is rendered based on the ambient light specular reflection result.
6. The method according to claim 1, characterized in that If the rendering mode of the target object to be rendered is the second rendering mode, then rendering the target object to be rendered based on the rendering mode includes: Calculating a fitted specular reflection effect according to the pre-stored spherical harmonic parameters and a normal of a given surface on the target object to be rendered; According to the fitted specular reflection effect, an ambient light specular reflection result is calculated, and the target object to be rendered is rendered based on the ambient light specular reflection result.
7. The method according to any one of claims 1 to 6, characterized in that Before obtaining the object properties of the object to be rendered, the method further includes: Acquire a second cubic map sampling result of the surrounding environment of the target object to be rendered, and determine a plurality of picture levels corresponding to the second cubic map sampling result, where maps of different coarseness of the second cubic map sampling result are stored in different picture levels; The texture stored in the target picture level in the plurality of picture levels is fitted by a spherical harmonic function to obtain the spherical harmonic parameters, and the spherical harmonic parameters are stored.
8. A target object rendering device, characterized in that: The device comprises: An attribute acquisition module, used to acquire the object attributes of the object to be rendered; A rendering mode determining module, used for determining a rendering mode of the target object to be rendered according to the target object attributes of the target object to be rendered; A rendering module is used to render the target object to be rendered based on the rendering method; wherein the rendering method includes a first rendering method based on image lighting technology and / or a second rendering method based on pre-stored spherical harmonic parameters.
9. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction running on the processor, and when the program or instruction is executed by the processor, the steps of the target object rendering method according to any one of claims 1 to 7 are implemented.
10. A readable storage medium having a program or instruction stored thereon, characterized in that: When the program or instruction is executed by a processor, the steps of the target object rendering method according to any one of claims 1 to 7 are implemented.