Fix T66233: Grease Pencil Swirl Effect not working at origin

If the control object is in the origin the radius is wrongly calculated because the result is 0.

Now, this value is clamped to avoid this situation
This commit is contained in:
Antonio Vazquez 2019-07-23 22:29:42 +02:00
parent 13f57237f2
commit b83a1b62c7
Notes: blender-bot 2023-02-14 07:45:38 +01:00
Referenced by issue #66233, GPencil Swirl Effect not working when control object is in origin
1 changed files with 5 additions and 1 deletions

View File

@ -42,7 +42,11 @@ void main()
vec2 tc = uv - center;
float dist = length(tc);
float pxradius = (ProjectionMatrix[3][3] == 0.0) ? (radius / (loc.z * defaultpixsize)) :
float locpixsize = abs((loc.z * defaultpixsize));
if (locpixsize == 0) {
locpixsize = 1;
}
float pxradius = (ProjectionMatrix[3][3] == 0.0) ? (radius / locpixsize) :
(radius / defaultpixsize);
pxradius = max(pxradius, 1);