Missing objects in output image

28 views
Skip to first unread message

Olumide

unread,
Nov 27, 2010, 5:40:54 PM11/27/10
to Sketch Users
For some unknown reason, some objects are randomly left out of an
image I'm trying to create. For example the file, below contains a
grid with 8 dots (4 on each corner and 4 on the mid point of each edge
of the grid):
https://groups.google.com/group/sketch-users/web/MissingDots.sk

The output image is supposed to look like this:
https://groups.google.com/group/sketch-users/web/TargetImage.png

Instead I'm getting this
https://groups.google.com/group/sketch-users/web/Output.pdf

Notice that the dots at the top and bottom left corner of the image
are missing, which is quite strange because all 8 dots are present in
the sketch file as well as the LaTeX file that it was compiled from,
so the problem is not one of hidden surface removal. Yet when I
compile to PDF some of the dots disappear.

Thanks.

Olumide

Alex

unread,
Nov 27, 2010, 5:54:48 PM11/27/10
to sketch...@googlegroups.com
Yes, it's the hidden surface removal, and it seems to be due to rounding errors. The algorithm does not remove objects from the output, it just outputs them in some other order (e.g. first the dot and then the polygon => the dot disappears).

Try this:
dots[linecolor=blue,dotsize=1mm 0,lay=over](your points)

It worked for me.



--
You received this message because you are subscribed to the Google Groups "Sketch Users" group.
To post to this group, send email to sketch...@googlegroups.com.
To unsubscribe from this group, send email to sketch-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sketch-users?hl=en.


Olumide

unread,
Nov 27, 2010, 6:11:55 PM11/27/10
to Sketch Users
On Nov 27, 10:54 pm, Alex <broscutama...@gmail.com> wrote:
> Yes, it's the hidden surface removal, and it seems to be due to rounding
> errors. The algorithm does not remove objects from the output, it just
> outputs them in some other order (e.g. first the dot and then the polygon =>
> the dot disappears).
>
> Try this:
> dots[linecolor=blue,dotsize=1mm 0,lay=over](your points)
>
> It worked for me.

It works for me too. The problem is now that when I rotate the camera
like so
https://groups.google.com/group/sketch-users/web/MissingDots2.sk

some of the points are not obscured by the warped grid as they ought
to.

Gene Ressler

unread,
Nov 27, 2010, 7:58:13 PM11/27/10
to sketch...@googlegroups.com
It's hard to figure out from this very large example what's going on.   If the dots are on or very hear the surface, then you're at the mercy of floating point precision, as dots are represented internally as single geometric points.  Nearly intersecting surfaces will appear to sort randomly.

If the dots are actually well in front or behind the surface and acting in the wrong manner, then I'd appreciate a smaller example to work with, perhaps with only 4 polygons or so.  If it's a bug in the HSR, I'll fix it.  This is possible, as dots are probably the least tested aspect of the HSR.

As a workaround I suggest you define tiny spheres or cubes to use as dots.  

--
You received this message because you are subscribed to the Google Groups "Sketch Users" group.
To post to this group, send email to sketch...@googlegroups.com.
To unsubscribe from this group, send email to sketch-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sketch-users?hl=en.




--
Gene Ressler

Olumide

unread,
Nov 30, 2010, 4:10:00 AM11/30/10
to Sketch Users
On Nov 28, 12:58 am, Gene Ressler <gene.ress...@gmail.com> wrote:
> As a workaround I suggest you define tiny spheres or cubes to use as dots.

Thanks. I guess that's my only option. Unfortunately, tiny spheres and
cubes will undergo scale depending on their distance from the camera :-
S .

Can I suggest that in the next version of Sketch, points and lines on
polygon faces (or even smooth surfaces) (I'm drawing a lot of lines
and curves on surfaces at the moment) should be indicated as such in
order to avoid rounding errors in the hidden surface removal
algorithm. Such lines and points should be automatically drawn after
the surfaces they lie on.

BTW, is it possible to assign two different colors to each side of a
polygon face?

- Olumide

Gene Ressler

unread,
Nov 30, 2010, 9:24:24 AM11/30/10
to sketch...@googlegroups.com
Absolutely I know this is useful.  It turns out to be amazingly hard to get points and edges overlaid on surfaces to render perfectly in all cases, but I'll tackle this in the next version.
 
Note that you can actually calculate a scale factor that depends on the point's distance to the eye in such a manner that sphere/cube sizes don't vary with viewpoint.  I know this is a terrible kludge.
 
Can you say whether your dots are positioned lying exactly on the surface?  I'm still trying to know whether there's a real bug here or just a numerical precision issue.
 
Thanks.
 
 
--
You received this message because you are subscribed to the Google Groups "Sketch Users" group.
To post to this group, send email to sketch...@googlegroups.com.
To unsubscribe from this group, send email to sketch-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sketch-users?hl=en.




--
Gene Ressler

Olumide

unread,
Nov 30, 2010, 2:53:15 PM11/30/10
to Sketch Users
On Nov 30, 2:24 pm, Gene Ressler <gene.ress...@gmail.com> wrote:
> Can you say whether your dots are positioned lying exactly on the surface?
> I'm still trying to know whether there's a real bug here or just a numerical
> precision issue.

The dots are supposed to lie on the grid. In fact, the grid is the
scattered data interpolation of the points. What really puzzles me is
that although Sketch BSP correctly passes all 8 points to its LaTeX
output (check out the LaTeX file output), some of them are not drawn!

Alex

unread,
Nov 30, 2010, 3:15:26 PM11/30/10
to sketch...@googlegroups.com
If you draw a black dot and then you paint over it with white ink, you
won't see the dot any more. That's exactly what Latex does. It draws
first the dot, and then it draws a filled (white) polygon over it.

When you specified 'lay=over' for the dots, Sketch outputs first the
rest of the drawings (here, the polygons). The dots are left at the
end of the file, i.e. they are drawn over all other objects).

TikZ/PST draws all the objects in sequential order (in the order they
appear in the input file). Sketch reorders them with the Painter's
algorithm.

In some cases (with cull=true), Sketch will remove some polygons from
the output, because it assumes that other polygons will cover them
completely. That's an optimization (and I never use it, although the
Sketch manual says I should).

Gene Ressler

unread,
Nov 30, 2010, 9:27:10 PM11/30/10
to sketch...@googlegroups.com
Alex is correct as usual.  I don't want to seem pedantic, but all these issues are rather carefully explained -- with examples -- in the manual.

Gene
--
Gene Ressler
Reply all
Reply to author
Forward
0 new messages