We are about to switch to a new forum software. Until then we have removed the registration on this forum.
hello there...
have been working on a particular sketch for a while... and I'm starting to get random stroke glitches...
the code is pretty basic... so i can't really see why or how it could be happening given the parameters
(see example below)
Answers
I think it's a glitch with stroke, when StrokeWeight is something else other than 1.
when you say 'glitch' what do you mean?
i've run the code but nothing jumps out at me as wrong
u cant see glitchy lines crossing across the ellipses?
nope.
i'm using v 1.5.1
i'm using 3.0
it's also ok in v2
but i do see the glitches in v3
its even worse if there are other objects in the scene
this is probably worth raising as a proper bug as it seems wrong (especially those times when the glitch lines seem to come from a point outside the plane of the disk)
it does seem to occur at specific angles, i wonder if that's a clue.
This behavior is caused by Processing's "stroke optimization", just add
hint(DISABLE_OPTIMIZED_STROKE);
to your setup() function and you should be fine.@poersch that does indeed get rid of the lines, but at a massive cost to performance. not really a useable solution. did some reading and doesn't sound like there's a fix, sounds like its normal expected behaviour based on the renderer. a bit of a shame, but i guess i'll have to figure out other ways of doing what i'm trying to do
From rendering this one circle? If you are rendering more than one of those I wouldn't use strokes at all. Strokes are basically a heap of polygons, meaning you are rendering thousands of polygons just to display one colored circle. Taking an image of the circle and rotating that around would probably look the same. Alternatively you could create a disk like object (which of course has a higher poly count than an image but still far less than your stroke solution) and use a gradient texture or a simple shader to color it.
We need more information about your actual project or how and when these circles are rendered to the screen to help you find a more sophisticated workaround for the new "stroke optimization".
I have experienced the same problem with the Shapes3D library and the solution suggested by @Poersch worked for me too.
Unless you need wire frames then turn the stroke off. It is much faster to draw fills than strokes. The following data is from drawing two spheres where each sphere comprises 2500 quads.
1-2ms to render solid (fill only) spheres
4-5ms to render wireframe (stroke only) with ENABLE_OPTIMIZED_STROKE.
5-6ms to render wireframe (stroke only) with DISABLE_OPTIMIZED_STROKE
You can see the biggest impact is drawing the stroke (wire) and although disabling optimised stroke impacted on performance it not as great as you might expect.
Thanks for the responses guys.
To be specific I'm trying to create some rings with a gradient fill, as you can see in the images and code.
As far as I'm aware ellipse() does not have settings for an inner radius, something like the Segment node in vvvv.
I did find some examples here: https://processing.org/discourse/beta/num_1221179611.html
I managed to copy the code easy enough and call the ring function as needed.
I then attempted to apply the code for a radial gradient which I find here https://processing.org/examples/radialgradient.html but which is glitchy also.
I assume this is because this gradient code is optimized for a fill of an ellipse, rather than custom curveVertex shapes.
It does seem to work when you run the sketch, but when you rotate it, it goes all haywire... (also I'm not sure how to reconcile the two radii while the second radius is in the hue for loop)...
I can't say I know how to make the leap between the two.
Perhaps there is a better way to go about it all that someone can enlighten me on?
That's why I jumped to strokes - iterate some strokes and the stroke color - job done. Then I was met with the stroke glitch. But point taken its not efficient to work with strokes in this manner and fill is obviously much more desirable for this purpose (albeit unknown to me how to achieve such a thing)...
Anyway, without being a troll, it has to be said this is mind-blowingly hard, for, what is to my mind, a very simple task.
Here's a screen grab that describes how it looks (cool effect tho - but not what I want)...
This might help you get started.
@quark - brilliant. Perfect.
@quark again, thanks so much!
And a little shader based example:
@poersch - its been a little while, but i never did get that example to run ~