3

I am using blendMode='add' and drawing circles with visual.Circle. Unfortunatelly colors are not displayed correctly - it seems that adding rgb values is performed differently for circles. Many colors are marked with noise as if their values went over 1. The same colors work well for visual.GratingStim:

enter image description here

You can see that the second circle from the left is invisible (the same color as background) although its color should be [-1, -1, -1]. This suggests that the circles get 1 added to their rgb values (instead of 0 - the color of the background). Another thing (take a look at circle 1) is that there is an overlap of the boarder and the face which doesn't look well in blendMode add.

Code to reproduce the issue:

from psychopy import visual, event, core

def circ(win, col, pos):
    circ = visual.Circle(win, pos=pos, radius=1, edges=64, units='deg')
    circ.setFillColor(col)
    circ.setLineColor(col)
    return circ

def gabor(win, col, pos):
    return visual.GratingStim(win, mask='gauss', size=4,
        color=col, pos=pos)

colors = [[0., -0.4, -0.4], [-1, -1, -1],
    [0.5, 0.1, 0.1], [0.1, 0.6, 0.1]]
pos = [[x, 3] for x in range(-6, 7, 4)]
pos2 = [[x, -3] for x, _ in pos]

win = visual.Window(monitor='testMonitor', units='deg', 
    useFBO=True, blendMode='add')
circles = [circ(win, c, p) for c, p in zip(colors, pos)]
gabors = [gabor(win, c, p) for c, p in zip(colors, pos2)]

for blendMode in ['add', 'avg']:
    win.blendMode = blendMode
    for c, g in zip(circles, gabors):
        c.draw()
        g.draw()
    win.flip()
    event.waitKeys()

core.quit()
mmagnuski
  • 1,249
  • 1
  • 11
  • 23
  • Some extremely ugly hacks have been attempted for this issue: https://github.com/psychopy/psychopy/issues/830. +1 for minimal reproducible example. I see a light gray circle in the "blank" spot and ugly edges on all circles. Ubuntu 14.04, psychopy 1.81. – Jonas Lindeløv Aug 27 '15 at 20:13
  • This is the issue I was linking to in my previous question. But the monkey patch does not work here - I mean, it clips colors as expected but the colors are wrong - they end up white in most cases. The way rgb are added in the case of circles is wrong irrespective of color clipping. – mmagnuski Aug 27 '15 at 22:30
  • About the light circle - you see it correct, I forgot to change the colors. Updated now. – mmagnuski Aug 29 '15 at 11:09

0 Answers0