Path: news.mathworks.com!not-for-mail
From: "Dan " <daniel.salluce@ngc.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: matlab slow in 3d visualization
Date: Fri, 23 May 2008 00:56:02 +0000 (UTC)
Organization: Northrop Grumman Corp
Lines: 70
Message-ID: <g154n2$8mg$1@fred.mathworks.com>
References: <fltd35$8p6$1@fred.mathworks.com>
Reply-To: "Dan " <daniel.salluce@ngc.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1211504162 8912 172.30.248.35 (23 May 2008 00:56:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 23 May 2008 00:56:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 456316
Xref: news.mathworks.com comp.soft-sys.matlab:469970


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" <schena@univ.trieste.it> wrote in message
<fltd35$8p6$1@fred.mathworks.com>...
> 
> 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