jittery motion with filloval

Hello everyone.

My goal is to have a circle, drawn by screen('FillOval'), move according to a predefined
random trajectory on the screen. Pretty simple eh? The problem is the circle jitters / vibrates
/jumps every now and then as it is moving on its trajectory. the funny thing is if I use the
same code but replace FillOval with FillRect, the motion is smooth!

Any tips on why this is happening and how to prevent it ?


This simple code will be used as part of a more complex project involving alpha blending.

Thanks in advance
right now all I want to accomplish is

Screen(window,'FillOval', [0 0 255], mask{frame});
flipTime = Screen(window, 'Flip');

Mac Pro
OS X 10.5.3
2 X 3.2 Quad Core intel
graphics cards:
ATI Radeon HD 2600 XT
NVIDIA GeForce 8800 GT


--- In psychtoolbox@yahoogroups.com, "Mario Kleiner" <mario.kleiner@...> wrote:
>
> What do you mean with "jitters/vibrates"?
>
> A "jump" would mean for me that you miss video refresh
> intervals, so the motion is not smooth, maybe because
> drawing the filled oval is too slow on your graphics
> hardware? What graphics card, operating system do
> you have? Example code?
>
> -mario
>
> --- In psychtoolbox@yahoogroups.com, "coder244" <coder244@> wrote:
> >
> > Hello everyone.
> >
> > My goal is to have a circle, drawn by screen('FillOval'), move according to a predefined
> > random trajectory on the screen. Pretty simple eh? The problem is the circle jitters /
> vibrates
> > /jumps every now and then as it is moving on its trajectory. the funny thing is if I use
> the
> > same code but replace FillOval with FillRect, the motion is smooth!
> >
> > Any tips on why this is happening and how to prevent it ?
> >
> >
> > This simple code will be used as part of a more complex project involving alpha
> blending.
> >
> > Thanks in advance
> >
>
David Fencsiks tip is a good one. Provide the size
of the biggest oval you're going to draw, ie. if
the max diameter is say 100 pixels, do a

> Screen(window,'FillOval', [0 0 255], mask{frame}, 100);

If the resolution of your display is high and the
size of your ovals is small then the GPU has to do
much more work than neccessary, and you can
cut down by providing the correct maximum value.

if your animation loop really just looks like...

for frame=1:something
Screen(window,'FillOval', [0 0 255], mask{frame});
flipTime = Screen(window, 'Flip');
end

... then Filloval is too slow and providing the
maxdiameter parameter is the best you can
do to cut down drawing time.

Do you get many skipped frames?

Ovals are expensive to draw, because their
round shape must be approximated by lots of
small line segments or filled triangles, so this
is quite a bit of load in some cases.

The 'DrawDots' method is efficient for circles, but the
upper limit on NVidia and ATI hardware is around
63-64 pixels diameter, on Intel hardware even
lower (around 10 or so).

The other way to do it would be to draw the
set of ovals into a set of Offscreen windows,
then 'DrawTexture' those to the screen, as
demonstrated in "DrawingSpeedTest".

-mario


--- In psychtoolbox@yahoogroups.com, "coder244" <coder244@...> wrote:
>
> right now all I want to accomplish is
>
>
> Mac Pro
> OS X 10.5.3
> 2 X 3.2 Quad Core intel
> graphics cards:
> ATI Radeon HD 2600 XT
> NVIDIA GeForce 8800 GT
>
>
> --- In psychtoolbox@yahoogroups.com, "Mario Kleiner" <mario.kleiner@> wrote:
> >
> > What do you mean with "jitters/vibrates"?
> >
> > A "jump" would mean for me that you miss video refresh
> > intervals, so the motion is not smooth, maybe because
> > drawing the filled oval is too slow on your graphics
> > hardware? What graphics card, operating system do
> > you have? Example code?
> >
> > -mario
> >
> > --- In psychtoolbox@yahoogroups.com, "coder244" <coder244@> wrote:
> > >
> > > Hello everyone.
> > >
> > > My goal is to have a circle, drawn by screen('FillOval'), move according to a
predefined
> > > random trajectory on the screen. Pretty simple eh? The problem is the circle jitters /
> > vibrates
> > > /jumps every now and then as it is moving on its trajectory. the funny thing is if I
use
> > the
> > > same code but replace FillOval with FillRect, the motion is smooth!
> > >
> > > Any tips on why this is happening and how to prevent it ?
> > >
> > >
> > > This simple code will be used as part of a more complex project involving alpha
> > blending.
> > >
> > > Thanks in advance
> > >
> >
>
forget the last post, this is the output from testCircle.m ( I had changed graphics cards to
test it)



PTB-INFO: This is the OpenGL-Psychtoolbox for Apple OS X, version 3.0.8. (Build date:
Aug 15 2008)
PTB-INFO: Type 'PsychtoolboxVersion' for more detailed version information.
PTB-INFO: Psychtoolbox is licensed to you under terms of the GNU General Public License
(GPL). See file 'License.txt' in the
PTB-INFO: Psychtoolbox root folder for a copy of the GPL license.



OpenGL-Extensions are: GL_ARB_transpose_matrix GL_ARB_vertex_program
GL_ARB_vertex_blend GL_ARB_window_pos GL_ARB_shader_objects GL_ARB_vertex_shader
GL_ARB_shading_language_100 GL_EXT_multi_draw_arrays GL_EXT_clip_volume_hint
GL_EXT_rescale_normal GL_EXT_draw_range_elements GL_EXT_fog_coord
GL_EXT_gpu_program_parameters GL_EXT_geometry_shader4 GL_EXT_transform_feedback
GL_APPLE_client_storage GL_APPLE_specular_vector GL_APPLE_transform_hint
GL_APPLE_packed_pixels GL_APPLE_fence GL_APPLE_vertex_array_object
GL_APPLE_vertex_program_evaluators GL_APPLE_element_array GL_APPLE_flush_render
GL_APPLE_aux_depth_stencil GL_NV_texgen_reflection GL_NV_light_max_exponent
GL_IBM_rasterpos_clip GL_SGIS_generate_mipmap GL_ARB_imaging
GL_ARB_point_parameters GL_ARB_texture_env_crossbar GL_ARB_texture_border_clamp
GL_ARB_multitexture GL_ARB_texture_env_add GL_ARB_texture_cube_map
GL_ARB_texture_env_dot3 GL_ARB_multisample GL_ARB_texture_env_combine
GL_ARB_texture_compression GL_ARB_texture_mirrored_repeat GL_ARB_shadow
GL_ARB_depth_texture GL_ARB_fragment_program GL_ARB_fragment_program_shadow
GL_ARB_fragment_shader GL_ARB_occlusion_query GL_ARB_point_sprite
GL_ARB_texture_non_power_of_two GL_ARB_vertex_buffer_object
GL_ARB_pixel_buffer_object GL_ARB_draw_buffers GL_ARB_shader_texture_lod
GL_EXT_compiled_vertex_array GL_EXT_framebuffer_object GL_EXT_framebuffer_blit
GL_EXT_framebuffer_multisample GL_EXT_texture_rectangle GL_ARB_texture_rectangle
GL_EXT_texture_env_add GL_EXT_blend_color GL_EXT_blend_minmax
GL_EXT_blend_subtract GL_EXT_texture_lod_bias GL_EXT_abgr GL_EXT_bgra
GL_EXT_stencil_wrap GL_EXT_texture_filter_anisotropic GL_EXT_secondary_color
GL_EXT_blend_func_separate GL_EXT_shadow_funcs GL_EXT_stencil_two_side
GL_EXT_depth_bounds_test GL_EXT_texture_compression_s3tc
GL_EXT_texture_compression_dxt1 GL_EXT_texture_sRGB
GL_EXT_blend_equation_separate GL_EXT_texture_mirror_clamp
GL_EXT_packed_depth_stencil GL_EXT_bindable_uniform GL_EXT_texture_integer
GL_EXT_gpu_shader4 GL_EXT_draw_buffers2 GL_APPLE_flush_buffer_range
GL_APPLE_ycbcr_422 GL_APPLE_vertex_array_range GL_APPLE_texture_range
GL_APPLE_float_pixels GL_ATI_texture_float GL_ARB_texture_float GL_ARB_half_float_pixel
GL_APPLE_pixel_buffer GL_APPLE_object_purgeable GL_NV_point_sprite
GL_NV_register_combiners GL_NV_register_combiners2 GL_NV_blend_square
GL_NV_texture_shader GL_NV_texture_shader2 GL_NV_texture_shader3
GL_NV_fog_distance GL_NV_depth_clamp GL_NV_multisample_filter_hint
GL_NV_fragment_program_option GL_NV_fragment_program2
GL_NV_vertex_program2_option GL_NV_vertex_program3 GL_ATI_texture_mirror_once
GL_ATI_texture_env_combine3 GL_ATI_separate_stencil GL_SGIS_texture_edge_clamp
GL_SGIS_texture_lod



PTB-INFO: You are using a multi-display setup (2 active displays):
PTB-INFO: Please read 'help MultiDisplaySetups' for specific information on the Do's,
Dont's,
PTB-INFO: and possible causes of trouble and how to diagnose and resolve them.

PTB-INFO: According to the operating system, some of your connected displays do not
seem to
PTB-INFO: be switched into mirror mode. For a discussion of mirror mode vs. non-mirror
mode,
PTB-INFO: please read 'help MirrorMode'.


PTB-INFO: OpenGL-Renderer is NVIDIA Corporation :: NVIDIA GeForce 8800 GT OpenGL
Engine :: 2.0 NVIDIA-1.5.36
PTB-INFO: Renderer has 512 MB of VRAM and a maximum 493 MB of texture memory.
PTB-Info: VBL startline = 1050 , VBL Endline = 1050
PTB-Info: Measured monitor refresh interval from beamposition = 16.678533 ms
[59.957311 Hz].
PTB-Info: Will use beamposition query for accurate Flip time stamping.
PTB-Info: Measured monitor refresh interval from VBLsync = 16.679081 ms [59.955340
Hz]. (50 valid samples taken, stddev=0.033410 ms.)
PTB-Info: Reported monitor refresh interval from operating system = 16.666667 ms
[60.000000 Hz].
PTB-Info: Small deviations between reported values are normal and no reason to worry.


I am using a high resolution Im not entirely sure about the missed frames, is there a way
to check

--- In psychtoolbox@yahoogroups.com, "Mario Kleiner" <mario.kleiner@...> wrote:
>
> Hmm,
>
> your code is missing. Just put it into the "Files" section
> of the forum.
>
> However, i tested drawing a 'FillOval' within a
> 'FrameRect', passing the same rect parameter as
> you described. I tested in an animation loop,
> on a MacPro like yours with NVidia 8800 under
> OS/X 10.5.6, and on a MacBookPro with ATI X1600
> und 10.4.11.
>
> I can't reproduce the "jitter", the oval always nicely
> fits into the framed rectangle with no wobble whatsoever,
> i don't get any skipped frames at 90 Hz refresh, with
> or without the 'maxdiameter' parameter at a resolution
> of 1600 x 1400 pixels and the drawing time is about
> 0.4 msecs for an 800 x 800 pixels oval, way too short
> to cause timing problems.
>
> So either:
>
> a) You found an operating system bug in your OS and
> an upgrade would fix it. Rather unlikely but not impossible.
>
> b) Something else is causing massive timing problems?
>
> c) Your code does something unhealthy?
>
> d) Its not real, but some kind of artifact of motion
> perception? Have yout tried playing it at a low redraw
> rate or as sequence of still images to see if there is
> really something in the picture that causes this?
>
> I think of things like this "Brillenputzillusion" (look
> at the frame of the left glass):
>
> <http://www.yakachu.de/temp/brillenputzillusion1.avi>
> <http://www.yakachu.de/temp/brillenputzillusion2.avi>
>
> For b/c we need a minimal piece of code that shows
> the problem. Does PTB report lots of skipped frames/
> missed flip deadlines at the end? Do you use very
> high resolution and very high refresh rate?
>
> For d) Did you test on a CRT or on a flat panel?
>
> -mario
>
>
> --- In psychtoolbox@yahoogroups.com, "coder244" <coder244@> wrote:
> >
> > THanks for all the replies so far.
> >
> > The UpToMaxDiameter setting does not solve my problem.
> >
> > I tried using offscreen windows as in the DrawingSpeedTest example but this is not
what
> I
> > want to achieve. This is my goal:
> > For each frame (monitor refresh) a NEW circle is drawn on the screen, its position
> > incremented slightly, this gives the illusion a Single circle without a trace/trail is
moving
> > around the screen.
> >
> > The moving circle will act as an aperture for complex moving dots. So using drawDots
> > directly is not an option. My code is complex but here is a simplified version of what
I'm
> > doing:
> >
> > for i =1: numberOfFrames
> >
> > Screen(window,'FillOval', [0 0 0 255], mask{i},maxSize);
> >
> > end
> >
> > mask is essential a cell containing 4 column vectors for each new position at each
> frame,
> > this part works as I mentioned before using FillRect gives a filled rectangle moving
> around
> > the screen smoothly. I know its a speed issue with fillOval, so the question is, is there
a
> > way to work around it?
> >
> > here is some code ( its alot more complex)
> >
> >
> > --- In psychtoolbox@yahoogroups.com, "Mario Kleiner" <mario.kleiner@> wrote:
> > >
> > > David Fencsiks tip is a good one. Provide the size
> > > of the biggest oval you're going to draw, ie. if
> > > the max diameter is say 100 pixels, do a
> > >
> > > > Screen(window,'FillOval', [0 0 255], mask{frame}, 100);
> > >
> > > If the resolution of your display is high and the
> > > size of your ovals is small then the GPU has to do
> > > much more work than neccessary, and you can
> > > cut down by providing the correct maximum value.
> > >
> > > if your animation loop really just looks like...
> > >
> > > for frame=1:something
> > > Screen(window,'FillOval', [0 0 255], mask{frame});
> > > flipTime = Screen(window, 'Flip');
> > > end
> > >
> > > ... then Filloval is too slow and providing the
> > > maxdiameter parameter is the best you can
> > > do to cut down drawing time.
> > >
> > > Do you get many skipped frames?
> > >
> > > Ovals are expensive to draw, because their
> > > round shape must be approximated by lots of
> > > small line segments or filled triangles, so this
> > > is quite a bit of load in some cases.
> > >
> > > The 'DrawDots' method is efficient for circles, but the
> > > upper limit on NVidia and ATI hardware is around
> > > 63-64 pixels diameter, on Intel hardware even
> > > lower (around 10 or so).
> > >
> > > The other way to do it would be to draw the
> > > set of ovals into a set of Offscreen windows,
> > > then 'DrawTexture' those to the screen, as
> > > demonstrated in "DrawingSpeedTest".
> > >
> > > -mario
> > >
> > >
> > > --- In psychtoolbox@yahoogroups.com, "coder244" <coder244@> wrote:
> > > >
> > > > right now all I want to accomplish is
> > > >
> > > >
> > > > Mac Pro
> > > > OS X 10.5.3
> > > > 2 X 3.2 Quad Core intel
> > > > graphics cards:
> > > > ATI Radeon HD 2600 XT
> > > > NVIDIA GeForce 8800 GT
> > > >
> > > >
> > > > --- In psychtoolbox@yahoogroups.com, "Mario Kleiner" <mario.kleiner@> wrote:
> > > > >
> > > > > What do you mean with "jitters/vibrates"?
> > > > >
> > > > > A "jump" would mean for me that you miss video refresh
> > > > > intervals, so the motion is not smooth, maybe because
> > > > > drawing the filled oval is too slow on your graphics
> > > > > hardware? What graphics card, operating system do
> > > > > you have? Example code?
> > > > >
> > > > > -mario
> > > > >
> > > > > --- In psychtoolbox@yahoogroups.com, "coder244" <coder244@> wrote:
> > > > > >
> > > > > > Hello everyone.
> > > > > >
> > > > > > My goal is to have a circle, drawn by screen('FillOval'), move according to a
> > > predefined
> > > > > > random trajectory on the screen. Pretty simple eh? The problem is the circle
> > jitters /
> > > > > vibrates
> > > > > > /jumps every now and then as it is moving on its trajectory. the funny thing
is
> if I
> > > use
> > > > > the
> > > > > > same code but replace FillOval with FillRect, the motion is smooth!
> > > > > >
> > > > > > Any tips on why this is happening and how to prevent it ?
> > > > > >
> > > > > >
> > > > > > This simple code will be used as part of a more complex project involving
> alpha
> > > > > blending.
> > > > > >
> > > > > > Thanks in advance
> > > > > >
> > > > >
> > > >
> > >
> >
>
okay, I've finally put some code up (simplified) theres two files a .mat file you need to load
and a testCircle.m .

It might be my random position generation thats wrong but if you try the same data with
fillRect and fillOval you get smooth motion in the first.


If anyone tries and has any thoughts like me know.


Thanks again!


--- In psychtoolbox@yahoogroups.com, "Mario Kleiner" <mario.kleiner@...> wrote:
>
> Hmm,
>
> your code is missing. Just put it into the "Files" section
> of the forum.
>
> However, i tested drawing a 'FillOval' within a
> 'FrameRect', passing the same rect parameter as
> you described. I tested in an animation loop,
> on a MacPro like yours with NVidia 8800 under
> OS/X 10.5.6, and on a MacBookPro with ATI X1600
> und 10.4.11.
>
> I can't reproduce the "jitter", the oval always nicely
> fits into the framed rectangle with no wobble whatsoever,
> i don't get any skipped frames at 90 Hz refresh, with
> or without the 'maxdiameter' parameter at a resolution
> of 1600 x 1400 pixels and the drawing time is about
> 0.4 msecs for an 800 x 800 pixels oval, way too short
> to cause timing problems.
>
> So either:
>
> a) You found an operating system bug in your OS and
> an upgrade would fix it. Rather unlikely but not impossible.
>
> b) Something else is causing massive timing problems?
>
> c) Your code does something unhealthy?
>
> d) Its not real, but some kind of artifact of motion
> perception? Have yout tried playing it at a low redraw
> rate or as sequence of still images to see if there is
> really something in the picture that causes this?
>
> I think of things like this "Brillenputzillusion" (look
> at the frame of the left glass):
>
> <http://www.yakachu.de/temp/brillenputzillusion1.avi>
> <http://www.yakachu.de/temp/brillenputzillusion2.avi>
>
> For b/c we need a minimal piece of code that shows
> the problem. Does PTB report lots of skipped frames/
> missed flip deadlines at the end? Do you use very
> high resolution and very high refresh rate?
>
> For d) Did you test on a CRT or on a flat panel?
>
> -mario
>
>
> --- In psychtoolbox@yahoogroups.com, "coder244" <coder244@> wrote:
> >
> > THanks for all the replies so far.
> >
> > The UpToMaxDiameter setting does not solve my problem.
> >
> > I tried using offscreen windows as in the DrawingSpeedTest example but this is not
what
> I
> > want to achieve. This is my goal:
> > For each frame (monitor refresh) a NEW circle is drawn on the screen, its position
> > incremented slightly, this gives the illusion a Single circle without a trace/trail is
moving
> > around the screen.
> >
> > The moving circle will act as an aperture for complex moving dots. So using drawDots
> > directly is not an option. My code is complex but here is a simplified version of what
I'm
> > doing:
> >
> > for i =1: numberOfFrames
> >
> > Screen(window,'FillOval', [0 0 0 255], mask{i},maxSize);
> >
> > end
> >
> > mask is essential a cell containing 4 column vectors for each new position at each
> frame,
> > this part works as I mentioned before using FillRect gives a filled rectangle moving
> around
> > the screen smoothly. I know its a speed issue with fillOval, so the question is, is there
a
> > way to work around it?
> >
> > here is some code ( its alot more complex)
> >
> >
> > --- In psychtoolbox@yahoogroups.com, "Mario Kleiner" <mario.kleiner@> wrote:
> > >
> > > David Fencsiks tip is a good one. Provide the size
> > > of the biggest oval you're going to draw, ie. if
> > > the max diameter is say 100 pixels, do a
> > >
> > > > Screen(window,'FillOval', [0 0 255], mask{frame}, 100);
> > >
> > > If the resolution of your display is high and the
> > > size of your ovals is small then the GPU has to do
> > > much more work than neccessary, and you can
> > > cut down by providing the correct maximum value.
> > >
> > > if your animation loop really just looks like...
> > >
> > > for frame=1:something
> > > Screen(window,'FillOval', [0 0 255], mask{frame});
> > > flipTime = Screen(window, 'Flip');
> > > end
> > >
> > > ... then Filloval is too slow and providing the
> > > maxdiameter parameter is the best you can
> > > do to cut down drawing time.
> > >
> > > Do you get many skipped frames?
> > >
> > > Ovals are expensive to draw, because their
> > > round shape must be approximated by lots of
> > > small line segments or filled triangles, so this
> > > is quite a bit of load in some cases.
> > >
> > > The 'DrawDots' method is efficient for circles, but the
> > > upper limit on NVidia and ATI hardware is around
> > > 63-64 pixels diameter, on Intel hardware even
> > > lower (around 10 or so).
> > >
> > > The other way to do it would be to draw the
> > > set of ovals into a set of Offscreen windows,
> > > then 'DrawTexture' those to the screen, as
> > > demonstrated in "DrawingSpeedTest".
> > >
> > > -mario
> > >
> > >
> > > --- In psychtoolbox@yahoogroups.com, "coder244" <coder244@> wrote:
> > > >
> > > > right now all I want to accomplish is
> > > >
> > > >
> > > > Mac Pro
> > > > OS X 10.5.3
> > > > 2 X 3.2 Quad Core intel
> > > > graphics cards:
> > > > ATI Radeon HD 2600 XT
> > > > NVIDIA GeForce 8800 GT
> > > >
> > > >
> > > > --- In psychtoolbox@yahoogroups.com, "Mario Kleiner" <mario.kleiner@> wrote:
> > > > >
> > > > > What do you mean with "jitters/vibrates"?
> > > > >
> > > > > A "jump" would mean for me that you miss video refresh
> > > > > intervals, so the motion is not smooth, maybe because
> > > > > drawing the filled oval is too slow on your graphics
> > > > > hardware? What graphics card, operating system do
> > > > > you have? Example code?
> > > > >
> > > > > -mario
> > > > >
> > > > > --- In psychtoolbox@yahoogroups.com, "coder244" <coder244@> wrote:
> > > > > >
> > > > > > Hello everyone.
> > > > > >
> > > > > > My goal is to have a circle, drawn by screen('FillOval'), move according to a
> > > predefined
> > > > > > random trajectory on the screen. Pretty simple eh? The problem is the circle
> > jitters /
> > > > > vibrates
> > > > > > /jumps every now and then as it is moving on its trajectory. the funny thing
is
> if I
> > > use
> > > > > the
> > > > > > same code but replace FillOval with FillRect, the motion is smooth!
> > > > > >
> > > > > > Any tips on why this is happening and how to prevent it ?
> > > > > >
> > > > > >
> > > > > > This simple code will be used as part of a more complex project involving
> alpha
> > > > > blending.
> > > > > >
> > > > > > Thanks in advance
> > > > > >
> > > > >
> > > >
> > >
> >
>