Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
painters renderering a mesh with patches

Subject: painters renderering a mesh with patches

From: Andrew

Date: 7 Apr, 2009 04:01:04

Message: 1 of 4

Hi all,

I've been sifting through alot of the documentation about renderers and rendering order, but I haven't found a suitable solution to my problem.

I'm using mesh to plot a surface with 101x101 points. I find the local maximums of this surface, and use scatter3 to highlight these points. To try and help the renderer out with the display order, I move these scatter points towards the camera (typically the x-y resolution of the mesh), so they look like they are in the same position but are actually closer to the camera than the mesh. I've also tried just increasing their z values since they are local maximums in the z direction.

This renders as desired using "zbuffer" or "opengl" as a renderer, but since I want a 3in x 3in x 300dpi the output eps is huge. When I switch to the "painters" renderer, the scatter points aren't rendered properly, as though "painters" thinks they are occluded by the mesh. Also using "painters" takes about 8 seconds to render, whereas "zbuffer" and "opengl" do it pretty much instantly.

I don't understand why shifting the scattered points towards the camera doesn't resolve the plot order for the "painters" method. Can anyone suggest anything?

Also, every now and again the outputted eps has a horizontal line either above or below the outputted figure when using "zbuffer' or "opengl"...

Thanks,
Andrew

Subject: painters renderering a mesh with patches

From: matt dash

Date: 7 Apr, 2009 04:28:01

Message: 2 of 4

"Andrew" <awbsmith@itee.uq.edu.au> wrote in message <grej60$9mf$1@fred.mathworks.com>...
> Hi all,
>
> I've been sifting through alot of the documentation about renderers and rendering order, but I haven't found a suitable solution to my problem.
>
> I'm using mesh to plot a surface with 101x101 points. I find the local maximums of this surface, and use scatter3 to highlight these points. To try and help the renderer out with the display order, I move these scatter points towards the camera (typically the x-y resolution of the mesh), so they look like they are in the same position but are actually closer to the camera than the mesh. I've also tried just increasing their z values since they are local maximums in the z direction.
>
> This renders as desired using "zbuffer" or "opengl" as a renderer, but since I want a 3in x 3in x 300dpi the output eps is huge. When I switch to the "painters" renderer, the scatter points aren't rendered properly, as though "painters" thinks they are occluded by the mesh. Also using "painters" takes about 8 seconds to render, whereas "zbuffer" and "opengl" do it pretty much instantly.
>
> I don't understand why shifting the scattered points towards the camera doesn't resolve the plot order for the "painters" method. Can anyone suggest anything?
>
> Also, every now and again the outputted eps has a horizontal line either above or below the outputted figure when using "zbuffer' or "opengl"...
>
> Thanks,
> Andrew


are you plotting the scatter after you plot the mesh? you might also try setting the axes drawmode to fast, which is supposed to ignore "closeness to the camera" and just stack them in the order you draw them.

Subject: painters renderering a mesh with patches

From: Andrew

Date: 7 Apr, 2009 04:58:01

Message: 3 of 4

"matt dash" <n.a@mail.com> wrote in message <grekog$ekk$1@fred.mathworks.com>...
> "Andrew" <awbsmith@itee.uq.edu.au> wrote in message <grej60$9mf$1@fred.mathworks.com>...
> > Hi all,
> >
> > I've been sifting through alot of the documentation about renderers and rendering order, but I haven't found a suitable solution to my problem.
> >
> > I'm using mesh to plot a surface with 101x101 points. I find the local maximums of this surface, and use scatter3 to highlight these points. To try and help the renderer out with the display order, I move these scatter points towards the camera (typically the x-y resolution of the mesh), so they look like they are in the same position but are actually closer to the camera than the mesh. I've also tried just increasing their z values since they are local maximums in the z direction.
> >
> > This renders as desired using "zbuffer" or "opengl" as a renderer, but since I want a 3in x 3in x 300dpi the output eps is huge. When I switch to the "painters" renderer, the scatter points aren't rendered properly, as though "painters" thinks they are occluded by the mesh. Also using "painters" takes about 8 seconds to render, whereas "zbuffer" and "opengl" do it pretty much instantly.
> >
> > I don't understand why shifting the scattered points towards the camera doesn't resolve the plot order for the "painters" method. Can anyone suggest anything?
> >
> > Also, every now and again the outputted eps has a horizontal line either above or below the outputted figure when using "zbuffer' or "opengl"...
> >
> > Thanks,
> > Andrew
>
>
> are you plotting the scatter after you plot the mesh? you might also try setting the axes drawmode to fast, which is supposed to ignore "closeness to the camera" and just stack them in the order you draw them.

I just set the drawmode to fast, and then all of the scatter points appeared. Ideally I only want the scatter points which should be visible though. Shifting the points towards the camera a bit should move the truly occluded points "under" the surface, so they still shouldn't appear.

Thanks for your help though!

Subject: painters renderering a mesh with patches

From: Andrew

Date: 7 Apr, 2009 04:58:01

Message: 4 of 4

"matt dash" <n.a@mail.com> wrote in message <grekog$ekk$1@fred.mathworks.com>...
> "Andrew" <awbsmith@itee.uq.edu.au> wrote in message <grej60$9mf$1@fred.mathworks.com>...
> > Hi all,
> >
> > I've been sifting through alot of the documentation about renderers and rendering order, but I haven't found a suitable solution to my problem.
> >
> > I'm using mesh to plot a surface with 101x101 points. I find the local maximums of this surface, and use scatter3 to highlight these points. To try and help the renderer out with the display order, I move these scatter points towards the camera (typically the x-y resolution of the mesh), so they look like they are in the same position but are actually closer to the camera than the mesh. I've also tried just increasing their z values since they are local maximums in the z direction.
> >
> > This renders as desired using "zbuffer" or "opengl" as a renderer, but since I want a 3in x 3in x 300dpi the output eps is huge. When I switch to the "painters" renderer, the scatter points aren't rendered properly, as though "painters" thinks they are occluded by the mesh. Also using "painters" takes about 8 seconds to render, whereas "zbuffer" and "opengl" do it pretty much instantly.
> >
> > I don't understand why shifting the scattered points towards the camera doesn't resolve the plot order for the "painters" method. Can anyone suggest anything?
> >
> > Also, every now and again the outputted eps has a horizontal line either above or below the outputted figure when using "zbuffer' or "opengl"...
> >
> > Thanks,
> > Andrew
>
>
> are you plotting the scatter after you plot the mesh? you might also try setting the axes drawmode to fast, which is supposed to ignore "closeness to the camera" and just stack them in the order you draw them.

I just set the drawmode to fast, and then all of the scatter points appeared. Ideally I only want the scatter points which should be visible though. Shifting the points towards the camera a bit should move the truly occluded points "under" the surface, so they still shouldn't appear.

Thanks for your help though!

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us