Skip to main content
Skip table of contents

L48: High Bit Depth Colour and Full Resolution, Limited Colour Space

L48 very simply allows the user to define a 256 x 3, 16 bpc CLUT for the display and assign it to our hardware. Subsequently, individual objects are assigned a red colour value that is an index to a row in the CLUT containing a 16 bpc RGB triplet.

L48 mode uses the red value assigned to the object as an index to a user-specified 256 x 3 16 bpc CLUT

The CLUT may be updated dynamically between frames, allowing access to the full 16-bit colour gamut across an experiment; however, a single video frame may contain a maximum of 256 unique colours.

Examples

Presenting side-by-side swatches

Note this example requires the use of Psychtoolbox for MATLAB. In this example, we present two side-by-side swatches of different hues, a common stimulus set in perceptual discrimination tasks. We must first set the video mode using Psychtoolbox’s PsychImaging commands.

MATLAB
%Establish the correct colour and video settings
AssertOpenGL;
PsychImaging('PrepareConfiguration');
PsychImaging('AddTask', 'General', 'EnableDataPixxL48Output');

Next, we open an onscreen window and adjust a few settings

MATLAB
%Open a full-screen window with a black background
screenNumber = max(Screen('Screens'));
[win, winRect] = Screen('OpenWindow', screenNumber, [0,0,0]);

%If using the PROPixx - uncomment the following to change the sequencer 
%for linearized output (trades off luminance). Make sure to reset to 0 at
%the end of your script.
%Datapixx('SetPropixxDlpSequenceProgram', 6);
%Datapixx('RegWr');

Now we are ready to generate some 16-bit colour values and populate our CLUT. Here we create two patches of similar hue for presentation and add them to a table loaded onto VPixx hardware. Since we are writing directly to our hardware, we need to send a register write (RegWr) to push our Datapixx commands to the device.

MATLAB
%generate some colours
patch1 = [0, 52428/65535, 10000/65535];
patch2 = [0, 52628/65535, 10000/65535];

%Generate our colour look-up table (CLUT) and load it into our hardware.
%Colours levels are from 0-2^16 expressed as a proportion from 0-1.
myTable=repmat([0,0,0], [256,1]);
myTable(1,:) = patch1;
myTable(2,:) = patch2;
Datapixx('SetVideoClut', myTable);
Datapixx('RegWr'); 

Now we can draw our patches and flip them to the display:

MATLAB
%Draw our patches side by side, using the index to the CLUT as the colour argument, flip
Screen('FillRect', win, 0, [winRect(3)/2, winRect(4)/2-50, winRect(3)/2+100, winRect(4)/2+50]);
Screen('FillRect', win, 1, [winRect(3)/2-100, winRect(4)/2-50, winRect(3)/2, winRect(4)/2+50]);
Screen('Flip', win);

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.