In most cases, yes, you can treat opacity as a way to set Michelson contrast but two caveats:
- it’s really a multiplier: the contrast of your stimulus is ultimately governed by a multiplication of the color, the contrast value, the opacity and the inherent contrast of the texture (although if you’re using the built-in sin texture then that is 1)
- opacity (unlike the
contrast
parameter itself) is making a weighted average of the stimulus and whatever is behind it. If you set opacity = 0.2 then each pixel will be 0.2xStimulus and 0.8xbackground color. So the contrast also now depends on what is behind the stimulus. That’s assuming your window has blend mode = ‘avg’ - if you need to combine multiple gratings then understanding the weighted average for the pixels gets especially complicated, so then I’d really recommend you use a blend mode = ‘add’
I hope that helps