bugGNU Octave - Bugs: bug #51875, Lighting effect on patch objects...

 
 

bug #51875: Lighting effect on patch objects do not work

Submitter:  Tasos Papastylianou <tpapastylianou>
Submitted:  Sun 27 Aug 2017 08:20:15 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Tasos Papastylianou <poacheR> Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 28 Aug 2017 11:37:47 AM UTC, comment #3: 

Ok. Re-titling and closing as invalid.

Markus Mützel <mmuetzel>
Group administrator
Mon 28 Aug 2017 11:30:49 AM UTC, comment #2: 

Hi Markus, thank you for your reply, it is indeed useful and I'm sure will solve my problem, at least in the workaround sense. At least now I know the underlying cause for the fault, and I'm better informed on how lighting works, and can have a stab at it.

However, I'm of the opinion that it would be best to restore the original title, and simply close this particular bug under an appropriate status, and then start a new one with the title you suggested (perhaps linking the two during this process). Otherwise anyone coming to the bug tracker with the same bug / question is unlikely to find this discussion via such a title, unless they know what the problem is (which by definition they wouldn't), and may even submit unnecessary duplicate bugs.

Tasos Papastylianou <tpapastylianou>
Mon 28 Aug 2017 11:18:51 AM UTC, comment #1: 

For lighting to work on patches, you need to define the "facenormals" or "vertexnormals" property manually. Some functions like sphere or isosurface set these properties. Thus, lighting works "out of the box" with them.

A while back I did some steps towards automatically calculating the normals from the face vertices in patch #8951. I don't know whether that patch would still apply.

In the meantime, you could manually calculate the facenormals e.g. by using the cross product of two face edges.

Marking this as a feature request and changing the title accordingly.

Markus Mützel <mmuetzel>
Group administrator
Sun 27 Aug 2017 08:20:15 PM UTC, original submission:  

Attempting to add a light source to a patch object does not work.
Adding a light to other types of plot (e.g. surface) works.
Creating a patch object automatically, e.g. using isosurface, also works. Removing the light source and then adding another one in an object which previously supported lighting works as intended, e.g.:


A = zeros(5,5,5);   A(2:4,2:4,2:4) = 1;
isosurface(A, 0.5);
h = get(gca, 'children');
delete(h(1)); % deleting light object
camlight      % new light object works as intended


But attempting to create a patch object from scratch and then add light, doesn't seem to have an effect.

Example:


X = [0, 1, 1, 0; 1, 1, 1, 1; 0, 1, 1, 0];
Y = [0, 0, 1, 1; 0, 0, 1, 1; 1, 1, 1, 1];
Z = [0, 0, 0, 0; 0, 1, 1, 0; 0, 0, 1, 1];
p = patch(X', Y', Z', 'r')
camlight


I'm not sure if this bug is related: https://savannah.gnu.org/bugs/?42006 (referring specifically to the line "It looks like 'glEnable (LIGHTING)' should only be called for patches and surfaces if a light object is present in the axes")


Tasos Papastylianou <tpapastylianou>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 19 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-05-29 mmuetzel Dependencies- bugs #53958 is dependent
    2017-08-28 mmuetzel Severity1 - Wish 3 - Normal
        Item GroupFeature Request Incorrect Result
        StatusConfirmed Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
        SummaryCalculate facenormals or vertexnormals of patch objects automatically Lighting effect on patch objects do not work
    2017-08-28 mmuetzel Severity3 - Normal 1 - Wish
        Item GroupIncorrect Result Feature Request
        StatusNone Confirmed
        Release4.2.1 dev
        Operating SystemGNU/Linux Any
        SummaryCannot add light source to patch Calculate facenormals or vertexnormals of patch objects automatically
    2017-08-28 mmuetzel Severity3 - Normal 1 - Wish
        Item GroupIncorrect Result Feature Request
        StatusNone Confirmed
        Release4.2.1 dev
        Operating SystemGNU/Linux Any
        SummaryCannot add light source to patch Calculate facenormals or vertexnormals of patch objects automatically
        Dependencies- Depends on patch #8951

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code