Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

matlab slow in 3d visualization

447 views
Skip to first unread message

Gianni Schena

unread,
Jan 7, 2008, 9:31:01 AM1/7/08
to

why is matlab so slow in 3d visualization (isosurface,
isonormals, volume rotation in 3d etc) ?

it is Slow even with one of the best graphic cards
(512 Mb gddr3 etc etc & lates drivers )

any idea ?

thank you to all in advance

Tobias

unread,
Jan 8, 2008, 3:26:23 AM1/8/08
to
Which renderer do you use?
Try set(handle_to_figure, 'renderer', 'opengl').

Tobias

Gianni Schena

unread,
Jan 10, 2008, 5:54:02 AM1/10/08
to

tobias

set(GCF, 'Renderer','OpenGL');
is already there but rotate is extremly
slow
giaani

Tobias <tc-ng...@gmx.de> wrote in message
<5ugqcdF...@mid.dfncis.de>...

Sridhar Mahadevan

unread,
Jan 10, 2008, 10:39:03 AM1/10/08
to
"Gianni Schena" <sch...@univ.trieste.it> wrote in message
<fltd35$8p6$1...@fred.mathworks.com>...


Which graphics card are you using? I have the same
experience, and posted a note to this newsgroup a few days
ago.

I am using an NVidia 8600GT card with 512MB of DDR3 VRAM,
and the card performs poorly on MATLAB's graphics benchmark
(which does a 3D rotation of the MATLAB symbol).

The card turns in stellar performance on Vista graphics
benchmarks. I don't understand why it is slow in MATLAB
(and a much slower ATI 2400 HD card turns out to be faster
in MATLAB, but slower on Vista graphics benchmarks!).

- Sridhar

Dan

unread,
May 14, 2008, 8:43:03 PM5/14/08
to
My experience is the same with nvidia-based Quadro cards and
an 8800 GT at home for some reason.

My laptop running an ATI mobile GPU is much fast than both
in the bench 3D performance. I cannot understand why and
would like a fix too! :)

"Sridhar Mahadevan" <maha...@cs.umass.edu> wrote in message
<fm5e6n$9qj$1...@fred.mathworks.com>...

Tristram Scott

unread,
May 15, 2008, 5:35:07 AM5/15/08
to
Gianni Schena <sch...@univ.trieste.it> wrote:
>
>
> tobias
>
> set(GCF, 'Renderer','OpenGL');
> is already there but rotate is extremly
> slow
> giaani
>
>
>
Which version of MATLAB do you use?

If you have access to some older versions, try 6.5. I find it better for
3d graphics performance (although there are a few bugs which have been
resolved in later versions).

You could also try running with Java disabled. There seems to be some
overhead in the java based figures.

--
Dr Tristram J. Scott
Energy Consultant

Pasco Alquim

unread,
May 15, 2008, 9:03:02 AM5/15/08
to
tristra...@ntlworld.com (Tristram Scott) wrote in message
<ftTWj.28967$66.1...@newsfe20.ams2>...

> Gianni Schena <sch...@univ.trieste.it> wrote:
> >
> >
> > tobias
> >
> > set(GCF, 'Renderer','OpenGL');
> > is already there but rotate is extremly
> > slow
> > giaani
> >
> >
> >
> Which version of MATLAB do you use?
>
> If you have access to some older versions, try 6.5. I find
it better for
> 3d graphics performance (although there are a few bugs which
have been
> resolved in later versions).

Hi,
It happens the same thing here. R13(6.5) is indeed faster but
its is still 2 to 3 times slower than my 3 years old ATI card


rych

unread,
May 16, 2008, 6:14:26 AM5/16/08
to
On May 15, 10:35 am, tristram.sc...@ntlworld.com (Tristram Scott)
wrote:

>
> You could also try running with Java disabled. There seems to be some
> overhead in the java based figures.
>
Yes, please, how can we disable Java? And how to find out which
functions are java-based. Thanks.
Igor

Tristram Scott

unread,
May 16, 2008, 12:52:42 PM5/16/08
to

You can pass options to MATLAB on the command line wjhen you start it up.
My favourite is -nojvm. If I need java (e.g. for database toolbox or for
report generator) then I instead use -nodesktop.

matlab -nojvm

I'm not sure of an easy way to list all the java based functions. For the
m files you can look through them with grep, but that won't help with p
files. It also would not find the functions which call these functions.

Perhaps the best way is to turn java off, and then try your code and see if
it fails.

Dan

unread,
May 22, 2008, 8:56:02 PM5/22/08
to
OK, I figured out a solution for all of our NVIDIA-based PCs.

A couple of things first though:

- This has nothing to do with running java or not
- This has nothing to do with the renderer really
- This is not an issue of ATI vs. NVIDIA as I earlier speculated

The real problem is that the Quadro and GeForce drivers
(v169.xx) install with Vertical sync ON as the default. This
basically throttles back the GPU so that it only rendered
frames in sync with the refresh rate of your display;
generally removing tearing which occurs when your display
shows midframe between GPU renders.

The Matlab bench algorithm simply turns on shading then
alters the logo math and flushes the buffer with "drawnow"
command. If vsync is on, the CPU is running through the loop
but waiting each time for the gpu to render in sync with
your display when it flushes. In my case this was limiting
to about 60 fps (my LCD is @ 60Hz).

Here is the code:
set(task,'string','3-D')
drawnow
pause(1)
evalc('logo');
set(logoFig,'color',[.8 .8 .8])
s = findobj(logoFig, 'type','surf', 'tag',
'TheMathWorksLogo');
set(s,'facelighting','gouraud')
L1 = 40*membrane(1,25);
L2 = 10*membrane(2,25);
L3 = 10*membrane(3,25);
mu = sqrt([9.6397238445, 15.19725192, 2*pi^2]);
n = 40;
tic
for j = 0:n
t = 0.5*(1-j/n);
L = cos(mu(1)*t)*L1 + sin(mu(2)*t)*L2 + sin(mu(3)*t)*L3;
set(s,'zdata',L)
drawnow
end
times(k,6) = toc;
pause(1)
close(logoFig)


Turn off vsync in the nvidia control panel by setting
advanced 3d settings option there to FORCE OFF.

I notice no tearing in anything I do but drastically
increased 3D bench scores which absolutely kill the ATI
cards I have.

I hope this helps!

"Gianni Schena" <sch...@univ.trieste.it> wrote in message
<fltd35$8p6$1...@fred.mathworks.com>...
>

Aleks

unread,
Jun 17, 2008, 9:45:03 AM6/17/08
to
The "bench" got about twice as fast with vsync disabled,
thnx

"Dan " <daniel....@ngc.com> wrote in message <g154n2
$8mg$1...@fred.mathworks.com>...

Naor Movshovitz

unread,
Aug 8, 2009, 6:35:05 PM8/8/09
to
Dan,
This helped a lot, but my new Geforce GTX285 still scores way lower on the MATLAB bench than my old ATI FiregelV3600. Not only on bench.m but with anything involving graphics in MATLAB. Including the howfast.m from the filexchange. This card is supposed to be 5-7 faster than my old one, and it sure is - outside of MATLAB! Does anyone have more ideas of what can be going wrong here?
Thanks,
-naor


"Dan " <daniel....@ngc.com> wrote in message <g154n2$8mg$1...@fred.mathworks.com>...

Carlos

unread,
Aug 30, 2011, 12:13:26 PM8/30/11
to
MATLAB's internal implementation of 3D rendering is most likely very outdated. I suppose Mathworks is assuming that most people don't worry about the performance of rendering a 3D object. I guess we need to complain more.

I recently came across a java-based way of doing something similar to a "surf":
see File Exchange id:32344 "Hardware accelerated 3D viewer for MATLAB" and follow the instructions there.
Once installed, you can render a "surf(peaks(200))" by copy-pasting the following:

% start of snippet
Z= peaks(200);
Imin = min(Z(:));
Imax = max(Z(:));
I = uint8( 200 * (Z-Imin) / (Imax-Imin) );

Miji(false);
imp = MIJ.createImage('Fast surf(peaks(200))', I, false);
universe = ij3d.Image3DUniverse();
universe.show();

color = javax.vecmath.Color3f(240 / 255, 120 / 255, 20 / 255);
c = universe.addSurfacePlot(imp, ...
javax.vecmath.Color3f(), ...
'Matlab Peak in 3D', ...
1, ...
[true true true], ...
1);

c.showCoordinateSystem(true);
c.showBoundingBox(true);

universe.resetView();
c.setColor(color);
c.setTransform([1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1]);
universe.fireContentChanged(c);
universe.centerSelected(c);
universe.rotateUniverse(javax.vecmath.Vector3d(-1, -0.5, +0.2), +120 * pi / 180);

% end of snippet
You may need to increase Java's heap memory in MatLab's preferences.

If you try to "manually" rotate the rendered image using your mouse, it will much, much faster than doing the equivalent "surf(peaks(200))".
So, one thing is almost sure: MATLAB's 3D rendering is not based on Java's 3D API.

timo

unread,
Feb 28, 2015, 2:18:36 PM2/28/15
to
"G. Sken" wrote in message <fltd35$8p6$1...@fred.mathworks.com>...
This issues still not solved in 2015 ...LOL

Rob Campbell

unread,
Aug 26, 2015, 8:39:13 AM8/26/15
to

> This issues still not solved in 2015 ...LOL

Yes. Still rubbish. The long-awaited new graphics amount to little more than anti-aliasing, different default colours, and the new graphics objects. Too little too late. It's 2015, we want this: https://www.youtube.com/watch?v=_3YoaeoiIFI&feature=youtu.be&t=682 not this: https://www.youtube.com/watch?v=_3YoaeoiIFI&feature=youtu.be&t=682
0 new messages