Skip to content

Conversation

@GuillaumeFavelier
Copy link
Contributor

This PR reworks lighting in 3d viz scenes:

master PR
image image
image image
image image
image image
image image

Related to #6731 (comment)

@GuillaumeFavelier GuillaumeFavelier self-assigned this Sep 1, 2020
@GuillaumeFavelier GuillaumeFavelier changed the title Improve lighting in 3D viz WIP: Improve lighting in 3D viz Sep 1, 2020
@agramfort
Copy link
Member

agramfort commented Sep 1, 2020 via email

@GuillaumeFavelier
Copy link
Contributor Author

The goal is to reproduce the lighting method used by Mayavi. Should I maybe update the table to integrate it?

@larsoner
Copy link
Member

larsoner commented Sep 1, 2020

Yes I have noticed that they are different. The right still doesn't quite look like Mayavi, though -- the contrast is too large. Maybe the ambient light level is higher in Mayavi?

@larsoner larsoner added this to the 0.21 milestone Sep 1, 2020
@agramfort
Copy link
Member

agramfort commented Sep 1, 2020 via email

@GuillaumeFavelier
Copy link
Contributor Author

Hm... I checked the ambient and diffuse values and they are the same (mayavi against pyvista) 🤔

I'll keep looking

@larsoner
Copy link
Member

larsoner commented Sep 1, 2020

Difference in light follows camera vs not? Default light locations?

@larsoner
Copy link
Member

larsoner commented Sep 1, 2020

Maybe this?

https://github.com/nipy/PySurfer/blob/master/surfer/viz.py#L3496-L3502

@GuillaumeFavelier
Copy link
Contributor Author

It's trickier than it seems. It's technically 3 lights (of type CameraLight) but the first one (of type HeadLight) is actually disabled.

@GuillaumeFavelier
Copy link
Contributor Author

GuillaumeFavelier commented Sep 2, 2020

Updated table after e23c884

PyVista (before) PyVista (now) Mayavi
image image image
image image -
image image -
image image image
image image image

Note: Locally, I had to downgrade my VTK to 8.1.2 to get Mayavi to plot without z-fighting

@agramfort
Copy link
Member

agramfort commented Sep 2, 2020 via email

@GuillaumeFavelier
Copy link
Contributor Author

@larsoner I pushed 4df834b to integrate #8182 (comment)

@GuillaumeFavelier GuillaumeFavelier changed the title WIP: Improve lighting in 3D viz MRG: Improve lighting in 3D viz Sep 2, 2020
x = np.sin(theta) * np.sin(phi)
y = np.cos(phi)
z = np.cos(theta) * np.sin(phi)
return x, y, z
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably use mne.transforms.sph_to_cart

@larsoner
Copy link
Member

larsoner commented Sep 2, 2020

I'll merge this, let's take care of sph_to_cart deduplication in another PR when someone sees it and remembers to do it

@larsoner larsoner merged commit ff6751d into mne-tools:master Sep 2, 2020
@larsoner
Copy link
Member

larsoner commented Sep 2, 2020

Thanks @GuillaumeFavelier !

@GuillaumeFavelier GuillaumeFavelier deleted the lighting branch September 2, 2020 14:39
marsipu pushed a commit to marsipu/mne-python that referenced this pull request Oct 14, 2020
* Improve lighting

* Turn off the headlight

* Orient lights
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants