How do I Improve Graphics Performance in Matlab?

조회 수: 12 (최근 30일)
chris
chris 2012년 4월 25일
댓글: Jan 2015년 11월 29일
I made a 3D chess set in CATIA, converted it to VRML format (.wrl), and will use it with an AI, GUI, etc. as part of a chess program. When converting to wrl, I cut down on the file size as much as CATIA would let me, so all circular objects are octagonal. The total file size of the board and the pieces is around 2MB. I incorporated a click and drag feature on the pieces, but for whatever reason, Matlab struggles mightily to render the chess set while moving the pieces. Movement is extremely choppy and rotating the set takes forever, even with navigation style set to "fast." However, when I used a web viewer for VRML objects, rendering the chess set was child's play for the web viewer. Movement was smooth, frame rates were high, etc. But not so when viewing it in Matlab. CPU usage (using Task Manager) was at around 30-50% when I moved a piece around. That's unacceptably high. The computer specs are: Dell Precision series, nVidia graphics, xeon processor, 4GB ram.
Anyway, why is this? I looked around on Mathworks for a possible cause, but no luck. I would appreciate any help, as this project is due in a few days. I tried everything, but to no effect.

답변 (4개)

Jan
Jan 2012년 4월 26일
Which Matlab version are you using? Which renderer is active? And if it is OpenGL, do you use the hardware or software rendering? How do you move and rotate the objects?
I do not have problems to display 21 spheres of 10*10 facettes and 25 cyclinders, a checkerboard floor and some 2D stuff with the hardware OpenGL renderer. This GIF is recorded with about half real-time on a PentiumM 1.5GHz, 512MB, a 16MB graphics card (a T40 IBM laptop), Matlab 2009a:
I can add further objects without reducing the fluently appearence. surface objects are drawn faster than patch objects. Therefore I assume your slow displaying is a problem of the VRML viewer in Matlab. Can you convert the objects to surface objects?
  댓글 수: 5
chris
chris 2012년 4월 26일
I'm pretty sure the computer is not taking advantage of hardware acceleration or whatever, because the web view does (directx or opengl), and it is loads faster. I just need to know how to set it so Matlab tells itself to use hardware acceleration instead of simply relying on just the CPU.
chris
chris 2012년 4월 26일
And what code should I post? I don't run any code to open the file. I could post the vrml code, but that's 20,000 lines.

댓글을 달려면 로그인하십시오.


chris
chris 2012년 4월 26일
Does anybody else have an idea of how to fix this? Its quite urgent.
  댓글 수: 6
chris
chris 2012년 4월 28일
I read the links. However, because this project is due in 2 days, it's a very urgent issue. And I can't afford to hire someone, because I'm a college student with hardly any money.
All I'm trying to do with the vrml file is to open it up and expect the viewer to perform like a normal vrml viewer. but what I see is a slow, jerky vrml renderer. An example to witness this effect would simply be opening a file bigger than 2MB in Matlab and trying to rotate it. Then open the same file in a normal vrml viewer and seeing that it rotates the model like it's nothing. I'm certain it is a software render vs. hardware render issue. That is all. I didn't think it was a complicated issue.
Jan
Jan 2012년 4월 28일
Chris, please read the links again. And if they are still not clear, read them again. Walter is a very experienced programmer. This does not only mean, that he can use the correct syntax, but this requires a deeper knowledge of the physical background and efficient application of project management tools. Participants of this forum can profit from Walter's knowledge for free! If he tells you, that your problem is not urgent, it is worth to think as long about this opinion until you get his point.

댓글을 달려면 로그인하십시오.


Jan
Jan 2012년 4월 28일
Although you repeatedly claim, that your project is urgent, you needed 3 days to tell us, that you use the "Simulink 3D animation internal viewer" to display the VRML file. Instead of this important detail, you explained details about your work with CATIA - a software or language I do not know and as far as I understand it is not relevant for the problem.
You said that 30-50% cpu load during moving a piece around is unacceptable high. Why? I would accept 100% or is a partially sleeping cpu important for your project? If so, why?
But let me summarize the already mentioned facts:
  1. You are using the Simulink 3D animation internal viewer to display a not really large VRML scene.
  2. You are not satisfied with the performance.
  3. Neither you nor another user of this forum knows a magic switch, which makes the viewer 3 or 4 or what ever times faster - btw, you did not specify which amount of acceleration is wanted.
Then this conclusion is obvious: The Simulink 3D animation internal viewer is not sufficient for your project. This is not a fault of Matlab, you simply had wrong expectations and did not test this early enough.
I see two solutions:
  • Either use another tool for displaying. I have explained, that Matlab can display surface objects with a sufficient speed for user interactions in 3D. I do not think that this can be programmed in 2 days.
  • Face the facts and finish the project with an unfinished visualization. This would not be the first project, which is not ready in time. All professional programmers have experiences with a failing project management.
I hope and think, that you have learned a lot from this project. Therefore I'm still convinced, that your problem is not "urgent". Wearing burning socks is an urgent problem. I have the impression, that you simply did not start to solve the problem early enough. Then repeating the project next term or year with more experiences is a valuable solution.
And for questions in this forum, other forums or scientific discussion, I repeat the suggestion to read and consider http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer . A good question is succinct and requires no guessing for the answering.
Good luck!

timo
timo 2015년 11월 25일
편집: timo 2015년 11월 25일
Now in November 2015... I have exactly the same issue with Matlab 2015b Windows 10, GTX 770... Ps: before telling me i use a complicated model, i just ran "vrmemb" command
Matworks please fix the internal 3d rendered in Matlab. Its unusable
  댓글 수: 1
Jan
Jan 2015년 11월 29일
Please provide any details of your problem. The OP did not specifiy the problem exactly enough.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by