# Artifact while presenting textures simultaneously

**URL:** <https://psychtoolbox.discourse.group/t/artifact-while-presenting-textures-simultaneously/3591>\
**Category:** Programming Help\
**Tags:** linux\
**Created:** [December 18, 2020, 5:52pm UTC](https://psychtoolbox.discourse.group/t/artifact-while-presenting-textures-simultaneously/3591 "2020-12-18T17:52:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yu-hsin](https://avatars.discourse-cdn.com/v4/letter/y/c5a1d2/32.png) [@yu-hsin](https://psychtoolbox.discourse.group/u/yu-hsin)\
**Post date:** [December 18, 2020, 5:52pm UTC](https://psychtoolbox.discourse.group/t/artifact-while-presenting-textures-simultaneously/3591/1 "2020-12-18T17:52:26Z")

</div>

Dear community members,

I am now programming an experiment that required fast(\<100ms) presentation of gratings (i.e., two superimposed gabors) at two different locations (A and B). **I noticed that the luminescence always increase quite noticeably whenever two textures/gratings presented simultaneously**. In other words, all other things being equal, the luminescence only remained consistent while single gratings being flipped. I was wondering whether this is a hardware, software driven issue or some problem with my script. As shown below:

My general strategy is to cover up previously flipped textures using FillRect, then draw new ones with my custom function Greatings in a huge for loop (not shown).

```
         %% Covering up the previously flipped textures
  FusionAid(windowPtr,destination_A,destination_B);
  Screen('FillRect', windowPtr,[128 128 128], destinationRect_A);
  Screen('FillRect', windowPtr,[128 128 128], destinationRect_B );
  Screen('DrawDots', windowPtr, destination_dot_A, 5, [255 0 0], [0 0], 1, 1);
  Screen('DrawDots', windowPtr, destination_dot_B, 5, [255 0 0], [0 0], 1, 1);
  Screen('BlendFunction', windowPtr, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  Screen('Flip', windowPtr);
  WaitSecs(2);

          %% Draw and flip the new gratings 
  FusionAid(windowPtr,destination_A,destination_B););
  Gratings(windowPtr, gabor_size, destination_A)
  Gratings(windowPtr, gabor_size, destination_B)
  Screen('DrawDots', windowPtr, destination_dot_A, 5, [255 0 0], [0 0], 1, 1);
  Screen('DrawDots', windowPtr, destination_dot_B, 5, [255 0 0], [0 0], 1, 1);
  Screen('BlendFunction', windowPtr, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  Screen('Flip', windowPtr);
  WaitSecs(0.04); 
         % luminescence increase!! 

```

**Some troubleshooting attemps**

1. Under the following condition the luminescence DO NOT increase (gratings only at either A or B location)

2. NO luminescence increase in the following condition either. (B location FillRect + A location gratings)

3. I also use VRR function for more accurate timing with:  
PsychImaging(‘AddTask’, ‘General’, ‘UseFineGrainedTiming’);  
However, the issue persisted even after disabling the function altogether.

Any comment or suggestions would be appreciated.  
Thanks in advance.

Additional info:  
The size of the gratings and FillRect are just 200x200 pixels. I imagine RX580 should be powerful enough to drive the given task?

Hardware  
intel i7 10700  
AMD RX580  
MSI MAG motherboard 8460M  
MSI 240Hz FreeSync compatible Monitor

Software environment  
Ubuntu 20.04 LTS  
Matlab 2019b  
GPU Driver : xf86-videoamdgpu-pro DOX video driver (latest gpu driver i can find)  
Psychtoolbox3 Version 3.0.16

---

<div class="post-metadata">

**Author:** ![dcnieho](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@dcnieho](https://psychtoolbox.discourse.group/u/dcnieho)\
**Post date:** [December 18, 2020, 6:13pm UTC](https://psychtoolbox.discourse.group/t/artifact-while-presenting-textures-simultaneously/3591/2 "2020-12-18T18:13:34Z")

</div>

ITs a bit unclear to me what you are doing and observing. Do you mean the whole screen is brighter, or just that the grating looks brighter? I assume the latter. Are the gratings semi-transparent? Then it would make sense that two on top of each other is brighter (whiter white, but also darker black by the way) than a single one, since less of the background middle grays still shines through.

This should not be an issue of presentation time (short 100 ms), or graphics card power (by faaaaar powerful enough).

Cheers,  
Dee

---

<div class="post-metadata">

**Author:** ![yu-hsin](https://avatars.discourse-cdn.com/v4/letter/y/c5a1d2/32.png) [@yu-hsin](https://psychtoolbox.discourse.group/u/yu-hsin)\
**Post date:** [December 18, 2020, 6:54pm UTC](https://psychtoolbox.discourse.group/t/artifact-while-presenting-textures-simultaneously/3591/3 "2020-12-18T18:54:19Z")

</div>

Thanks for the quick reply, you’re right, only the gratings are brighter.

Sorry for not specifying clearly, the “being brighter” that I was referring to is that comparing to having just **one gratings at one of the two locations** (i.e., A grating at A location; “nothing” at B location ), having **two gratings at two respective locations** (i.e., A\* grating at A location; B grating at B location) somehow makes A\* gratings brighter than A gratings.

Which is odd, since all the gratings(i.e., A, A\* and B ) are generated using identical function, the only difference being either one(the former case) or two(the latter case) was drawn and flipped.

> [@yu-hsin](#):
>
> gratings (i.e., two superimposed gabors)

The two superimposed gabor that I mentioned here is that I use two gabors, one upright, the other rotated 90 degrees to the right, each at 50% contrast, stack them up to create a mesh-like stimuli.

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [December 21, 2020, 7:02pm UTC](https://psychtoolbox.discourse.group/t/artifact-while-presenting-textures-simultaneously/3591/4 "2020-12-21T19:02:55Z")

</div>

Multiple comments:

1. Mysterious!

2. The way you do stimulus presentation timing is about as unreliable and suboptimal as it could possibly get. Please look at our demos and tutorials how to do this properly.

3. VRR mode for fine-grained timing – apart from requiring you to follow step 2 - \*\*will not work with the amdgpu-pro driver \*\* as i explained to you about 1.5 months ago here:  
[XOrgConfCreator not prompting VRR settings for fine-grained visual stimulation timing](https://psychtoolbox.discourse.group/t/xorgconfcreator-not-prompting-vrr-settings-for-fine-grained-visual-stimulation-timing/3468/3)  
so it isn’t surprising that that does nothing.

4. Without a simple self-contained script that shows in detail what your are doing, and that somebody can easily run on their Linux setup, this sounds hopeless to diagnose.

That said, if you wanted me to give it a try, your lab would have to buy priority support, as this sounds like something intricate and time consuming, easily eating up an hour of work.

-mario

---

<div class="post-metadata">

**Author:** ![yu-hsin](https://avatars.discourse-cdn.com/v4/letter/y/c5a1d2/32.png) [@yu-hsin](https://psychtoolbox.discourse.group/u/yu-hsin)\
**Post date:** [December 23, 2020, 1:15pm UTC](https://psychtoolbox.discourse.group/t/artifact-while-presenting-textures-simultaneously/3591/5 "2020-12-23T13:15:17Z")

</div>

> [@mariokleiner](#):
>
> VRR mode for fine-grained timing – apart from requiring you to follow step 2 - \*\*will not work with the amdgpu-pro driver \*\* as i explained to you about 1.5 months ago here:  
> [XOrgConfCreator not prompting VRR settings for fine-grained visual stimulation timing](https://psychtoolbox.discourse.group/t/xorgconfcreator-not-prompting-vrr-settings-for-fine-grained-visual-stimulation-timing/3468/3)  
> so it isn’t surprising that that does nothing.

Sorry for the confusion, that was a type, I did reinstall both toolbox and system without the AMD provided driver, it works just great without issue, thanks again for the help!

> [@mariokleiner](#):
>
> The way you do stimulus presentation timing is about as unreliable and suboptimal as it could possibly get. Please look at our demos and tutorials how to do this properly.

Thanks for the suggestion, I’ll check it out.

I’ll post comments here once I figure out the issue.
