Vary drifting grating contrast

The attached patch makes the alpha_multiplier parameter work to vary the contrast of the drifting_grating.
Works for me with very light testing (attached example).

M

Attachments:

After thinking about this a bit, I should clarify: this only works when the background is at (0.5, 0.5, 0.5). However, all the gratings have a mean luminance of 0.5, as far as I can tell. So I don’t think there are many reasons to use a different color background.

One way to make it work with all backgrounds would be to get the background color and use it to set the RGB values in this patch. However it’s probably cleaner to just have the grating blend correctly on the background. Because the texture uses GL_COMBINE (not GL_BLEND), I didn’t spend time to figure out how to do that correctly.

Thanks for the patch, Mark. I’ll check it out and get back to you.

Chris

Hi Chris,

Any progress on this? If you have something to test I can pull the nightly and test it.

best
Mark

Hi Mark,

Sorry for ignoring this for so long. I wanted to think about it some more before committing it, but then it completely fell off my radar.

Anyway, the patch seems fine, and I just committed it. It’ll be in tonight’s nightly build.

For future reference: It’s possible to get the same effect by drawing a semi-transparent rectangle over the grating in your experiment. I’ve attached an example that does this for gray, red, green, and blue backgrounds. If you ever want to adjust the contrast of a grating against a background that’s not neutral gray, this is a way to do it.

Cheers,
Chris

Attachment: DGContrast.xml (4.8 KB)

Thank you Chris. I’ll look into both options next week and let you know.

This all works. Thanks!

One additional comment - can you add some sort of error checking on XML field names in the server? For example, if an XML property name is specified that is unsupported for that object, have the server display an error at parse time. Right now if you set the ‘alpha’ or ‘contrast’ or ‘alapha_multiplier’ field of a rectangle object, those fields are ignored silently.

T hanks!
Mark

One additional comment - can you add some sort of error checking on XML field names in the server?

Big changes / improvements are coming on this front. Stay tuned.

– Dave