5.0

5.0 | 1 rating Rate this file 12 downloads (last 30 days) File Size: 2.8 KB File ID: #23882

surfo

by Andres

 

24 Apr 2009 (Updated 09 Jul 2009)

Code covered by the BSD License  

workaround for surface lighting with OpenGL

Download Now | Watch this File

File Information
Description

There's a bug in the OpenGL renderer that produces faulty face lighting in surface plots, see picture above and http://www.mathworks.com/matlabcentral/newsreader/view_thread/249184 .
This submission contains a function that computes face normal data for the 'VertexNormals' property of the surface that fixes the lighting (facenorm.m) as well as a workaround function that you can just use in place of surf (surfo.m).
 
Only use this if you get erroneous surface plots and you can't go without OpenGL and flat lighting.

MATLAB release MATLAB 7.7 (R2008b)
Zip File Content  
Other Files facenorm.m,
license.txt,
surfo.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
08 Jul 2009 Jan Simon

Efficient, clear source code, help and example included.
The problem existed even in Matlab 6.5. Thanks!

Please login to add a comment or rating.
Updates
27 Apr 2009

perform meshgrid within facenorm.m, if necessary

09 Jul 2009

v1.01 · code with improved speed as kindly suggested by Jan Simon · minor text changes

Tag Activity for this File
Tag Applied By Date/Time
plot Andres 24 Apr 2009 10:01:17
surf Andres 24 Apr 2009 10:01:17
surface Andres 24 Apr 2009 10:01:17
surface normals Andres 24 Apr 2009 10:01:17
opengl Andres 24 Apr 2009 10:01:17
light Andres 24 Apr 2009 10:01:17
lighting Andres 24 Apr 2009 10:01:17
workaround Andres 24 Apr 2009 10:01:17
image processing Andres 24 Apr 2009 10:01:17

Contact us at files@mathworks.com