Answer the question
In order to leave comments, you need to log in
How to draw a large number of points using WPF 3D?
I am interested in 3 questions.
1) How to draw the largest number of objects with the least memory cost and the highest FPS?
2) How to optimize the graphic scene so that wpf would not "think" about those objects that are not visible (overlapped by other objects)?
3) Where does the RAM go?
My thoughts on each of the points
1) In principle, I achieved a good result. I render in real time without a strong fps drop when I move the camera with the mouse 10,000 cubes. Cube - 8 points -12 triangles. Each cube is a new GeometryModel3D that is placed in a Model3DGroup. Is this the most efficient way to draw?
2) There is an object in front of the camera that covers the remaining 10,000 * 12 triangles. In theory, I see only this one object, but the camera moves with noticeable slowdowns. How to avoid it? After all, if the objects are outside the camera's viewing angle, nothing slows down.
3) I have 10,000 cubes in Viewport3d. Cube = 8 points + 12 int (triangle indices) = 8*3(coordinates)*8(double byte)+12*4 = 240 bytes. They all share the same color. Those. reference to a single Brush object 4 bytes. It turns out that to describe one cube 244 bytes are required. 244b * 10,000 = 2.3 mb. But in the task manager, the program devours as much as 110,000 MB. Why is that?
Answer the question
In order to leave comments, you need to log in
1) you are so easy to count the memory allocated for your cubes). I think this is very far from the truth, because. personally, I can’t even imagine what exactly happens when creating a dotnet object and how much memory it will require;
2) you are using the tool for other purposes. WPF is for a relatively small number of graphs. objects (tens, hundreds) with a high level of interactivity for each of them. In other words - for interfaces. There are a small number of highly interactive objects in the interfaces - buttons, scrolls, comboboxes, and it is for such scenarios that WPF is optimized. It's time for you with 10K cubes to take Direct3D and not suffer. I’m not telling you this from the ceiling, we also once tried to use WPF 2D graphics for 2D rendering, but quickly realized that its infrastructure was too heavy for our task. You are tormented in attempts to optimize it all.
Well, WPF render is clearly not able to filter out invisible objects. If you want, make a native window and do the rendering and elimination of invisible objects yourself. Yes, and as I understand it, in your case, a separate draw call is used for each cube, so this is not a single video card that will last at a decent speed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question