How does WPF improve 3D rendering performance and optimization?
Source: Internet
Author: User
Using WPF in applications to generate 3D scenarios can provide users with good visual display results. On the contrary, the requirements for computer system resources and hardware devices are also very demanding. Next, I will focus on the performance optimization considerations for processing 3D graphics in WPF.
I. Graphic hardware acceleration In WPF, graphics rendering is performed through the GPU of the graphics card. Generally, the WPF system defines three rendering layers: The rendering layer 0 and no graphic hardware acceleration. The DirectX version is lower than 7.0, and the rendering layer 1 is accelerated by some graphics hardware. The DirectX version level is higher than or equal to 7.0 and lower than 9.0. The video RAM must be greater than or equal to 30 mb. The number of multi-Texture unit units must be greater than or equal to 2 (graphics card AGP rate 2x );
Rendering Layer 2 most graphics Functions use graphical hardware acceleration. The DirectX version level is higher than or equal to 9.0. The video RAM must be greater than or equal to 120 MB. The number of multi-Texture unit units must be greater than or equal to 4 (8x, 16x ).
Ii. Use of 3D Model Materials Generally, the use of 3D model materials usually uses a brush, but the rendering speed of different brush materials is also different. solidcolorbrush (directly add a solid color to the Model) lineargradientbrush is much faster than imagebrush and visualbrush. cached brushes are faster than non-cached brushes.
Iii. Model Creation In 3D scenarios, we try to create less than 60.000 geometrymodel3d triangles, less than 20.000 vertices, and try to reuse models with little shape changes unless a new shape needs to be created, try to create a submodel in a viewport3d instead of creating multiple viewport3d.
4. anti-aliasing in 3D 3D anti-aliasing in WPF is only applicable to the Vista system. If you want to implement anti-aliasing in the XP system, you can set the maximum multi-level sampling value HKEY_CURRENT_USER/software/Microsoft/aveon in the registry. the graphics/maxmultisampletype value type is DWORD. Generally, it is set to 4, which can be adjusted based on the performance of the video card. (However, it is recommended that you do not use this method. You can use the modified registry to implement anti-aliasing, but it may also cause new rendering problems, such: the 3D model is considerate and overlaps with other objects to generate a dotted line on the graphic edge. However, the dotted line problem can be solved by setting the pixel center instead of the graphics card, but it will also lead to other unpredictable unstable factors)
Therefore, you can flexibly choose the optimal setting method based on your actual presentation requirements for 3D rendering. The goal is to ensure stable, excellent performance, and good 3D rendering effect.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.