I am running into an issue when layering multiple greyscale gratings using blendMode=‘add’.
In the psychopy docs (http://www.psychopy.org/general/rendering.html), it suggests that when in ‘add’ mode (as opposed to ‘avg’ mode), the stimuli are combined in such a way that when a luminance value is requested that is out of bounds the pixel will either be clipped to the nearest possible value, or this will be artificially colored noise.
I’m finding that when this happens and I exceed a possible luminance value my stimulus contains artificial blues and reds. Presumably this is the artificial noise, but how can I turn it off?! Am I missing something here?
I want my luminance values to be clipped once they exceed ± 1, so that there are no artificial reds and blues presented. I’m using pyglet with Python 2.7 on a 2015 mac. This is what I get:
Here’s the code to replicate (note that this is simplified for ease of reproducibility, hence the 48 repetitions of drawing a grating do serve a purpose for the stimuli I am designing). Thanks:
from psychopy import visual, event, core
imageSize = 128
winHeight = 256
winLength = 256
win = visual.Window(
color=[0, 0, 0])
grating = visual.GratingStim(
for i in range(48):
grating.sf = 2.0 / imageSize
grating.contrast = 1
grating.opacity = 0.1
grating.pos = [0,0]