bugGNU Octave - Bugs: bug #53958, 'light' function not working for...

 
 

bug #53958: 'light' function not working for patch objects

Submitted by:  Richard <crobar>
Submitted on:  Mon 21 May 2018 03:32:30 PM UTC  
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Ready For Test Assigned to:  None
Originator Name:  Richard Crozier Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Wed 13 Jun 2018 07:32:30 AM UTC, comment #6:

The "VertexNormals" are calculated only if "VertexNormalsMode" is "auto", "FaceLighting" or "EdgeLighting" are set to "gouraud" and a light object is present in the same axes.
For the "FaceNormals" to be calculated, "FaceLighting" or "EdgeLighting" has to be set to "flat" (which is the case with the default values) together with the other two conditions.
That is what Matlab seemed to do when I looked at it.

Maybe this should be documented somewhere. But I don't know where this would fit. In the docstrings for patch and surface maybe?

With the default values there are currently no visible lighting effects because of bug #54024.

Markus Mützel <mmuetzel>
Project Member
Tue 12 Jun 2018 06:55:34 PM UTC, comment #5:

I just tried tst_light.m and the "FaceNormals" property is now calculated, but the "VertexNormals" property is still an empty matrix. Is that expected?

Rik <rik5>
Project Administrator
Mon 04 Jun 2018 08:15:34 PM UTC, comment #4:

This should be fixed with this changeset:
http://hg.savannah.gnu.org/hgweb/octave/rev/107920dd7715

The issue that facenormals are not taken into account for lighting is tracked in bug #54024.

Markus Mützel <mmuetzel>
Project Member
Tue 29 May 2018 11:18:35 AM UTC, comment #3:

This was also reported before in bug #51875.

Maybe we could leave this bug open until the actual feature (automatically calculating normals for patch objects) is implemented.

Markus Mützel <mmuetzel>
Project Member
Thu 24 May 2018 08:02:35 AM UTC, comment #2:

Fwiw, there is a (quite old) patch in patch #8951 that added support for automatically calculating vertexnormals for patch object. I don't remember how complete it was and I don't know whether it still applies on a current tip.

Adding as a dependency anyway.

Markus Mützel <mmuetzel>
Project Member
Wed 23 May 2018 09:14:12 PM UTC, comment #1:

I've simplified things further. There is now just a single data file, patch.mat, and a single test file, tst_light.m. Both are attached to this bug report.

Have you looked at the help text for light? It seems that you need to supply the vertex normals when you are working with patch objects, as opposed to surface objects.

The VertexNormals property for patch objects is controlled by the VertexNormalsMode property. You might try the following in Matlab.

Alternatively, you could grab the vertexnormals and later use them in Octave

And then in Octave

(file #44203, file #44204)

Rik <rik5>
Project Administrator
Mon 21 May 2018 03:32:30 PM UTC, original submission:

The light function is supposed to add lighting to a 3D plot. I have found a case where the light function seems to have no effect no matter what I do. I have attached a data file "shape_data.mat" and a script, which uses it to demonstrate the problem.

I have also attached images and figures with the expected output from Matlab, and the actual output from Octave.

The examples in the documentation for light do work for me as expected.

I wasn't able to reduce the problem any further, the attached data is essentially an stl file that has been loaded.

I'm using the stable dev branch

Richard <crobar>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #44203:  patch.mat added by rik5 (13KiB - application/octet-stream)
file #44204:  tst_light.m added by rik5 (145B - text/x-matlab)
file #44197:  shape_data.mat added by crobar (14KiB - application/octet-stream)
file #44193:  test_light.m added by crobar (2KiB - text/x-objcsrc)
file #44194:  how_it_should_look.png added by crobar (22KiB - image/png)
file #44196:  how_it_looks_in_octave.ofig added by crobar (286KiB - application/octet-stream)

 

Digest:
   bug dependencies, patch dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by crobar (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 15 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-06-04 mmuetzel StatusConfirmed => Ready For Test
    2018-05-29 mmuetzel Dependencies- => Depends on bugs #51875
    2018-05-24 mmuetzel Operating SystemGNU/Linux => Any
    2018-05-24 mmuetzel Dependencies- => Depends on patch #8951
    2018-05-24 mmuetzel Operating SystemGNU/Linux => Any
    2018-05-23 rik5 Attached File- => Added patch.mat, #44203
        Attached File- => Added tst_light.m, #44204
        Item GroupIncorrect Result => Matlab Compatibility
        StatusNone => Confirmed
        Summary'light' function not working for some plots => 'light' function not working for patch objects
    2018-05-21 crobar Attached File- => Added shape_data.mat, #44197
    2018-05-21 crobar Attached File- => Added test_light.m, #44193
        Attached File- => Added how_it_should_look.png, #44194
        Attached File- => Added how_it_looks_in_octave.png, #44195
        Attached File- => Added how_it_looks_in_octave.ofig, #44196

    Back to the top


    Powered by Savane 3.3