psychojs icon indicating copy to clipboard operation
psychojs copied to clipboard

Looking for details about adding a stimulus type to PsychoJS

Open MGretton opened this issue 4 years ago • 3 comments

I'm currently implementing ElementArrayStim into the JS backend for use with Pavlovia. I've worked out a way to do this, but it would be helpful to know a best practice approach. Specifically, it would be great to develop this in a way that we could contribute it back to PsychoJS and PsychoPy if/when it's releasable.

At the moment my biggest missing link is understanding how the PsychoJS source code is being compiled into the libraries (core-xxx.js, etc. etc.) that PsychoPy then downloads from lib.pavlovia.org when creating an online build. I can hack my way around this in a few different ways, but it would be great to fit in with the existing workflow.

I'd also welcome any other documentation you have, and tips/thoughts on implementing ElementArrayStim using pixi,js (and/or more generally extending PsychoJS in a nice/compliant manner). Thanks!

MGretton avatar Apr 22 '20 21:04 MGretton

Fantastic @MGretton ! Would be great to start seeing some of the more advanced rendering options appear in PsychoJS - they were less of a priority because lack of gamma correction would dissuade people from this type of work, but I tihnk it would be great to start adding! :-) We're also keen to work to a more community-integrated development model now that the core of the package is in place. I'll let @apitiot discuss the details of how to go about making additions and building the code into a package for use

peircej avatar Apr 23 '20 06:04 peircej

By the way, regarding implementation of ElementArrayStim itself, have you got alpha masks working in Pixi? The mask used by ImageStim at the moment isn't correct - it obscures with grey rather than using transparency I believe. We've been wondering about a move to plain WebGL instead of Pixi though too

peircej avatar Apr 23 '20 06:04 peircej

Hi @peircej, thanks for getting back to me!

It would be nice to implement gamma correction for online experiments (perhaps similar to how some video games do it, by having participants use a slider to calibrate barely visible images?). I guess there's no robust solution, but needs must given the current situation. At least for now we're just having to do the best we can to get experiments online with the known limitations.

For an initial implementation (to suit the experiment we're porting to online), I can avoid masks and (probably) gamma, but it sounds like something I'll need to look into. I'm still pretty early in the process, but will keep an eye out - it sounds like Pixi has some complications, though.

Thanks for looping in @apitiot, it would be great to get more details.

MGretton avatar Apr 24 '20 01:04 MGretton