Three-dimensional model rendering method and device and computing equipment
By acquiring the visible range of the 3D model and the terminal screen, and dynamically adjusting the viewpoint information and rendering process, the problem of incomplete display and poor visual effects of the 3D model on different terminals is solved, achieving adaptive rendering and high-quality display.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XINGIN INFORMATION TECH (SHANGHAI) CO LTD
- Filing Date
- 2025-12-23
- Publication Date
- 2026-04-17
AI Technical Summary
In existing technologies, the rendering of 3D models on different terminals cannot adapt to models from different external sources, cannot be used for display on different types of terminals, and cannot be dynamically adjusted according to viewpoint information and terminal display range, resulting in incomplete content display, poor visual effects, and redundant calculations, which affects user experience.
By acquiring the 3D model to be rendered, the visible range and rendering range of the target terminal screen, and based on the initial viewpoint information and the proportional adaptation relationship of the visible range, the target viewpoint information is determined, and a target projection image that conforms to the rendering range is obtained from the virtual camera position, and finally rendered.
It enables adaptive rendering of 3D models on terminals with different resolutions and aspect ratios, avoids redundant calculations, ensures that the displayed content matches the terminal screen resolution and aspect ratio, and improves the user's visual experience.
Smart Images

Figure CN121883684A_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification relate to the field of computer technology, and in particular to a three-dimensional model rendering method, a three-dimensional model rendering device, and a computing device. Background Technology
[0002] With the rapid development of 3D visualization technology, 3D models are increasingly widely used on various multimedia terminals, providing users with a richer interactive experience.
[0003] Currently, the rendering of 3D models on various terminals is usually done locally by the terminal itself, and the rendered 3D models are mostly obtained by the terminal itself. Therefore, the terminal can use preset camera parameters and fixed field of view to render accordingly, and directly map the 3D model onto the display area of the terminal screen for display in a fixed scaling manner.
[0004] However, the aforementioned methods, which render 3D models locally on the terminal, cannot adapt to 3D models from different external sources, nor are they suitable for display on different types of terminals. They do not consider the differences in display attributes between different terminal screens, nor can they dynamically adapt to the viewing angle information of different 3D models and the display range of the terminal. This results in incomplete content display, poor visual effects, and redundant calculations when rendering and displaying 3D models on terminals with different resolutions and aspect ratios, negatively impacting the user experience. Therefore, a more flexible and higher-quality 3D model rendering method is urgently needed. Summary of the Invention
[0005] In view of this, embodiments of this specification provide a method for rendering a three-dimensional model. One or more embodiments of this specification also relate to a three-dimensional model rendering apparatus, a computing device, a computer-readable storage medium, and a computer program product, to address the technical deficiencies existing in the prior art.
[0006] According to a first aspect of the embodiments of this specification, a three-dimensional model rendering method is provided, applied to a target terminal, the three-dimensional model rendering method comprising:
[0007] Obtain the 3D model to be rendered, the visible area of the target terminal screen, and the rendering area used to render the 3D model;
[0008] Based on the proportional adaptation relationship between the initial viewpoint information and the visible range of the 3D model, the target viewpoint information of the 3D model is determined.
[0009] Based on the target perspective information, obtain a target projection image that conforms to the rendering range from the virtual camera's location toward the 3D model;
[0010] The 3D model is rendered based on the target projection image.
[0011] According to a second aspect of the embodiments of this specification, a three-dimensional model rendering apparatus is provided, applied to a target terminal, comprising:
[0012] The acquisition module is configured to acquire the 3D model to be rendered, the visible area of the target terminal screen, and the rendering area used to render the 3D model.
[0013] The determination module is configured to determine the target viewpoint information of the 3D model based on the proportional adaptation relationship between the initial viewpoint information and the visible range of the 3D model.
[0014] The projection module is configured to obtain a target projection image that conforms to the rendering range from the position of the virtual camera to the direction of the 3D model, based on the target viewpoint information.
[0015] The rendering module is configured to render the 3D model based on the target projection image.
[0016] According to a third aspect of the embodiments of this specification, a computing device is provided, comprising:
[0017] Memory and processor;
[0018] The memory is used to store computer-executable instructions, and the processor is used to execute the computer program / instructions, which, when executed by the processor, implement the steps of the above-described 3D model rendering method.
[0019] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores a computer program / instructions that, when executed by a processor, implement the steps of the above-described three-dimensional model rendering method.
[0020] According to a fifth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described three-dimensional model rendering method.
[0021] One embodiment of this specification implements a three-dimensional model rendering method applied to a target terminal. The method includes: acquiring a three-dimensional model to be rendered, the visible range of the target terminal screen, and a rendering range for rendering the three-dimensional model; determining the target view information of the three-dimensional model based on the proportional adaptation relationship between the initial view information of the three-dimensional model and the visible range; obtaining a target projection image conforming to the rendering range from the location of the virtual camera to the three-dimensional model according to the target view information; and rendering the three-dimensional model based on the target projection image.
[0022] By acquiring the visible and rendering range of the target terminal screen, rendering is performed based on the display characteristics of the target terminal screen. Furthermore, based on the proportional adaptation relationship between the initial viewpoint information of the 3D model and the visible range, the target viewpoint information is automatically determined, thereby generating a target projection image that conforms to the rendering range. This achieves adaptive rendering of the 3D model on target terminal screens with different resolutions and aspect ratios, avoiding redundant calculations while ensuring the matching of the rendered content with the terminal screen resolution and aspect ratio. This guarantees the integrity, visual effect, and compatibility of the 3D model display, and improves the user's visual experience. Attached Figure Description
[0023] Figure 1 This is a flowchart illustrating a three-dimensional model rendering method provided in one embodiment of this specification;
[0024] Figure 2 This is a schematic diagram illustrating an embodiment of this specification for determining initial viewpoint information based on a virtual camera and a model bounding box;
[0025] Figure 3 This is a schematic diagram illustrating the determination of target perspective information according to one embodiment of this specification;
[0026] Figure 4 This is a schematic diagram illustrating the determination of another target perspective information provided in one embodiment of this specification;
[0027] Figure 5 This is a schematic diagram of the structure of a three-dimensional model rendering device provided in one embodiment of this specification;
[0028] Figure 6 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation
[0029] Many specific details are set forth in the following description to provide 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 extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.
[0030] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as 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, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0032] Furthermore, 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. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entry points for users to choose to authorize or refuse.
[0033] First, the terms and concepts used in one or more embodiments of this specification will be explained.
[0034] Neural Radiance Field (NeRF) is a technique that uses neural networks to implicitly represent 3D scenes. By learning the continuous volume density and color distribution of the scene, it can accurately render high-quality 3D scene images from various perspectives.
[0035] Virtual Reality (VR) is a technology that uses computers to generate a three-dimensional virtual environment and immerse users in it. It achieves an immersive interactive experience by simulating the human sensory system, especially vision and hearing.
[0036] 3D Gaussian Splatting (3DGS) is a method for representing and rendering 3D scenes based on Gaussian distribution. By representing objects in 3D space as a set of multiple Gaussian functions, it enables efficient modeling and rendering of complex 3D scenes, and is especially suitable for dynamic environments or applications that require real-time performance.
[0037] Liquid crystal display (LCD) is a display technology that uses liquid crystal materials to change their optical properties under the influence of an electric field to display images. It requires a backlight and a liquid crystal layer and is characterized by low cost and mature technology.
[0038] Organic light-emitting diode (OLED) display is a display technology that achieves self-illumination based on organic materials through carrier injection and recombination under the drive of an electric field. It does not require a backlight or liquid crystal layer and has the characteristics of high contrast, fast response, ultra-thin and flexible. The screen thickness can be controlled within 1 mm.
[0039] A view frustum is a cone-shaped geometry constructed from the position of the virtual camera and based on the target's viewpoint information during the 3D rendering process. It can include the entire visible area of the 3D model and is used to determine the spatial range in which the 3D model needs to be projected into the target projection image during the rendering process.
[0040] The RGB color mode with transparency channel (Alpha, Red, Green, Blue, or ARGB for short) is an extended mode that adds an Alpha transparency channel to the RGB color mode. It can use a 32-bit storage structure to achieve combined control of color and transparency. Each pixel consists of 8 bits of red, 8 bits of green, 8 bits of blue and 8 bits of Alpha channel, and supports independent control of transparency.
[0041] With the rapid development of 3D visualization technology, 3D models are increasingly widely used on various multimedia terminals, providing users with a richer interactive experience.
[0042] Currently, the rendering of 3D models on various terminals is usually done locally by the terminal itself, and the rendered 3D models are mostly obtained by the terminal itself. Therefore, the terminal can use preset camera parameters and fixed field of view to render accordingly, and directly map the 3D model onto the display area of the terminal screen for display in a fixed scaling manner.
[0043] However, the above method, which renders the 3D model locally on the terminal, cannot adapt to 3D models from different external sources, nor can it be used for display on other types of terminals. It does not take into account the differences in display attributes between different terminal screens, nor can it dynamically adapt to the perspective information of different 3D models and the display range of the terminal. As a result, when the 3D model is rendered and displayed on terminals with different resolutions and aspect ratios, the content is not displayed completely, the visual effect is poor, and there is redundant calculation, which affects the user experience.
[0044] In view of this, this specification provides a three-dimensional model rendering method, and also relates to a three-dimensional model rendering apparatus, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.
[0045] See Figure 1, Figure 1 A flowchart of a three-dimensional model rendering method according to an embodiment of this specification is shown, which specifically includes the following steps.
[0046] Step 102: Obtain the 3D model to be rendered, the visible area of the target terminal screen, and the rendering area used to render the 3D model.
[0047] The 3D model rendering method provided in one or more embodiments of this specification can be applied to various scenarios, including but not limited to 3D content display on social media platforms, product display on e-commerce platforms, and 3D teaching content display on online education platforms. Specific application objects include various platforms and applications that provide 3D content, including social media applications, e-commerce applications, educational applications, and game applications. Corresponding application platforms may include mobile application platforms, desktop application platforms, or network service application platforms. The terminal types used may include various devices with screen display capabilities, including smartphones, tablets, personal computers, smart TVs, and wearable devices. The rendering of 3D models can be flexibly configured for different application scenarios, application objects, application platforms, and terminal types.
[0048] The target terminal is a device or system that performs 3D model rendering and display, and can include, but is not limited to, smartphones, tablets, personal computers, smart TVs, and wearable devices. The target terminal has display capabilities for displaying on a physical or virtual screen, and also possesses a certain level of computing power. It can receive and process 3D model data for rendering and display, or it can directly receive rendered images for display. The hardware specifications and screen characteristics of the target terminal determine the specific implementation method for rendering and displaying 3D models. For example, smartphones can enable interactive display of 3D spatial photos; in virtual reality devices such as VR headsets, rendering parameters for 3D content can be dynamically adjusted based on actual projection parameters.
[0049] The 3D model to be rendered is a 3D data structure that needs to be rendered and displayed on the target terminal screen. It can include multiple 3D Gaussian points, which can be spheres or ellipsoids, and multiple 3D Gaussian points can form point cloud data. The attribute data of the 3D model can include information such as the total number of point cloud data, scaling attributes, rotation attributes, normal attributes, and file format; the attribute data of each 3D Gaussian point can include coordinate attributes, color attributes, and hue attributes, which together define the shape, appearance, and rendering characteristics of the 3D model. Specifically, the 3D model can be constructed in various ways. For example, it can be obtained based on image reconstruction using techniques such as Neural Radiation Field (NeRF) and 3D Gaussian Splatting (3DGS); it can also be constructed using geometric modeling methods such as polygonal mesh or voxel modeling; and it can also be constructed using methods such as structured light scanning.
[0050] The target terminal screen is the display panel on the target terminal device used to display rendered images of 3D models. It can be of different types, such as LCD screens, OLED screens, and micro-LED screens. Its screen size, resolution, aspect ratio, and display technology characteristics directly affect the rendering method and display effect of the 3D model. For example, the target terminal screen could be a 1920×1080 resolution LCD screen on a smartphone, or a 2560×1600 resolution OLED screen on a tablet computer.
[0051] The visible area of a target terminal screen is the actual area on the screen that can be used to display content. It is determined by the screen's physical size, system status bar, application interface elements, and display frames, excluding the non-displayable areas at the screen edges. The visible area is related to the target terminal screen's resolution, aspect ratio, and display settings, and is typically smaller than the target terminal screen's physical size. The visible area of a target terminal screen can determine the size and position of a rendered 3D model on the screen. For example, in a smartphone screen, the visible area is the actual usable pixel area excluding the status bar.
[0052] The rendering range is the size of the virtual canvas used to generate the projected image of the 3D model on the target terminal screen. It can be determined based on the physical size of the target terminal screen and the rendering size. It can be used to guide the determination of the viewpoint information of the 3D model during the rendering process and determines the display effect and adaptation degree of the 3D model on the target terminal screen.
[0053] In the actual rendering process, the 3D model to be rendered, the visible range, and the rendering range can be obtained first.
[0054] Specifically, the 3D model to be rendered can be obtained directly from local storage or a cloud server; or it can be dynamically constructed using 3D model building methods, such as generating a 3D spatial photo model from a single 2D image using 3DGS technology, which can be constructed by filling in missing viewpoint information using deep learning algorithms.
[0055] Specifically, the visible area of the target terminal screen can be obtained directly from the target terminal's operating system interface by acquiring the screen's physical dimensions and display attributes, and then calculated accordingly; it can also be determined through the target terminal's display settings parameters; or it can be calculated using the target terminal screen's resolution and display frame information. The rendering range used for rendering 3D models can be dynamically determined based on the target terminal screen's rendering requirements and screen characteristics; or it can be determined through the preset parameters of the rendering engine running on the target terminal.
[0056] Different data acquisition methods can be used individually or in combination. The specific acquisition method can be flexibly determined according to the actual rendering requirements. This specification does not impose specific limitations on this method in the embodiments.
[0057] In this step, by acquiring the 3D model to be rendered, the visible range of the target terminal screen, and the rendering range used to render the 3D model, a data foundation is provided for subsequently determining the viewpoint information and rendering display of the 3D model. This allows the rendering process of the 3D model to dynamically adjust the rendering parameters according to the display characteristics of different target terminal screens, avoiding adaptation problems between different target terminals, improving the display integrity and visual effect of the 3D model on terminals with different resolutions and aspect ratios, reducing redundant calculations, optimizing rendering efficiency, and improving the overall user experience.
[0058] Step 104: Determine the target viewpoint information of the 3D model based on the proportional adaptation relationship between the initial viewpoint information and the visible range of the 3D model.
[0059] The initial viewpoint information for a 3D model is a set of viewpoint parameters used during the 3D model rendering process to determine the initial position and orientation of the virtual camera relative to the 3D model. It is calculated based on the aggregate characteristics of the 3D model (such as model point cloud data coordinates, model bounding boxes, etc.) and the positional relationship with the virtual camera. It is an inherent attribute of the 3D model and is not limited by the display characteristics of the target terminal screen. Specifically, the initial viewpoint information of a 3D model can include the viewing angle range for observing the 3D model, including both horizontal and vertical viewing angle ranges, thus providing an initial viewpoint reference for the rendering of the 3D model and ensuring the display integrity of the 3D model during the rendering process.
[0060] Alternatively, initial viewpoint information can typically be calculated by analyzing the distance and angular relationship between the boundary points of the model bounding box of the 3D model and the virtual camera.
[0061] The scaling relationship refers to the size relationship between the initial viewpoint information of a 3D model and the visible range of the target terminal screen. It can be determined in both the horizontal and vertical directions. The scaling relationship can be used to determine the target viewpoint information when the 3D model is displayed on the target terminal screen. It can characterize the size of the bounding box of the 3D model and the degree of matching with the aspect ratio of the visible range, thereby determining the target viewpoint information that conforms to the actual visible range.
[0062] Optionally, in the actual rendering process, under normal circumstances, the initial viewpoint information of the 3D model is less than or equal to the visible range, that is, a suitable range of target viewpoint information is required, so as to avoid rendering the range that does not include the actual 3D model, thereby reducing the rendering of redundant areas and improving rendering efficiency.
[0063] The target viewpoint information of the 3D model is a set of viewpoint parameters, adjusted for scaling and adaptation, suitable for the visible range of the target terminal screen. This includes adjusted horizontal and vertical viewpoint ranges, guiding the virtual camera to generate a projected image that conforms to the display characteristics of the terminal screen during rendering. Specifically, compared to the initial viewpoint information, the target viewpoint information further considers the adaptation relationship between the target terminal screen's display attributes (including the visible range) and the 3D model, ensuring good display effects of the 3D model on different terminals while reducing redundant data processing. This achieves dynamic adaptation of the 3D model's rendering viewpoint to the display characteristics of different target terminal screens, further ensuring the integrity of the displayed content and rendering efficiency.
[0064] In the actual rendering process, once the 3D model to be rendered and the visible range of the target terminal screen are obtained, the target view information can be further determined based on the proportional relationship between the initial view information and the visible range.
[0065] Specifically, to determine the target viewpoint information based on the scaling adaptation relationship, the scaling adaptation relationship can be determined first by the size relationship between the geometric characteristics of the 3D model and the visible range, and then the target viewpoint information can be determined from the initial viewpoint information based on the scaling adaptation relationship.
[0066] The geometric characteristics of the 3D model can be represented by determining its bounding box. The horizontal and vertical dimensions of the bounding box are compared with the width and height of the target terminal's screen view area, respectively. If the horizontal dimension of the bounding box equals the width of the view area, and the vertical dimension equals the height, it indicates a good match between the initial viewpoint information of the 3D model and the view area, and the initial viewpoint information can be directly determined as the target viewpoint information. If there are discrepancies between the horizontal dimension of the bounding box and the width of the view area, and between the vertical dimension of the bounding box and the height of the view area, further dynamic calculations based on the initial viewpoint information are required to determine the target viewpoint information.
[0067] Optionally, in determining the target viewpoint information, in addition to determining it based on the scaling relationship, it can also be determined based on the display characteristics of the target terminal screen. For example, for a target terminal screen with a higher resolution, a smaller target viewpoint information can be used for rendering to obtain a more refined display effect; for a target terminal screen with a lower resolution, a larger target viewpoint information can be used for rendering to improve rendering efficiency.
[0068] Furthermore, when the proportional adaptation relationship is unclear, the target viewpoint information can be determined and rendered based on a preset default viewpoint range, thereby ensuring basic display effects. Different target viewpoint information can be flexibly selected according to actual rendering needs, and the embodiments in this specification do not make specific limitations on this.
[0069] In this step, the target viewpoint information of the 3D model is determined by adapting the initial viewpoint information to the visible range based on the proportional relationship between the initial viewpoint information and the visible range of the 3D model. This allows the rendering viewpoint of the 3D model to dynamically adapt to the visible range of different terminal screens, avoiding incomplete display content or poor visual effects caused by a fixed rendering viewpoint. This improves the display integrity and visual effect of the 3D model on terminals with different resolutions and aspect ratios, while reducing redundant calculations, optimizing rendering efficiency, and enhancing the overall user experience. This provides technical support for the widespread application of 3D spatial photos in cross-terminal scenarios.
[0070] Step 106: Based on the target viewpoint information, obtain a target projection image that conforms to the rendering range from the virtual camera's location toward the 3D model.
[0071] A virtual camera is a virtual object that simulates the imaging process of a real camera during 3D rendering. It is used to determine the viewpoint and projection method of a 3D model during rendering. The virtual camera's position, orientation, and field of view parameters determine the display effect of the 3D model in the target projected image, thus converting the geometric data of the 3D model in space into a 2D image. Specifically, in the actual rendering process, a coordinate system can be constructed with the virtual camera's location as the origin and the direction from the virtual camera to the 3D model as the coordinate axes. Projections are then performed based on rays from the origin to the boundary points of the 3D model to determine the projected image.
[0072] Optionally, the virtual camera can be positioned directly facing the center point of the front of the 3D model, or it can be positioned directly facing a point on the front of the 3D model, in order to obtain observation data of the 3D model from different perspectives, thereby presenting a stereoscopic viewing effect of a 3D spatial photograph during the rendering process of the target projection image.
[0073] The direction from the virtual camera's position to the 3D model is the line of sight from the virtual camera's position toward the 3D model. This direction defines the viewpoint and projection path during rendering and is the basis for determining the display range of the 3D model in the target projection image. Together with the target viewpoint information and the rendering range, it determines the rendering process.
[0074] A target projection image conforming to the rendering range is a two-dimensional image generated from the observation viewpoint of a virtual camera, matching the rendering range based on the target viewpoint information and rendering range requirements. It includes the complete display content of the 3D model under specific target viewpoint information and can serve as the final image data on the target terminal screen, directly corresponding to the size and content requirements of the target terminal screen's rendering range. For example, a target projection image conforming to the rendering range could be a 1280×720 pixel image, perfectly fitting the rendering area of the target terminal screen; or it could be a 1920×1080 pixel image, cropped or sampled to fit a specific display area of the target terminal screen.
[0075] Once the target viewpoint information and the location of the virtual camera are determined, a target projection image conforming to the rendering range can be obtained from the virtual camera's location towards the 3D model. Specifically, there are several methods for obtaining the target projection image. One option is to construct a view frustum based on the virtual camera's viewpoint information, using the virtual camera's location as a vertex, extending it from the virtual camera's location towards the 3D model, and then extracting a target projection image conforming to the rendering range within the view frustum based on the distance between the virtual camera and the 3D model. Another option is to calculate the vectors from the virtual camera to key points on the 3D model and determine the rendering projection area using the corresponding ray paths. Yet another option is to determine the spherical projection area based on the relative positional relationship between the virtual camera and the 3D model and generate a target projection image conforming to the rendering range. The specific method for obtaining the target projection image can be flexibly determined according to actual rendering needs; this specification does not specifically limit this method in the embodiments.
[0076] Optionally, the parameters of the virtual camera can be dynamically adjusted based on the matching relationship between the rendering range and the projection area of the 3D model under the target viewpoint information, thereby flexibly generating image content that matches the rendering range. For example, if the rendering range is smaller than the projection area of the 3D model, the projection area can be cropped to fit the rendering range; if the rendering range is larger than the projection area of the 3D model, the projection area can be upsampled to fill the rendering range; if the two sizes match, the target projection image can be determined based on the projection result of the 3D model under the target viewpoint information.
[0077] In this step, by acquiring a target projection image that conforms to the rendering range from the virtual camera position to the 3D model based on the target perspective information, it is ensured that the displayed content of the 3D model on different terminal screens is completely matched with the rendering range. This avoids problems such as incomplete display of model content or poor visual effects, and enables the rendering process of the 3D model to dynamically adapt to different rendering range requirements. This improves the display integrity and visual effect of the 3D model on terminals with different resolutions and aspect ratios, while reducing redundant calculations, optimizing rendering efficiency, and enhancing the overall user experience.
[0078] Step 108: Render the 3D model based on the target projection image.
[0079] The rendering operation of a 3D model is the process of using computer graphics technology and a rendering engine to process the target projected image and convert it into a pixel array that is ultimately displayed on the target terminal screen. Through computational steps such as image compositing, pixel mapping, color space conversion, and display optimization, the 2D visual data in the target projected image is integrated with the hardware characteristics of the target terminal screen (such as resolution, color gamut, and refresh rate) to generate a high-quality image suitable for screen output, ensuring that the 3D model is presented in a visually consistent and detailed manner on the target terminal.
[0080] Specifically, based on the target projection image, the 3D model is rendered on the target terminal to obtain a corresponding 3D spatial image for display. This 3D spatial image provides a stereoscopic viewing angle; that is, it can be viewed from a specific viewing angle range on the target terminal screen, thus representing different perspectives of the 3D model at a certain angle. Specifically, the viewing angle of the 3D spatial image on the target terminal is generally within a fixed 5-10° tilt range, and a stereoscopic viewing effect is provided by slight rotation of the viewing angle.
[0081] In the actual rendering process, once the target projection image is obtained, the 3D model can be rendered based on the target projection image. Specifically, rendering the 3D model based on the target projection image can include overlaying the target projection image onto the physical pixel range determined by the physical size of the target terminal screen, and determining the corresponding rendering pixels by rendering sampling the physical pixels obtained after overlay, and then cropping the display based on the visible range of the target terminal screen.
[0082] That is, rendering the 3D model based on the target projection image, including:
[0083] The target projected image is overlaid onto the physical pixels corresponding to the physical size of the target terminal screen;
[0084] By using target downsampling, the physical pixels of the stacked target projection image are rendered as the rendering pixels corresponding to the rendering size of the target terminal screen.
[0085] Based on the visible range, the rendered pixels of the rendered target projection image are cropped to obtain the target 3D data for displaying the 3D model on the target terminal screen.
[0086] The physical pixels corresponding to the physical size are the total number of pixels inherent in the target terminal screen hardware itself. They can be represented by the pixel values of width and height, such as 1920×1080, reflecting the original resolution and maximum display capability of the target terminal screen. The physical pixels corresponding to the physical size can provide a benchmark reference for the rendering process, ensuring that the image can be initially mapped at the screen's native level of detail, laying the foundation for subsequent stacking and downsampling operations.
[0087] The rendered pixels corresponding to the rendered size represent the actual number of pixels generated and processed during the rendering process. This number can be determined by adjusting the sampling ratio based on the rendering requirements of the target terminal screen and can be less than or equal to the physical pixels corresponding to the physical size. Rendered pixels corresponding to the rendered size can optimize the use of computing resources, improving rendering efficiency by reducing the amount of pixel processing during rendering, while maintaining visual quality and compatibility with the screen display.
[0088] Overlay operation is the process of placing the target projected image onto the physical pixel area corresponding to the physical size of the target terminal screen in a pixel-aligned manner. It may include image coordinate transformation and buffer writing. Overlay operation ensures that the target projected image correctly covers the physical pixel space of the target terminal screen, providing a unified image basis for subsequent rendering steps and avoiding positional offsets or display anomalies.
[0089] Cropping is a process that removes excess pixels from a rendered image based on the visible area of the target screen, eliminating invisible or redundant parts. Cropping accurately adapts to the actual display area of the screen, ensuring that the final output image includes valid content within the visible range, improving visual neatness and rendering efficiency.
[0090] In this step, the 3D model is rendered based on the target projection image, ensuring that the displayed content of the 3D model is completely matched with the rendering range of the target terminal screen. This avoids problems such as incomplete content display or poor visual effects, and improves the display integrity and visual effect of the 3D model on terminals with different resolutions and aspect ratios.
[0091] In the embodiments of this specification, by obtaining the visible range and rendering range of the target terminal screen, rendering is performed based on the display characteristics of the target terminal screen. Furthermore, based on the proportional adaptation relationship between the initial viewpoint information of the 3D model and the visible range, the target viewpoint information is automatically determined, thereby generating a target projection image that conforms to the rendering range. This achieves adaptive rendering of the 3D model on target terminal screens with different resolutions and aspect ratios, avoiding redundant calculations while ensuring the matching of the rendered content with the resolution and aspect ratio of the terminal screen. This guarantees the integrity, visual effect, and compatibility of the 3D model display, and improves the user's visual experience.
[0092] In one optional embodiment of this specification, obtaining the rendering range for rendering the 3D model includes:
[0093] Obtain the physical and rendered dimensions of the target terminal screen;
[0094] The rendering sampling ratio is determined based on the physical size and the rendering size;
[0095] Based on the rendering sampling ratio, the rendering size is sampled to obtain the rendering range used to render the 3D model.
[0096] Physical dimensions are inherent size information of the target terminal screen hardware itself. They can be measured by the total number of pixels and represented by pixel values for width and height, such as 1920×1080 or 2560×1600, reflecting the original resolution and maximum display capability of the target terminal screen. Specifically, physical dimensions are an inherent attribute of the target terminal screen that does not change with the application interface or system state. They provide a low-level spatial reference for 3D model rendering and are fundamental parameters for determining the rendering range and rendering sampling ratio.
[0097] The rendering size is the actual virtual canvas size used to generate image content during the rendering process of a 3D model, and it can also be measured by the total number of pixels. The rendering size can be dynamically set based on the rendering requirements and performance limitations of the target terminal screen, and is usually less than or equal to the physical size. The rendering size is not a hardware attribute of the target terminal screen, but rather a logical parameter. It controls the granularity of calculation and the output scale of the rendering engine when generating the target projected image. It is one of the key parameters for determining the rendering range and, together with the physical size, participates in the calculation of the rendering sampling ratio, thereby achieving adaptive adaptation to the display capabilities of different terminal devices.
[0098] The rendering sampling ratio is a scaling factor between the rendered size and the physical size of the target terminal screen. It can be calculated independently in the horizontal (width) and vertical (height) directions to handle non-uniform scaling scenarios. The rendering sampling ratio describes the degree to which the original screen pixels are downsampled during the rendering process. It balances physical display capabilities and logical rendering requirements, directly affecting the determination of the rendering range used to render 3D models. Specifically, a smaller rendering sampling ratio results in fewer rendered pixels and lower computational overhead; a larger rendering sampling ratio is closer to the native resolution and provides higher visual fidelity.
[0099] Once the physical and rendering dimensions of the target terminal screen are obtained, the rendering residual ratio can be determined accordingly. Specifically, it can be dynamically set based on the hardware performance of the target terminal. For example, a near 1:1 sampling ratio can be used on high-performance terminal devices to preserve details, while a smaller ratio can be used on low-performance terminal devices to increase the frame rate. Alternatively, the sampling ratio can be automatically adjusted according to the current application's operating mode (such as power-saving mode, performance mode, etc.). It can also be determined through the display quality options manually set by the user.
[0100] Specifically, the calculation of the rendering sampling ratio can also adopt a fixed calculation strategy, such as determining it through the size relationship between the physical size and the rendering size.
[0101] For example, further explanation can be provided in conjunction with actual calculation methods.
[0102] Let the physical size of the target terminal screen be W. act ×H act The rendering size is W ren ×H ren .
[0103] Under normal circumstances, the rendering size will not exceed the physical size; that is, for any terminal device, there is always: W act ≥W ren And H act ≥H ren .
[0104] Correspondingly, the calculation of the rendering sampling ratio S can be expressed as:
[0105]
[0106] Correspondingly, the calculation of the rendering range W×H used to render the 3D model can be expressed as:
[0107] W = S·W ren H = S·H ren
[0108] Optionally, if non-uniform sampling exists during the sampling process of the target terminal screen, W and H may be related to W. act and H act Not exactly equal.
[0109] In the embodiments of this specification, by obtaining the physical size and rendering size of the target terminal screen and further determining the rendering sampling ratio to sample the rendering size, the rendering range of the 3D model is determined. This achieves accurate determination of the rendering range, enabling the rendering process of the 3D model to be adaptively adjusted according to the actual display capabilities and rendering requirements of the target terminal. This avoids redundant calculations caused by full-size rendering on high-resolution target terminal screens, while preventing stuttering issues caused by over-rendering on low-performance target terminal devices. Thus, while ensuring visual effects, it optimizes the utilization efficiency of computing resources and enhances the compatibility and consistency of 3D content in different target terminal rendering environments. This provides technical support for the widespread application of new 3D content such as 3D spatial photos in multi-platform scenarios such as social media and e-commerce displays.
[0110] In an optional embodiment of this specification, before determining the target viewpoint information of the 3D model based on the scaling relationship between the initial viewpoint information and the visible range of the 3D model, the method further includes:
[0111] Traverse the point cloud data of the 3D model and construct the model bounding box of the 3D model;
[0112] Based on the relative positional relationship between the model bounding box and the virtual camera, the initial viewpoint information for the 3D model is determined.
[0113] Point cloud data of a 3D model is a collection of multiple 3D Gaussian points within the model. Each Gaussian point's point cloud data possesses attribute information, including coordinates, color, scaling, rotation, and normals, which together constitute the geometric structure and visual representation of the 3D model. Specifically, point cloud data is the core data structure of a 3D model. Each point cloud data represents the positional attribute of a 3D Gaussian point in 3D space, determining the visual effect and spatial location of that point during the rendering process.
[0114] A model bounding box is the smallest cube that can completely contain all the point cloud data of a 3D model. It can be used to represent the extent and size of a 3D model in space. The model bounding box is a key representation of the geometric properties of a 3D model. By determining the coordinates of the bounding box's boundary points, basic dimensional information such as the width, height, and depth of the 3D model can be directly obtained, providing a data foundation for subsequent rendering and adaptation calculations. Specifically, the calculation of the model bounding box can be based on the coordinate range of all points in the point cloud data. For example, if a vertex of the model bounding box is taken as the origin, and the coordinate range of the corresponding 3D model's point cloud data is x∈[0,10], y∈[0,5], z∈[0,8], then the size of the model bounding box is 10×5×8. In the actual rendering process, since the model bounding box is used to determine the initial viewpoint information of the 3D model, the position of the virtual camera needs to be considered simultaneously. Therefore, the position of the virtual camera is generally taken as the origin.
[0115] The relative positional relationship refers to the spatial relationship between a virtual camera and a 3D model. It can include the vertical distance (also known as depth distance) from the virtual camera to the model's bounding box, the horizontal distance from the virtual camera to each boundary of the model's bounding box, and the vertical distance, etc., used to determine the virtual camera's viewpoint information and projection range relative to the 3D model. Specifically, the relative positional relationship is a key parameter for determining the initial viewpoint information. By analyzing the relative position of the virtual camera and the model's bounding box, the display range and viewpoint range of the model under the virtual camera's perspective can be calculated.
[0116] In actual rendering, once a 3D model is obtained, its bounding box can be constructed by traversing the point cloud data of the 3D model. Specifically, the bounding box can be determined by recording the maximum range of coordinate positions in each point cloud data point and defining the smallest cube extending along the coordinate axes of the 3D model. For example, the minimum coordinate of the bounding box can be initialized to positive infinity and the maximum coordinate to negative infinity. Then, by traversing the coordinates of each point in the point cloud data and comparing the x, y, and z coordinates with the current minimum and maximum coordinates of the bounding box, if the point cloud coordinates are less than the current minimum coordinates, the minimum coordinates are updated; if the point cloud coordinates are greater than the current maximum coordinates, the maximum coordinates are updated. This process ultimately yields the model bounding box, whose minimum coordinate is (x, y, z). min ,y min ,z min ), the maximum coordinate is (x max ,y max ,z max If ), then the size of the model's bounding box is (x max -x min ,y max -y min ,z max -z min ).
[0117] Once the model bounding box is determined, the initial viewpoint information of the 3D model can be determined based on the relative positional relationship between the model bounding box and the virtual camera. Specifically, the method for determining the initial viewpoint information may include calculating the vertical distance from the virtual camera to the front of the model bounding box, and the distances from the virtual camera to the four sides of the front of the model bounding box, based on the relative positional relationship between the model bounding box and the virtual camera. Then, the horizontal and vertical viewpoint ranges are calculated using trigonometric functions to finally determine the initial viewpoint information.
[0118] First, determine the vertical distance *d* from the virtual camera to the front of the model bounding box. Then, determine the distances from the virtual camera to the left, right, top, and bottom sides of the model bounding box, i.e., the horizontal distance *w* and the vertical distance *h*. The corresponding horizontal viewing angle range can then be 2 × arctan(*w* / *d*), and the vertical viewing angle range can be 2 × arctan(*h* / *d*), where *w* is the half-width of the model bounding box along the x-axis, and *h* is the half-height of the model bounding box along the y-axis. For example, when the vertical distance *d* from the virtual camera to the model bounding box is 5, the half-width *w* of the model bounding box along the x-axis is 3, and the half-height *h* along the y-axis is 2, the horizontal viewing angle range is 2 × arctan(3 / 5) ≈ 65.4 degrees, and the vertical viewing angle range is 2 × arctan(2 / 5) ≈ 42.2 degrees.
[0119] In the embodiments of this specification, a model bounding box is constructed by traversing the point cloud data of the 3D model, and the initial viewpoint information is determined based on the relative positional relationship between the model bounding box and the virtual camera. This provides an accurate geometric basis for subsequent rendering adaptation, avoids the problem of incomplete display content or poor visual effect of the 3D model caused by a fixed rendering viewpoint, and ensures the display integrity and visual effect of the 3D model on terminals with different resolutions and aspect ratios.
[0120] In one optional embodiment of this specification, initial viewpoint information for the 3D model is determined based on the relative positional relationship between the model bounding box and the virtual camera, including:
[0121] The horizontal and vertical viewing angle ranges are determined based on the vertical distance from the virtual camera to the front of the model bounding box and the distance from the virtual camera to the four sides of the front of the model bounding box.
[0122] The initial viewing angle information is determined based on the horizontal and vertical viewing angle ranges.
[0123] The distances from the virtual camera to the four sides of the bounding box are the horizontal and vertical distances from the virtual camera position to the four boundaries of the model's bounding box, including the distances to the left, right, top, and bottom boundaries. These distances are obtained by measuring the ray lengths from the virtual camera to each boundary of the model's bounding box and are used to calculate the display range of the 3D model from the virtual camera's perspective. For example, if the distances from the virtual camera to the left, right, top, and bottom boundaries of the model's bounding box are 3 units, the symmetrical display range of the 3D model in the horizontal and vertical directions can be determined. If the distances are 4 units, 2 units, 1 unit, and 3 units, the asymmetrical display range of the model in the horizontal and vertical directions can be determined.
[0124] The horizontal viewing angle range is the range of angles that completely encompass the 3D model from the perspective of the virtual camera in the horizontal direction. It is usually expressed in degrees and can be calculated based on the distances from the virtual camera to the left and right edges and the vertical distance from the virtual camera to the front of the model's bounding box. It is used to determine the display width or visible boundary of the 3D model in the horizontal direction. For example, if the horizontal width of the model's bounding box is 6 units and the vertical distance from the virtual camera to the front of the model's bounding box is 5 units, the horizontal viewing angle range can be calculated as 2×arctan(3 / 5)≈65.4 degrees; if the horizontal width of the model's bounding box is 8 units and the vertical distance from the virtual camera to the front of the model's bounding box is 4 units, the horizontal viewing angle range can be calculated as 2×arctan(4 / 4)=90 degrees.
[0125] The vertical viewing angle range is the range of angles that completely encompass the 3D model from the perspective of the virtual camera in the vertical direction. It is usually expressed in degrees and can be calculated based on the distances from the virtual camera to the top and bottom edges of the model's bounding box and the vertical distance. It is used to determine the display height or visible boundary of the 3D model in the vertical direction. For example, if the vertical height of the model's bounding box is 4 units and the vertical distance from the virtual camera to the front of the model's bounding box is 5 units, the vertical viewing angle range can be calculated as 2×arctan(2 / 5)≈42.2 degrees; if the vertical height of the model's bounding box is 6 units and the vertical distance from the virtual camera to the front of the model's bounding box is 3 units, the vertical viewing angle range can be calculated as 2×arctan(3 / 3)=90 degrees.
[0126] In the actual rendering process, once the relative positional relationship between the model bounding box and the virtual camera is determined, the horizontal and vertical viewing angle ranges can be further determined based on the vertical distance from the virtual camera to the front of the model bounding box and the distance from the virtual camera to the four sides of the front of the model bounding box; and the initial viewing angle information can be determined based on the horizontal and vertical viewing angle ranges.
[0127] Specifically, the horizontal and vertical viewing angle ranges can be determined by calculating them using trigonometric functions based on the distances from the virtual camera to the four sides of the model's bounding box and the vertical distance from the virtual camera to the model's bounding box. The horizontal viewing angle range can be calculated by the ratio of horizontal distance to vertical distance, and the vertical viewing angle range can be calculated by the ratio of vertical distance to vertical distance. The horizontal viewing angle range is 2×arctan(w / d), and the vertical viewing angle range is 2×arctan(h / d), where w is the half-width of the model bounding box in the horizontal direction, h is the half-height of the model bounding box in the vertical direction, and d is the vertical distance from the virtual camera to the front of the model bounding box. Alternatively, a pre-stored viewing angle range table can be used to determine the corresponding viewing angle range based on the size of the model bounding box and the distance to the virtual camera. For example, when the ratio of the size of the model bounding box to the distance to the virtual camera is a specific value, the preset viewing angle range value can be used directly, thus avoiding the overhead of real-time calculation. Furthermore, a machine learning model can be used to predict and determine a suitable viewing angle range based on the correlation between historical rendering data and viewing angle ranges. This can provide a more accurate viewing angle range and improve rendering efficiency in the rendering of more complex 3D models.
[0128] For example, continuing with the previous example, we will further illustrate this by combining it with actual calculation methods.
[0129] The maximum extent of the bounding box determined by traversing the point cloud data of the 3D model is denoted as x. max x min y max y min z max z min .
[0130] If the virtual camera is directly facing the center point of the front of the bounding box of the 3D model, then you can refer to... Figure 2 , Figure 2 This specification illustrates a schematic diagram of an embodiment of determining initial viewpoint information based on a virtual camera and a model bounding box, as shown in the diagram. Figure 2 As shown.
[0131] Constructing a coordinate system with the virtual camera's location as the origin O and the direction from the virtual camera to the bounding box of the 3D model as the Z-axis, the distance from the virtual camera to the vertical direction of the front of the model's bounding box can be expressed as z.min The coordinates of the left boundary of the model's bounding box can be represented as x. min The right boundary coordinates can be represented as x max The upper boundary coordinates can be represented as y max The lower boundary coordinates can be represented as y min .
[0132] The virtual camera's field of view for the model's bounding box in the four directions of up, down, left, and right can be expressed as:
[0133]
[0134] in, This refers to the left-side viewpoint. This refers to the right-side viewpoint. This refers to the upper side view range. This refers to the lower side view range.
[0135] Correspondingly, the horizontal viewing angle range θ x and vertical viewing angle range θ y The determination of can be expressed as:
[0136]
[0137] In the embodiments of this specification, the horizontal and vertical viewing angle ranges are determined based on the distances from the virtual camera to the four sides of the model bounding box and the vertical distance from the virtual camera to the model bounding box. This accurately determines the initial viewing angle information, avoiding the problem of incomplete 3D model display or poor visual effects caused by a fixed rendering viewpoint. It ensures the display integrity and visual effects of the 3D model on terminals with different resolutions and aspect ratios, while reducing redundant calculations, optimizing rendering efficiency, improving the overall user experience, and enabling interactive 3D content to present high-quality visual effects on various terminal devices.
[0138] In one optional embodiment of this specification, the horizontal and vertical viewing angle ranges are determined based on the vertical distance from the virtual camera to the front of the model bounding box, and the distances from the virtual camera to the four sides of the front of the model bounding box, including:
[0139] Based on the vertical distance from the virtual camera to the front of the model bounding box, and the distance from the virtual camera to the four sides of the front of the model bounding box, determine the two viewing angle ranges in the horizontal direction and the two viewing angle ranges in the vertical direction relative to the virtual camera.
[0140] The horizontal viewing angle range is determined by symmetrically flipping the two viewing angle ranges in the horizontal direction along the vertical direction, and the vertical viewing angle range is determined by symmetrically flipping the two viewing angle ranges in the vertical direction along the horizontal direction.
[0141] The two horizontal viewpoints are the angular ranges of the viewpoints observed from the virtual camera's perspective, corresponding to the left and right boundaries of the model's bounding box, respectively. These can include a left viewpoint and a right viewpoint, used to determine the display boundaries of the 3D model in the horizontal direction. Specifically, the left viewpoint represents the angle between the line connecting the virtual camera to the left boundary of the model's bounding box and the vertical direction, while the right viewpoint represents the angle between the line connecting the virtual camera to the right boundary of the model's bounding box and the vertical direction.
[0142] The two vertical viewpoint ranges are the angular ranges of the viewpoints corresponding to the upper and lower boundaries of the model's bounding box, observed from the virtual camera's perspective. These ranges, including an upper viewpoint range and a lower viewpoint range, are used to determine the display boundaries of the 3D model in the vertical direction. Specifically, the upper viewpoint range represents the angle between the line connecting the virtual camera to the upper boundary of the model's bounding box and the vertical direction, while the lower viewpoint range represents the angle between the line connecting the virtual camera to the lower boundary of the model's bounding box and the vertical direction.
[0143] Symmetry reversal is a processing method that adjusts the asymmetrical horizontal and vertical viewing angles to symmetrical ranges by flipping them during the calculation of the horizontal and vertical viewing angles when the virtual camera is not directly facing the center point of the model's bounding box. This ensures that the horizontal and vertical viewing angles maintain symmetry and integrity after calculation, avoiding poor display effects and missing content caused by asymmetrical viewing angles.
[0144] Specifically, symmetric inversion involves reversing the larger of the two horizontal viewpoints (left and right) symmetrically along the vertical direction during the calculation of the horizontal and vertical viewpoint ranges, thus covering the smaller viewpoint. Similarly, the larger of the two vertical viewpoints (upper and lower) is symmetrically flipped horizontally to cover the smaller viewpoint. This symmetrical flipping adjusts the smaller viewpoint to be equal to the larger viewpoint, resulting in a symmetrical viewpoint range for observation of the virtual camera.
[0145] For example, if the left-side viewing angle is 60 degrees and the right-side viewing angle is 40 degrees, choose 60 degrees as the base for the horizontal viewing angle and flip the right-side viewing angle to 60 degrees to obtain a symmetrical horizontal viewing angle of 2 × 60 = 120 degrees; if the upper-side viewing angle is 50 degrees and the lower-side viewing angle is 30 degrees, choose 50 degrees as the base for the vertical viewing angle and flip the lower-side viewing angle to 50 degrees to obtain a symmetrical vertical viewing angle of 2 × 50 = 100 degrees.
[0146] For example, continuing with the previous example, we will further illustrate this by combining it with actual calculation methods.
[0147] remember This refers to the left-side viewpoint. This refers to the right-side viewpoint. This refers to the upper side view range. This refers to the lower side view range.
[0148] Correspondingly, the horizontal field of view (FoV) x and vertical field of view (FoV) y It can be represented as:
[0149]
[0150] In the embodiments of this specification, two horizontal and two vertical viewing angle ranges are determined based on the vertical distance from the virtual camera to the front of the model bounding box and the distance from the virtual camera to the four sides of the front of the model bounding box. The horizontal viewing angle range is determined by symmetrically flipping the two horizontal viewing angle ranges along the vertical direction, and the vertical viewing angle range is determined by symmetrically flipping the two vertical viewing angle ranges along the horizontal direction. This achieves accurate determination of the initial viewing angle information even when the virtual camera is not directly facing the center point of the front of the model bounding box. This avoids the problem of incomplete 3D model display or poor visual effects caused by asymmetrical viewing angles, ensuring the display integrity and visual effects of the 3D model on terminals with different resolutions and aspect ratios. Simultaneously, it reduces redundant calculations, optimizes rendering efficiency, improves the overall user experience, and enables interactive 3D content to present high-quality visual effects on various terminal devices.
[0151] In one optional embodiment of this specification, the target viewpoint information of the 3D model is determined based on the proportional adaptation relationship between the initial viewpoint information and the visible range of the 3D model, including:
[0152] Based on the size and visible range of the bounding box of the 3D model, comparisons are made in the horizontal and vertical directions respectively. Based on the comparison results and the initial viewpoint information of the 3D model, the target viewpoint information of the 3D model is determined.
[0153] The bounding box of a model is the smallest cube that can completely contain all the point cloud data of a 3D model. Its geometric dimensions in the horizontal and vertical directions are determined by calculating the extreme coordinates of the point cloud data. It can include the horizontal width, vertical height, and thickness (depth) of the bounding box. These are key parameters representing the geometric characteristics of a 3D model, characterizing its spatial extent and size. A proportional relationship exists between the bounding box's initial viewpoint information and the visible range of the target terminal screen. By comparing the bounding box's dimensions with the aspect ratio of the visible range, the display adaptability of the 3D model on the target terminal screen, i.e., the target viewpoint information, can be determined.
[0154] The comparison operation, performed during 3D model rendering, determines the relationship between the horizontal dimensions of the model's bounding box and the horizontal width of the target terminal's screen viewport, as well as the vertical dimensions of the model's bounding box and the vertical height of the target terminal's screen viewport. This comparison characterizes the degree of display adaptation between the 3D model and the viewport in the horizontal and vertical directions. By performing the comparison operation, it's possible to determine whether the dimensions of the model's bounding box match the aspect ratio of the viewport, obtaining the comparison results and thus providing a basis for determining the target viewing angle information.
[0155] The comparison result is a judgment result obtained by comparing the size of the model bounding box with the visible range in the horizontal and vertical directions, and can include various types of results. For example, it can include the model bounding box's horizontal dimension being equal to the horizontal width of the visible range, and its vertical dimension being equal to the vertical height of the visible range; it can also include the model bounding box's horizontal dimension being smaller than the horizontal width of the visible range, and its vertical dimension being equal to the vertical height of the visible range; it can also include the model bounding box's horizontal dimension being equal to the horizontal width of the visible range, and its vertical dimension being smaller than the vertical height of the visible range, etc. Different comparison results can affect the determination of the target viewpoint information of the 3D model. For example, if the comparison result is that the model bounding box's horizontal dimension is equal to the horizontal width of the visible range, and its vertical dimension is equal to the vertical height of the visible range, the target viewpoint information can be determined based on the vertical viewpoint range in the initial viewpoint information.
[0156] In the actual rendering process, the comparison operation can be achieved by comparing the horizontal dimension of the model bounding box of the 3D model with the horizontal width of the target terminal screen's visible range, and comparing the vertical dimension of the model bounding box with the vertical height of the visible range, that is, comparing in the horizontal and vertical directions respectively.
[0157] Specifically, the comparison operation can be based on simple numerical comparisons, such as determining whether the horizontal size of the model's bounding box is equal to the horizontal width of the viewport; or it can be based on proportional calculations, such as calculating the ratio of the horizontal size of the model's bounding box to the horizontal width of the viewport, and determining whether this ratio meets a preset threshold, such as whether it is close to 1:1. If the ratio is close, then the two are considered to match in the horizontal direction. The specific comparison process can be flexibly selected according to actual rendering needs and performance requirements.
[0158] Once the comparison results are obtained, the target viewpoint information can be further determined based on the result type. For example, if the comparison result shows that the horizontal dimension of the model bounding box is equal to the horizontal width of the visible area, and the vertical dimension is equal to the vertical height of the visible area, the initial viewpoint information can be directly reused as the target viewpoint information.
[0159] In the embodiments of this specification, by comparing the size and visible range of the bounding box of the 3D model in both the horizontal and vertical directions, and based on the comparison results and the initial viewpoint information of the 3D model, the target viewpoint information of the 3D model is determined. This enables adaptive rendering of the 3D model on terminal screens with different resolutions and aspect ratios, avoiding problems such as incomplete display content or poor visual effects caused by viewpoint mismatch. It ensures the display integrity and visual effect of the 3D model on different target terminal screens. At the same time, by adjusting the initial viewpoint information, redundant viewpoint ranges are discarded, redundant calculations are reduced, rendering efficiency is optimized, and the overall user experience is improved, enabling 3D interactive content to present high-quality visual effects on various terminal devices.
[0160] In one optional embodiment of this specification, the dimensions of the model bounding box include a horizontal width and a vertical height, the visible range includes a horizontal visible range and a vertical visible range, and the initial viewing angle information includes a horizontal viewing angle range and a vertical viewing angle range;
[0161] Based on the size and visible range of the bounding box of the 3D model, comparisons are made in both the horizontal and vertical directions. Based on the initial viewpoint information of the 3D model obtained from the comparison results, the target viewpoint information of the 3D model is determined, including:
[0162] When the horizontal width and horizontal visible range are equal, and the vertical height is less than the vertical visible range, the target viewing angle information is determined based on the vertical viewing angle range.
[0163] When the vertical height and vertical visible range are equal, and the horizontal width is smaller than the horizontal visible range, the target viewing angle information is determined based on the horizontal viewing angle range.
[0164] The horizontal width is the geometric measurement of the bounding box of a 3D model in the horizontal direction. It represents the extent of the model's extension in the X-axis direction and is calculated from the difference between the minimum and maximum X coordinates of the bounding box. It is a key parameter of the geometric characteristics of a 3D model and can be used to characterize the display range of the model in the horizontal direction.
[0165] Vertical height is the geometric measurement of the bounding box of a 3D model in the vertical direction. It represents the extension range of the model in the Y-axis direction and is calculated from the difference between the minimum and maximum Y coordinates of the bounding box. It is a key parameter of the geometric characteristics of a 3D model and can be used to characterize the display range of the model in the vertical direction.
[0166] The horizontal visible range is the width of the actual display area available in the horizontal direction of the target terminal screen. It can be measured in pixels and is determined by the physical size of the target terminal screen, the system status bar, application interface elements, and display frames. It represents the width range of content that the target terminal screen can display, and is usually smaller than the physical width of the target terminal screen.
[0167] The vertical visible range is the actual usable display area height of the target terminal screen in the vertical direction. It can be measured in pixels and is determined by the physical size of the target terminal screen, the system status bar, application interface elements, and display frames. It represents the height range of the screen that can be used to display content and is usually smaller than the physical height of the target terminal screen.
[0168] In actual rendering, the view range corresponding to the initial view information is usually less than or equal to the visible range. If the rendering is performed directly based on the visible range of the target terminal screen, there will be redundant view ranges that render content without models, resulting in a waste of computing resources. Therefore, it is necessary to determine the appropriate target view information based on the size of the model bounding box, the visible range, and the initial view information.
[0169] For example, continuing with the previous example, we will further illustrate this by combining it with actual calculation methods.
[0170] Let W be the visible area of the target terminal screen. win ×H win Among them, W win For the horizontal visible range, H win The vertical visible area; with the virtual camera's position as the origin O, the coordinates of the left boundary of the model's bounding box can be represented as x. min The right boundary coordinates can be represented as x max The upper boundary coordinates can be represented as y max The lower boundary coordinates can be represented as y min ; This refers to the left-side viewpoint. This refers to the right-side viewpoint. This refers to the upper side view range. FoV is the lower field of view. x For the horizontal field of view, FoV y This refers to the vertical viewing angle range.
[0171] The determination of target perspective information can be found in [reference needed]. Figures 3 to 4 ,in, Figure 3 This specification illustrates a schematic diagram of a target perspective information determination method according to an embodiment. Figure 4 This diagram illustrates another embodiment of the determination of target viewpoint information provided in this specification. Specifically:
[0172] like Figure 3 As shown: the horizontal width of the model bounding box (|x max |+|x min |) and horizontal view range W win The heights are equal, and the vertical height of the model's bounding box (|y max |+|y min |) smaller than the vertical visible range H win In this case, it indicates that the size of the model bounding box in the horizontal direction is related to the horizontal visible range W. win A match is found, without further limitations. Therefore, it can be based on the vertical field of view (FoV) in the initial field of view information. y Determine the target viewpoint information, including the vertical viewpoint range (FoV) in the initial viewpoint information. y It is based on two viewing angles in the vertical direction, namely the upper viewing angle. and lower view range The larger side of the field of view (i.e., the upper side of the field of view) Determined by symmetrical reversal along the horizontal direction. Figure 3 For ease of explanation, the distance is represented to determine the range of the corresponding side view.
[0173] like Figure 4 As shown: at the vertical height (|y max |+|y min |) and vertical visible range H win They are equal, and the horizontal width of the model bounding box (|x max |+|x min |) Less than the horizontal visible range W win In this case, it indicates that the size of the model bounding box in the vertical direction is related to the vertical visible range H. win A match is found, without further limitations. Therefore, it can be based on the horizontal field of view (FoV) in the initial field of view information. x Determine the target viewpoint information, including the horizontal viewpoint range (FoV) in the initial viewpoint information.x It is based on two viewing angles in the horizontal direction, namely the left viewing angle. and the right-side view range The larger side of the field of view (i.e., the right side of the field of view) Determined by symmetrical reversal along the vertical direction. Figure 4 For ease of explanation, the distance is represented to determine the range of the corresponding side view.
[0174] In the embodiments of this specification, by determining the target viewpoint information based on the vertical viewing angle range when the horizontal width and horizontal visible range are equal and the vertical height is less than the vertical visible range, and by determining the target viewpoint information based on the horizontal viewing angle range when the vertical height and vertical visible range are equal and the horizontal width is less than the horizontal visible range, adaptive rendering of the 3D model on terminal screens with different resolutions and aspect ratios is achieved. This ensures the display integrity and visual effect of the 3D model on different target terminal screens. At the same time, by determining the target viewpoint information based on the initial viewpoint information, redundant viewpoint ranges are discarded, redundant calculations are reduced, rendering efficiency is optimized, and the overall user experience is improved, enabling 3D interactive content to present high-quality visual effects on various terminal devices.
[0175] In one optional embodiment of this specification, obtaining a target projection image conforming to the rendering range from the location of the virtual camera towards the 3D model, based on target viewpoint information, includes:
[0176] Based on the target's perspective information, construct the view frustum from the virtual camera to the 3D model;
[0177] Based on the rendering range, the target projection image is obtained by truncating from the view frustum.
[0178] A view frustum, in the 3D rendering process, is a cone-shaped geometry constructed from the virtual camera's position based on the target's viewpoint information. It encompasses the entire visible area of the 3D model and is used to determine the spatial range within the target projection image that the 3D model needs to be projected onto. Specifically, as the core geometric structure of 3D rendering, the view frustum's shape and size are determined by the virtual camera's position, the target viewpoint information, and the clipping plane, forming the basis for determining the display range of the 3D model in the target projection image. In actual rendering, the view frustum can be represented as a square pyramid with its vertex located at the virtual camera's position, its axis pointing towards the 3D model, and its base being the front of the model's bounding box. The angle of the view frustum is determined by the horizontal and vertical viewpoint ranges in the target viewpoint information, while the height (depth) range of the view frustum is determined by the distance from the front of the model's bounding box to the virtual camera's position.
[0179] In the actual rendering process, once the target viewpoint information and the location of the virtual camera are determined, the view frustum can be further constructed from the virtual camera to the 3D model.
[0180] Specifically, the view frustum geometry can be constructed by determining the virtual camera position, the axis direction of the view frustum, the opening angle of the view frustum, and its height range. The virtual camera's position is taken as the vertex of the view frustum, and the direction the virtual camera points towards the 3D model is taken as the axis direction of the view frustum. Then, the opening angle of the view frustum is determined based on the horizontal and vertical view ranges from the target viewpoint information. Finally, the near and far clipping planes of the view frustum are determined to define its depth range, thus constructing a complete view frustum geometry. Alternatively, the view frustum opening angle can be determined by calculating the rays from the virtual camera's position to the keypoints of the 3D model and using the angles between these rays. For example, the opening angle can be determined by the angle between the lines connecting the virtual camera to the four vertices of the 3D model's bounding box (top left, bottom left, top right, and bottom right) and the view frustum axis. Furthermore, a pre-calculated and stored view frustum parameter table can be used to query the corresponding view frustum geometry parameters based on the target viewpoint information, thus quickly constructing the view frustum, avoiding the overhead of real-time calculations, and improving rendering efficiency.
[0181] Once the view frustum is constructed, the target projection image can be further extracted from the view frustum based on the rendering range.
[0182] Specifically, this can be achieved by determining the intersection of the view frustum and the rendering range, and then extracting the projected region from the view frustum that conforms to the rendering range. This can be done by first determining the effective region of the view frustum within the target rendering range, and then performing appropriate processing based on the matching relationship between the effective region and the rendering range. For example, if the effective region is smaller than the rendering range, the effective region can be upsampled and filled into the rendering range.
[0183] In the embodiments of this specification, by constructing a view frustum from a virtual camera to a 3D model based on the target viewpoint information, and extracting the target projection image from the view frustum based on the rendering range, the accurate matching of the view frustum and the rendering range is achieved during the 3D model rendering process. This avoids the problem of incomplete rendering content or redundant calculations caused by the view frustum being too large or too small, ensuring the display integrity of the 3D model on terminal screens with different resolutions and aspect ratios, and enabling the 3D model to present high-quality visual effects on various terminal devices.
[0184] In one optional embodiment of this specification, obtaining a target projection image by cropping from the view frustum based on the rendering range includes:
[0185] Determine whether the effective pixels in the view frustum can fill the rendering range, and based on the determination result, extract from the view frustum to obtain the target projection image. The effective pixels are pixels with color values greater than a preset threshold.
[0186] Effective pixels are pixels whose color values are greater than a preset threshold during the rendering of a 3D model. Effective pixels are recognized as valid display content of the 3D model, rather than background or transparent areas. They serve as a reference for determining the actual visible area of the 3D model in the target projection image, deciding which areas of the 3D model need to be rendered. Specifically, the distribution of effective pixels reflects the visual characteristics and spatial structure of the 3D model. For example, in rendering a 3D spatial photographic model, effective pixels can include pixels of the actual 3D model content, such as a person's face and clothing texture, while pixels in background areas can be ignored because their color values are below the preset threshold.
[0187] Color values are quantified numerical values representing the color information of each pixel during the rendering of a 3D model. They typically include the values of the RGB (red, green, blue) channels and the transparency value (ARGB), and can also include combinations thereof, used to describe the color attributes of a pixel. The magnitude of the color value reflects the brightness and visibility of the pixel, that is, the effective light intensity of the pixel in space. A larger color value indicates that the pixel is more prominent and easier to identify, and therefore needs to be rendered during the 3D model rendering process. For example, in rendering a 3D spatial photorealistic model, the color value can be the RGB value of each pixel plus its transparency value, such as (255,255,255,0.5) representing a white pixel with 50% transparency, and (0,0,0,1) representing a black pixel with 100% transparency.
[0188] A preset threshold is a critical color value used in the rendering process of a 3D model to determine whether a pixel is a valid pixel. It is a pre-set value used to distinguish between valid and invalid pixels, and is a key parameter that determines which pixels need to be processed during the rendering process. A reasonable preset threshold can balance rendering quality and computational efficiency, and can be adjusted based on the characteristics of the model and display requirements.
[0189] In the actual rendering process, determining whether the effective pixels in the view frustum can fill the rendering range can be achieved by comparing the width and height of the effective pixel region with the width and height of the rendering range. Specifically, the minimum and maximum coordinates of the effective pixel region can be calculated to determine its actual effective pixel region size. This size is then compared with the size of the rendering range. If both the width and height of the effective pixel region are greater than or equal to the corresponding dimensions of the rendering range, it indicates that the effective pixel region can completely fill the rendering range. If the width or height of the effective pixel region is less than the corresponding dimensions of the rendering range, it indicates that it is insufficient to completely fill the rendering range, and further upsampling processing is required. If both the width and height of the effective pixel region are greater than the corresponding dimensions of the rendering range, clipping processing is required. Specifically, this determination process can be quickly completed by traversing the pixels in the view frustum and counting the coordinate range of pixels with color values greater than a preset threshold.
[0190] In the embodiments of this specification, by determining whether the effective pixels in the view frustum can fill the rendering range, and by truncating the pixels based on the determination result, efficient utilization of effective pixels is achieved during the rendering of 3D models. This avoids redundant calculations caused by invalid pixels, improves rendering efficiency, and ensures the content integrity and visual quality of the rendered image. This enables 3D models to present high-quality display effects on terminal screens with different resolutions and aspect ratios. By reducing unnecessary calculations and data processing, rendering performance is optimized, the overall visual experience of users is improved, and technical support is provided for the high-quality display of 3D interactive content on various terminal devices.
[0191] In one optional embodiment of this specification, obtaining a target projection image by cropping from the view frustum based on the judgment result includes:
[0192] If the area of effective pixels cannot fill the rendering range, the area of effective pixels is upsampled, and the result of upsampling is cropped to obtain the target projection image.
[0193] If the area of effective pixels exceeds the rendering range, the area of effective pixels is cropped to obtain the target projection image;
[0194] If the area of effective pixels is equal to the rendering range, the area of effective pixels is defined as the target projected image.
[0195] Upsampling is a technique used in 3D model rendering where, when the size of the effective pixel region is smaller than the rendering area, the number of pixels is increased using interpolation algorithms to fill the rendering area. Its core principle is to preserve the visual characteristics and color information of the effective pixel region, expanding low-resolution image content into a high-resolution rendering area without introducing significant distortion or blurring. Specifically, upsampling methods can employ bilinear interpolation, bicubic interpolation, or deep learning-based super-resolution algorithms. Based on the color values and spatial distribution of the effective pixel region, they intelligently generate missing pixel content, ensuring that the rendered image maintains visual coherence and rich detail.
[0196] Cropping is a technique used in 3D model rendering where, when the size of the effective pixel area exceeds the rendering range, a portion of the effective pixel area that matches the rendering range is selected to fit the target display area. This preserves the target visual content within the effective pixel area and avoids rendering redundant information. Specifically, cropping can be implemented in various ways, including center cropping, tiling cropping, and custom cropping. Center cropping prioritizes preserving content in the center of the image, tiling cropping scales the effective pixel area to the rendering range based on actual proportions, and custom cropping allows for flexible cropping based on specific display requirements and content importance.
[0197] In the actual rendering process, once the view frustum is constructed, the view frustum can be truncated by determining whether the area of effective pixels in the view frustum can fill the rendering range.
[0198] Specifically, when the area of effective pixels cannot fill the rendering range, the target projection image can be obtained by upsampling the area of effective pixels and cropping based on the upsampled result; when the area of effective pixels exceeds the rendering range, the target projection image can be obtained by cropping the area of effective pixels; when the area of effective pixels is equal to the rendering range, the area of effective pixels can be directly determined as the target projection image.
[0199] For example, continuing with the previous example, we will further illustrate this by combining it with actual calculation methods.
[0200] The vertical distance from the virtual camera to the front of the model's bounding box can be represented as z. min The rendering range of the 3D model is W×H, the effective light intensity I represents the color value of the pixel, and the preset threshold is δ.
[0201] Then, based on the judgment, the truncation from the view frustum can be expressed as:
[0202] If the effective pixel area with effective light intensity I>δ cannot fill the rendering range W×H, then methods such as cubic interpolation can be used to upsample the effective pixel area, and then fill and crop it in the center after sampling.
[0203] If the effective pixel area with effective light intensity I>δ exceeds the filling rendering range W×H, then the effective pixel area can be directly cropped.
[0204] If the effective pixel area with effective light intensity I > δ is equal to the rendering range W × H, then the effective pixel area is directly determined as the target projection image.
[0205] Optionally, when the effective pixels are smaller than the rendering range, upsampling of the effective pixels may further include:
[0206] When the effective pixels are smaller than the rendering range, the effective pixels are upsampled based on the target upsampling method, which corresponds to the target downsampling method in the target terminal rendering process.
[0207] Among them, the target upsampling method is an upsampling technique that matches the downsampling method used in the target terminal rendering process. It is used to increase the number of pixels in the 3D model rendering process when the size of the effective pixel area is smaller than the rendering range, so as to ensure that the quality of the rendered image is consistent with the display characteristics of the target terminal.
[0208] Specifically, in the actual rendering process, the configuration parameters of each target terminal differ, so the downsampling methods used in the rendering process of each target terminal may also be different. Therefore, during the upsampling of the effective pixel area, the corresponding target upsampling method can be used, thereby achieving a correspondence with the downsampling of the target terminal and avoiding image distortion or quality loss caused by data processing mismatch in the rendering-display process.
[0209] The target downsampling method in the target terminal rendering process is a specific downsampling technique used by various target terminal devices to reduce the number of pixels during the rendering of 3D models. By downsampling the image during the rendering process, the rendering performance is optimized and adapted to the display characteristics and computing power of the terminal screen, while ensuring that the loss of image quality is minimized.
[0210] In the embodiments described in this specification, upsampling and cropping are performed when the area of effective pixels cannot fill the rendering range; cropping is performed when the area of effective pixels exceeds the rendering range; and the area of effective pixels is used directly when the area of effective pixels equals the rendering range. This achieves accurate matching between the effective pixel area and the rendering range during the rendering of 3D models, avoiding problems such as missing display content, blurred images, or redundant rendering caused by the mismatch between the area of effective pixels in the light cone and the visible range. This ensures high-quality display of 3D models on terminal screens with different resolutions and aspect ratios. At the same time, by using a case-by-case effective pixel processing strategy, the actual rendering efficiency is optimized, the consumption of computing resources is reduced, and the user's visual experience is improved, providing technical support for the high-quality display of 3D interactive content on various terminal devices.
[0211] Corresponding to the above method embodiments, this specification also provides embodiments of a three-dimensional model rendering apparatus, see [link to documentation]. Figure 5 , Figure 5 A schematic diagram of a three-dimensional model rendering apparatus according to one embodiment of this specification is shown. Figure 5 As shown, a 3D model rendering device is applied to a target terminal. The device includes:
[0212] The acquisition module 502 is configured to acquire the 3D model to be rendered, the visible range of the target terminal screen, and the rendering range used to render the 3D model.
[0213] The determination module 504 is configured to determine the target view information of the 3D model based on the scaling relationship between the initial view information and the visible range of the 3D model.
[0214] The projection module 506 is configured to obtain a target projection image that conforms to the rendering range from the position of the virtual camera to the direction of the three-dimensional model based on the target view information.
[0215] Rendering module 508 is configured to render the 3D model based on the target projection image.
[0216] The acquisition module is a functional unit in the 3D model rendering device responsible for acquiring the 3D model to be rendered, the visible range of the target terminal screen, and the rendering range used to render the 3D model. It can directly acquire the physical size and display attribute information of the screen through the operating system interface of the target terminal, or it can acquire the 3D model data to be rendered from local storage or cloud server, providing the necessary basic data support for the subsequent rendering process and ensuring that the 3D model rendering process can be dynamically adjusted based on the actual display characteristics of the target terminal screen.
[0217] The determination module is a functional unit in the 3D model rendering device responsible for determining the target viewpoint information of the 3D model based on the proportional adaptation relationship between the initial viewpoint information and the visible range of the 3D model. It can construct the model bounding box by traversing the point cloud data of the 3D model, calculate the initial viewpoint information based on the relative positional relationship between the model bounding box and the virtual camera, and then compare the size of the model bounding box with the aspect ratio of the visible range to determine the viewpoint range suitable for the target terminal screen, ensuring the display integrity of the 3D model on terminals with different resolutions and aspect ratios.
[0218] The projection module is a functional unit in the 3D model rendering device that is responsible for obtaining a target projection image that conforms to the rendering range from the position of the virtual camera to the 3D model based on the target view information. It can construct a view frustum from the virtual camera to the 3D model and extract it from the view frustum based on the rendering range to ensure that the content displayed on the target terminal screen of the 3D model is completely matched with the rendering range.
[0219] The rendering module is a functional unit in the 3D model rendering device that is responsible for rendering the 3D model based on the target projection image. It can overlay the target projection image onto the physical pixels corresponding to the physical size of the target terminal screen, then render the physical pixels into rendering pixels suitable for screen display through target downsampling, and crop according to the visible range, and finally display the 3D model on the target terminal screen.
[0220] Optionally, the acquisition module 502 is further configured to: acquire the physical size and rendering size of the target terminal screen; determine the rendering sampling ratio based on the physical size and rendering size; and sample the rendering size based on the rendering sampling ratio to obtain the rendering range for rendering the 3D model.
[0221] Optionally, the device also includes a construction module configured to: traverse the point cloud data of the 3D model, construct the model bounding box of the 3D model, and determine the initial viewpoint information for the 3D model based on the relative positional relationship between the model bounding box and the virtual camera.
[0222] Optionally, the determining module 504 is further configured to: determine the horizontal and vertical viewing angle ranges based on the vertical distance from the virtual camera to the front of the model bounding box and the distance from the virtual camera to the four sides of the front of the model bounding box; and determine the initial viewing angle information based on the horizontal and vertical viewing angle ranges.
[0223] Optionally, the determining module 504 is further configured to: determine two viewing angle ranges in the horizontal direction and two viewing angle ranges in the vertical direction of the model bounding box relative to the virtual camera, based on the vertical distance from the virtual camera to the front of the model bounding box and the distance from the virtual camera to the four sides of the front of the model bounding box; determine the horizontal viewing angle range by symmetrically flipping the two viewing angle ranges in the horizontal direction along the vertical direction, and determine the vertical viewing angle range by symmetrically flipping the two viewing angle ranges in the vertical direction along the horizontal direction.
[0224] Optionally, the determining module 504 is further configured to: compare the size and visible range of the model bounding box for the 3D model in the horizontal and vertical directions respectively, and determine the target view information of the 3D model based on the comparison results and the initial view information of the 3D model.
[0225] Optionally, the dimensions of the model bounding box include a horizontal width and a vertical height, the visible range includes a horizontal visible range and a vertical visible range, and the initial viewpoint information includes a horizontal viewpoint range and a vertical viewpoint range; the determination module 404 is further configured to: determine the target viewpoint information based on the vertical viewpoint range when the horizontal width and the horizontal visible range are equal and the vertical height is less than the vertical visible range; and determine the target viewpoint information based on the horizontal viewpoint range when the vertical height and the vertical visible range are equal and the horizontal width is less than the horizontal visible range.
[0226] Optionally, the projection module 506 is further configured to: construct a view frustum from the virtual camera to the 3D model based on the target view information; and extract a target projection image from the view frustum based on the rendering range.
[0227] Optionally, the projection module 506 is further configured to: determine whether the effective pixels in the view frustum can fill the rendering range, and extract from the view frustum based on the determination result to obtain the target projection image, wherein the effective pixels are pixels with color values greater than a preset threshold.
[0228] Optionally, the projection module 506 is further configured to: upsample the region of effective pixels when the region of effective pixels cannot fill the rendering range, and crop based on the upsampled result to obtain the target projection image; crop the region of effective pixels when the region of effective pixels exceeds the rendering range to obtain the target projection image; and determine the region of effective pixels as the target projection image when the region of effective pixels is equal to the rendering range.
[0229] The 3D model rendering apparatus provided in this specification, through the collaborative work of its acquisition module, determination module, projection module, and rendering module, achieves adaptive rendering of 3D models on terminal screens with different resolutions and aspect ratios. This avoids the problems of incomplete display content or poor visual effects caused by a fixed rendering perspective, ensuring the display integrity and visual effect of the 3D model on different target terminal screens. At the same time, by dynamically determining the target perspective information, matching the rendering range, and optimizing the rendering process, redundant calculations in the rendering process are reduced, and rendering efficiency is improved. This provides technical support for the high-quality display of interactive 3D content on various terminal devices, enabling new 3D content such as 3D spatial photos to be widely used in multi-platform scenarios such as social media and e-commerce, thereby enhancing the overall visual experience of users.
[0230] The above is a schematic scheme of a three-dimensional model rendering device according to this embodiment. It should be noted that the technical solution of this three-dimensional model rendering device and the technical solution of the above-described three-dimensional model rendering method belong to the same concept. For details not described in detail in the technical solution of the three-dimensional model rendering device, please refer to the description of the technical solution of the above-described three-dimensional model rendering method.
[0231] Figure 6 A structural block diagram of a computing device 600 according to one embodiment of this specification is shown. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and a database 650 is used to store data.
[0232] The computing device 600 also includes an access device 640, which enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 640 may include one or more of any type of wired or wireless network interface (e.g., a network interface controller (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.
[0233] In one embodiment of this specification, the above-described components of the computing device 600 and Figure 6 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 6 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0234] The computing device 600 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 600 can also be a mobile or stationary server.
[0235] The processor 620 is used to execute the following computer program / instructions, which, when executed by the processor, implement the steps of the above-described 3D model rendering method.
[0236] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the above-described 3D model rendering method belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the above-described 3D model rendering method.
[0237] An embodiment of this specification also provides a computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the above-described three-dimensional model rendering method.
[0238] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the above-described 3D model rendering method belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the above-described 3D model rendering method.
[0239] An embodiment of this specification also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described three-dimensional model rendering method.
[0240] The above is an illustrative scheme of a computer program according to this embodiment. It should be noted that the technical solution of this computer program and the technical solution of the above-described 3D model rendering method belong to the same concept. For details not described in detail in the technical solution of the computer program, please refer to the description of the technical solution of the above-described 3D model rendering method.
[0241] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0242] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0243] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.
[0244] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0245] The preferred embodiments disclosed above are merely illustrative of this specification. Optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. A method for rendering a three-dimensional model, characterized in that, Applied to a target terminal, the method includes: Obtain the 3D model to be rendered, the visible area of the target terminal screen, and the rendering area used to render the 3D model; Based on the proportional adaptation relationship between the initial viewpoint information of the 3D model and the visible range, the target viewpoint information of the 3D model is determined; Based on the target viewpoint information, a target projection image conforming to the rendering range is obtained from the virtual camera's location toward the 3D model. The three-dimensional model is rendered based on the target projection image.
2. The method according to claim 1, characterized in that, The step of obtaining the rendering range for rendering the 3D model includes: Obtain the physical size and rendered size of the target terminal screen; Based on the physical dimensions and the rendering dimensions, determine the rendering sampling ratio; Based on the rendering sampling ratio, the rendering size is sampled to obtain the rendering range used to render the 3D model.
3. The method according to claim 1, characterized in that, Before determining the target viewpoint information of the 3D model based on the proportional adaptation relationship between the initial viewpoint information of the 3D model and the visible range, the method further includes: Traverse the point cloud data of the 3D model to construct the model bounding box of the 3D model; Based on the relative positional relationship between the model bounding box and the virtual camera, the initial viewpoint information for the 3D model is determined.
4. The method according to claim 3, characterized in that, Determining the initial viewpoint information for the 3D model based on the relative positional relationship between the model bounding box and the virtual camera includes: The horizontal and vertical viewing angle ranges are determined based on the vertical distance from the virtual camera to the front of the model bounding box and the distance from the virtual camera to the four sides of the front of the model bounding box. Based on the horizontal and vertical viewing angle ranges, the initial viewing angle information is determined.
5. The method according to claim 4, characterized in that, The determination of the horizontal and vertical viewing angle ranges based on the vertical distance from the virtual camera to the front of the model bounding box, and the distances from the virtual camera to the four sides of the front of the model bounding box, includes: Based on the vertical distance from the virtual camera to the front of the model bounding box, and the distance from the virtual camera to the four sides of the front of the model bounding box, determine two viewing angle ranges in the horizontal direction and two viewing angle ranges in the vertical direction relative to the virtual camera. The horizontal viewing angle range is determined by symmetrically flipping the two viewing angle ranges in the horizontal direction along the vertical direction, and the vertical viewing angle range is determined by symmetrically flipping the two viewing angle ranges in the vertical direction along the horizontal direction.
6. The method according to claim 3, characterized in that, The determination of the target viewpoint information of the 3D model based on the proportional adaptation relationship between the initial viewpoint information of the 3D model and the visible range includes: Based on the size of the model bounding box of the 3D model and the visible range, comparisons are made in the horizontal and vertical directions respectively, and the target view information of the 3D model is determined based on the comparison results and the initial view information of the 3D model.
7. The method according to claim 6, characterized in that, The dimensions of the model bounding box include a horizontal width and a vertical height; the visible range includes a horizontal visible range and a vertical visible range; and the initial viewing angle information includes a horizontal viewing angle range and a vertical viewing angle range. The process involves comparing the size of the model bounding box of the 3D model and the visible range in both the horizontal and vertical directions, and determining the target view information of the 3D model based on the initial view information of the 3D model based on the comparison results, including: When the horizontal width and the horizontal visible range are equal, and the vertical height is less than the vertical visible range, the target viewing angle information is determined based on the vertical viewing angle range; When the vertical height and the vertical visible range are equal, and the horizontal width is less than the horizontal visible range, the target viewing angle information is determined based on the horizontal viewing angle range.
8. The method according to any one of claims 1-7, characterized in that, The step of obtaining a target projection image conforming to the rendering range from the virtual camera's location to the 3D model based on the target viewpoint information includes: Based on the target perspective information, a view frustum is constructed from the virtual camera to the 3D model; Based on the rendering range, a target projection image is obtained by cropping from the view frustum.
9. The method according to claim 8, characterized in that, The step of extracting a target projection image from the view frustum based on the rendering range includes: Determine whether the effective pixels in the view frustum can fill the rendering range, and based on the determination result, extract from the view frustum to obtain the target projection image, wherein the effective pixels are pixels with color values greater than a preset threshold.
10. The method according to claim 9, characterized in that, The step of extracting the target projection image from the view frustum based on the judgment result includes: If the area of the effective pixels cannot fill the rendering range, the area of the effective pixels is upsampled, and cropped based on the upsampled result to obtain the target projection image; If the area of the effective pixels exceeds the rendering range, the area of the effective pixels is cropped to obtain the target projection image; If the area of the effective pixels is equal to the rendering range, the area of the effective pixels is determined as the target projected image.
11. A three-dimensional model rendering device, characterized in that, Applied to target terminals, including: The acquisition module is configured to acquire the 3D model to be rendered, the visible range of the target terminal screen, and the rendering range for rendering the 3D model. The determination module is configured to determine the target view information of the 3D model based on the proportional adaptation relationship between the initial view information of the 3D model and the visible range; The projection module is configured to obtain a target projection image conforming to the rendering range from the location of the virtual camera toward the three-dimensional model based on the target viewpoint information. The rendering module is configured to render the 3D model based on the target projection image.
12. 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, which, when executed by the processor, implement the steps of the three-dimensional model rendering method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, It stores a computer program / instruction that, when executed by a processor, implements the steps of the three-dimensional model rendering method according to any one of claims 1 to 10.
14. A computer program product, characterized in that, It includes a computer program / instructions that, when executed by a processor, implement the steps of the three-dimensional model rendering method according to any one of claims 1 to 10.