Fix T102126 Regression: Grease Pencil: Broken 2D Layering
This was because `stroke_id` was not using `vertex_start`. But since `vertex_start` is not 1 based like it used to be, we need to add 1 to it to avoid a fragment depth of `0.0` which would be equal to the background and not render.
This commit is contained in:
@@ -71,7 +71,7 @@ void main()
|
|||||||
/* Use the index of the point as depth.
|
/* Use the index of the point as depth.
|
||||||
* This means the stroke can overlap itself. */
|
* This means the stroke can overlap itself. */
|
||||||
float point_index = float(ma1.z);
|
float point_index = float(ma1.z);
|
||||||
gp_interp.depth = (point_index + gpStrokeIndexOffset + 1.0) * 0.0000002;
|
gp_interp.depth = (point_index + gpStrokeIndexOffset + 2.0) * 0.0000002;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Use the index of first point of the stroke as depth.
|
/* Use the index of first point of the stroke as depth.
|
||||||
@@ -80,7 +80,7 @@ void main()
|
|||||||
* We offset by one so that the fill can be overlapped by its stroke.
|
* We offset by one so that the fill can be overlapped by its stroke.
|
||||||
* The offset is ok since we pad the strokes data because of adjacency infos. */
|
* The offset is ok since we pad the strokes data because of adjacency infos. */
|
||||||
float stroke_index = float(ma1.y);
|
float stroke_index = float(ma1.y);
|
||||||
gp_interp.depth = (stroke_index + gpStrokeIndexOffset + 1.0) * 0.0000002;
|
gp_interp.depth = (stroke_index + gpStrokeIndexOffset + 2.0) * 0.0000002;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -128,7 +128,7 @@ void main()
|
|||||||
else {
|
else {
|
||||||
/* Use the index of first point of the stroke as depth. */
|
/* Use the index of first point of the stroke as depth. */
|
||||||
float stroke_index = float(ma1.y);
|
float stroke_index = float(ma1.y);
|
||||||
gp_interp.depth = (stroke_index + gpStrokeIndexOffset) * 0.0000002;
|
gp_interp.depth = (stroke_index + gpStrokeIndexOffset + 1.0) * 0.0000002;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ static void gpencil_buffer_add_point(GPUIndexBufBuilder *ibo,
|
|||||||
|
|
||||||
vert->strength = (round_cap0) ? pt->strength : -pt->strength;
|
vert->strength = (round_cap0) ? pt->strength : -pt->strength;
|
||||||
vert->u_stroke = pt->uv_fac;
|
vert->u_stroke = pt->uv_fac;
|
||||||
vert->stroke_id = gps->runtime.stroke_start;
|
vert->stroke_id = gps->runtime.vertex_start;
|
||||||
vert->point_id = v;
|
vert->point_id = v;
|
||||||
vert->thickness = max_ff(0.0f, gps->thickness * pt->pressure) * (round_cap1 ? 1.0f : -1.0f);
|
vert->thickness = max_ff(0.0f, gps->thickness * pt->pressure) * (round_cap1 ? 1.0f : -1.0f);
|
||||||
/* Tag endpoint material to -1 so they get discarded by vertex shader. */
|
/* Tag endpoint material to -1 so they get discarded by vertex shader. */
|
||||||
|
|||||||
Reference in New Issue
Block a user