Repository navigation
MNT: Depth-peeling 3d option - #10319
Conversation
|
+1 for enabling by default and allowing a way to turn it off. @GuillaumeFavelier you might want to |
I think CircleCI might actually support depth peeling...? In any case, if you touch a few translucent geometry examples then we'll be able to see if CircleCI renders them properly |
|
@GuillaumeFavelier Thanks for working on this! I agree with @larsoner that it should be ON by default so everything looks nice, and only if this breaks stuff for users, they can turn it off. We can document the steps necessary if one experiences odd behavior or crashes (like I did with X2go on NeuroSpin infrastructure) |
|
|
||
| _3d_options = dict() | ||
| _3d_default = dict(antialias='true') | ||
| _3d_default = dict(antialias='true', depth_peeling='true') |
There was a problem hiding this comment.
I think I'd turn this into a dataclass to increase robustness against typos :)
There was a problem hiding this comment.
I used it in e4550bf. Is it what you had in mind?
There was a problem hiding this comment.
Richard means: depth_peeling=True
There was a problem hiding this comment.
sorry, I had an Outdated view of the PR
There was a problem hiding this comment.
No problem, thanks for taking the time 👌
| MESA renderers). This option can also be controlled using an | ||
| environment variable, e.g., ``MNE_3D_OPTION_ANTIALIAS=false``. | ||
| depth_peeling : bool | None | ||
| If not None, set the default setting for accurate transparency. |
There was a problem hiding this comment.
Argh I hate the phrasing, "not None", I always have to do massive mental gymnastics to understand what it means (I think we discussed this the other day 🙈) Do you think you could turn this around?
There was a problem hiding this comment.
I reworked it in 3b06ba5. What do you think?
|
ok got it
… Message ID: ***@***.***>
|
|
tell us when it's good to go @GuillaumeFavelier |
| self.antialias = _get_3d_option('antialias') and \ | ||
| not MNE_3D_BACKEND_TESTING | ||
| self.depth_peeling = _get_3d_option('depth_peeling') and \ | ||
| not MNE_3D_BACKEND_TESTING |
There was a problem hiding this comment.
For this stuff, in conftest.py we should maybe just have a session-level fixture that picks up on MNE_3D_BACKEND_TESTING and monkeypatch.setenv('MNE_3D_OPTION_ANTIALIAS', 'false'). Then we don't need code here, just in our tests...
There was a problem hiding this comment.
The value still needs to be tested in the code right? However the variable is set
There was a problem hiding this comment.
I'm not sure what you mean.
Currently, MNE_3D_BACKEND_TESTING=true is always set if and only if testing is done, right?
If that's the case, then instead of even having this MNE_3D_BACKEND_TESTING env var used here, we should monkeypatch.setattr('MNE_3D_OPTION_ANTIALIAS', 'false') in a fixture that pytest uses for the entire session. That way the code here can just be:
self.antialias = _get_3d_option('antialias')
And the _get_3d_option will get_config('MNE_3D_OPTION_ANTIALIAS'), which will pick up the env var that we set in the fixture via monkeypatch. The effect ends up being the same: we turn off antialiasing (and depth peeling) in all our tests, and we only mess with the value the user has set during testing.
It helps keep testing-related stuff in conftest.py and out of places it doesn't belong (like _pyvista.py)
There was a problem hiding this comment.
... if it's not clear what I mean by this, I can push a quick commit to do what I suggest and you can see if it makes sense
There was a problem hiding this comment.
Oh now I get it, thanks for the explanation.
Of course you can commit in here @larsoner
There was a problem hiding this comment.
@GuillaumeFavelier can you open a follow-up PR for this?
|
That's the one I had locally @larsoner |
I think it actually is more accurate! You can clearly tell what is totally inside the brain and what is not
Yikes, me too! Feel free to put it back in |
This reverts commit 8c611f8.
|
Thank you, @GuillaumeFavelier!! and @larsoner |


This PR adds a 3d option to control depth peeling to address issues with X forwarding.
It is still work in progress:
In another PR, I plan to refactor the properties of
_PyVistaRendererand move them into_Figurewhere I think they should live (thestoreattribute serves this purpose).cc @hoechenberger