Refactor: GLSL: Cleanup Clip Space vs. NDC Space naming #105423

Closed
Prakhar-Singh-Chouhan wants to merge 15 commits from (deleted):fix#105070 into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
60 changed files with 90 additions and 90 deletions
Showing only changes of commit 7626315394 - Show all commits

View File

@ -23,7 +23,7 @@ void main()
pos.y * abs((pos.y > 0.0) ? amax.y : amin.y));
vec3 world_pos = (model_mat * vec4(final_pos, 1.0)).xyz;
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
finalColor = color;
edgeStart = edgePos = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport;

View File

@ -123,9 +123,9 @@ void main()
view_clipping_distances(wpos1);
vec4 p0 = point_world_to_ndc(wpos0);
vec4 p1 = point_world_to_ndc(wpos1);
vec4 p2 = point_world_to_ndc(wpos2);
vec4 p0 = point_world_to_homogenous(wpos0);
vec4 p1 = point_world_to_homogenous(wpos1);
vec4 p2 = point_world_to_homogenous(wpos2);
gl_Position = p1;

View File

@ -8,7 +8,7 @@ void main()
mat4 model_mat = extract_matrix_packed_data(inst_obmat, state_color, bone_color);
vec3 world_pos = (model_mat * vec4(pos, 1.0)).xyz;
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
finalColor.rgb = mix(state_color.rgb, bone_color.rgb, 0.5);
finalColor.a = 1.0;

View File

@ -8,7 +8,7 @@ void main()
finalColor.a = 1.0;
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
edgeStart = edgePos = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy;

View File

@ -4,7 +4,7 @@
void main()
{
vec3 world_pos = boundbox[gl_VertexID];
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
/* Result in a position at 1.0 (far plane). Small epsilon to avoid precision issue.
* This mimics the effect of infinite projection matrix

View File

@ -7,7 +7,7 @@ void main()
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
view_clipping_distances(world_pos);
}

View File

@ -7,7 +7,7 @@ void main()
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
vert.flag = data;
view_clipping_distances(world_pos);

View File

@ -8,11 +8,11 @@
finalColor = vec4(0.0); \
return;
void output_line(vec2 offset, vec4 color, vec3 out_world_pos, vec4 out_ndc_pos)
void output_line(vec2 offset, vec4 color, vec3 out_world_pos, vec4 out_hs_pos)
{
finalColor = color;
gl_Position = out_ndc_pos;
gl_Position.xy += offset * out_ndc_pos.w;
gl_Position = out_hs_pos;
gl_Position.xy += offset * out_hs_pos.w;
view_clipping_distances(out_world_pos);
}
@ -23,7 +23,7 @@ void main()
/* Perform vertex shader for each input primitive. */
vec3 in_pos[2];
vec3 world_pos[2];
vec4 ndc_pos[2];
vec4 hs_pos[2];
uint vert_flag[2];
/* Input prim is LineList. */
@ -39,7 +39,7 @@ void main()
in_pos[i] = vertex_fetch_attribute((input_line_id * 2) + i, pos, vec3).xyz;
vert_flag[i] = (uint)vertex_fetch_attribute((input_line_id * 2) + i, data, uchar);
world_pos[i] = point_object_to_world(in_pos[i]);
ndc_pos[i] = point_world_to_ndc(world_pos[i]);
hs_pos[i] = point_world_to_homogenous(world_pos[i]);
}
/* Perform Geometry shader equivalent calculation. */
@ -103,7 +103,7 @@ void main()
:
vec4(inner_color.rgb, 0.0);
vec2 v1_2 = (ndc_pos[1].xy / ndc_pos[1].w - ndc_pos[0].xy / ndc_pos[0].w);
vec2 v1_2 = (hs_pos[1].xy / hs_pos[1].w - hs_pos[0].xy / hs_pos[0].w);
vec2 offset = sizeEdge * 4.0 * sizeViewportInv; /* 4.0 is eyeballed */
if (abs(v1_2.x * sizeViewport.x) < abs(v1_2.y * sizeViewport.y)) {
@ -122,7 +122,7 @@ void main()
output_line(offset * 2.0,
vec4(colorActiveSpline.rgb, 0.0),
world_pos[output_prim_vert_id],
ndc_pos[output_prim_vert_id]);
hs_pos[output_prim_vert_id]);
}
else {
DISCARD_VERTEX
@ -132,19 +132,19 @@ void main()
case 1: {
/* draw the outline. */
output_line(
offset, outer_color, world_pos[output_prim_vert_id], ndc_pos[output_prim_vert_id]);
offset, outer_color, world_pos[output_prim_vert_id], hs_pos[output_prim_vert_id]);
break;
}
case 2: {
/* draw the core of the line. */
output_line(
vec2(0.0), inner_color, world_pos[output_prim_vert_id], ndc_pos[output_prim_vert_id]);
vec2(0.0), inner_color, world_pos[output_prim_vert_id], hs_pos[output_prim_vert_id]);
break;
}
case 3: {
/* draw the outline. */
output_line(
-offset, outer_color, world_pos[output_prim_vert_id], ndc_pos[output_prim_vert_id]);
-offset, outer_color, world_pos[output_prim_vert_id], hs_pos[output_prim_vert_id]);
break;
}
case 4: {
@ -153,7 +153,7 @@ void main()
output_line(offset * -2.0,
vec4(colorActiveSpline.rgb, 0.0),
world_pos[output_prim_vert_id],
ndc_pos[output_prim_vert_id]);
hs_pos[output_prim_vert_id]);
}
break;
}

View File

@ -21,7 +21,7 @@ void main()
}
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
gl_PointSize = (!is_gpencil) ? sizeVertex * 2.0 : sizeVertexGpencil * 2.0;
view_clipping_distances(world_pos);

View File

@ -15,7 +15,7 @@ void main()
}
vec3 world_pos = point_object_to_world(final_pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
finalColor = colorWireEdit;

View File

@ -19,7 +19,7 @@ void main()
vec3 world_pos = xAxis * pos.x + yAxis * pos.y + origin;
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
view_clipping_distances(world_pos);

View File

@ -6,7 +6,7 @@ void main()
{
GPU_INTEL_VERTEX_SHADER_WORKAROUND
gl_Position = point_world_to_ndc(pPosition);
gl_Position = point_world_to_homogenous(pPosition);
finalColor = pColor;
gl_PointSize = pSize;

View File

@ -36,7 +36,7 @@ void main()
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
bool is_multiframe = (vflag & GP_EDIT_MULTIFRAME) != 0u;
bool is_stroke_sel = (vflag & GP_EDIT_STROKE_SELECTED) != 0u;

View File

@ -17,7 +17,7 @@ void main()
}
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
/* Small offset in Z */
gl_Position.z -= 3e-4;

View File

@ -26,7 +26,7 @@ void main()
finalColor = vec4(weight_to_rgb(weight), 1.0);
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
view_clipping_distances(world_pos);
}

View File

@ -22,7 +22,7 @@ void main()
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
weightColor = vec4(weight_to_rgb(weight), 1.0);
view_clipping_distances(world_pos);

View File

@ -61,7 +61,7 @@ void main()
}
}
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
finalColor.a *= (test_occlusion()) ? alpha : 1.0;

View File

@ -29,7 +29,7 @@ void main()
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
fclem marked this conversation as resolved

Here.

Here.
uvec4 m_data = data & uvec4(dataMask);
fclem marked this conversation as resolved

You still need to fix the merge errors. This will not compile as point_view_to_ndc does not exist anymore.
You only removed the merge tags, but you need to remove what was below the <<<<<<< HEAD and do the renaming of what was above >>>>>>> main.

You still need to fix the merge errors. This will not compile as `point_view_to_ndc` does not exist anymore. You only removed the merge tags, but you need to remove what was below the `<<<<<<< HEAD` and do the renaming of what was above `>>>>>>> main`.

View File

@ -82,8 +82,8 @@ void main()
vec3 world_pos0 = point_object_to_world(in_pos0);
vec3 world_pos1 = point_object_to_world(in_pos1);
vec4 out_pos0 = point_world_to_ndc(world_pos0);
vec4 out_pos1 = point_world_to_ndc(world_pos1);
vec4 out_pos0 = point_world_to_homogenous(world_pos0);
fclem marked this conversation as resolved

Here

Here
vec4 out_pos1 = point_world_to_homogenous(world_pos1);
uvec4 m_data0 = uvec4(in_data0) & uvec4(dataMask);
fclem marked this conversation as resolved

Same thing here.

Same thing here.
uvec4 m_data1 = uvec4(in_data1) & uvec4(dataMask);

View File

@ -5,7 +5,7 @@
void main()
{
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
finalColor = mix(colorWire, colorVertexSelect, selection);

View File

@ -22,7 +22,7 @@ vec3 weight_to_rgb(float t)
void main()
{
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
if (useWeight) {
finalColor = vec4(weight_to_rgb(selection), 1.0);

View File

@ -3,7 +3,7 @@
void main()
{
vec3 world_pos = point_object_to_world(vec3(au, 0.0));
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
/* Snap vertices to the pixel grid to reduce artifacts. */
vec2 half_viewport_res = sizeViewport * 0.5;
vec2 half_pixel_offset = sizeViewportInv * 0.5;

View File

@ -45,14 +45,14 @@ void main()
/* Vertex shader per input vertex. */
vec3 world_pos0 = point_object_to_world(vec3(root_au0, 0.0));
vec3 world_pos1 = point_object_to_world(vec3(root_au1, 0.0));
vec4 ndc_pos0 = point_world_to_ndc(world_pos0);
vec4 ndc_pos1 = point_world_to_ndc(world_pos1);
vec4 hs_pos0 = point_world_to_homogenous(world_pos0);
vec4 hs_pos1 = point_world_to_homogeous(world_pos1);
/* Snap vertices to the pixel grid to reduce artifacts. */
vec2 half_viewport_res = sizeViewport * 0.5;
vec2 half_pixel_offset = sizeViewportInv * 0.5;
ndc_pos0.xy = floor(ndc_pos0.xy * half_viewport_res) / half_viewport_res + half_pixel_offset;
ndc_pos1.xy = floor(ndc_pos1.xy * half_viewport_res) / half_viewport_res + half_pixel_offset;
hs_pos0.xy = floor(hs_pos0.xy * half_viewport_res) / half_viewport_res + half_pixel_offset;
hs_pos1.xy = floor(hs_pos1.xy * half_viewport_res) / half_viewport_res + half_pixel_offset;
#ifdef USE_EDGE_SELECT
bool is_select0 = (root_flag0 & EDGE_UV_SELECT) != 0;
@ -74,19 +74,19 @@ void main()
* actual pixels are at 0.75, 1.0 is used for the background. */
float depth0 = is_select0 ? 0.25 : 0.35;
float depth1 = is_select1 ? 0.25 : 0.35;
ndc_pos0.z = depth0;
ndc_pos1.z = depth1;
hs_pos0.z = depth0;
hs_pos1.z = depth1;
/* Avoid precision loss. */
vec2 stipplePos0 = 500.0 + 500.0 * (ndc_pos0.xy / ndc_pos0.w);
vec2 stipplePos1 = 500.0 + 500.0 * (ndc_pos1.xy / ndc_pos1.w);
vec2 stipplePos0 = 500.0 + 500.0 * (hs_pos0.xy / hs_pos0.w);
vec2 stipplePos1 = 500.0 + 500.0 * (hs_pos1.xy / hs_pos1.w);
vec2 stippleStart0 = stipplePos0;
vec2 stippleStart1 = stipplePos1;
/* Geometry shader equivalent calculations. */
vec2 ss_pos[2];
fclem marked this conversation as resolved

This should become ndc_pos since it is the position after the division.

This should become `ndc_pos` since it is the position after the division.
ss_pos[0] = ndc_pos0.xy / ndc_pos0.w;
ss_pos[1] = ndc_pos1.xy / ndc_pos1.w;
ss_pos[0] = hs_pos0.xy / hs_pos0.w;
ss_pos[1] = hs_pos1.xy / hs_pos1.w;
float half_size = sizeEdge;
@ -108,19 +108,19 @@ void main()
switch (quad_vertex_id) {
case 1: /* vertex A */
case 3:
do_vertex(ndc_pos1, selectionFac1, stippleStart1, stipplePos1, half_size, edge_ofs.xy);
do_vertex(hs_pos1, selectionFac1, stippleStart1, stipplePos1, half_size, edge_ofs.xy);
break;
case 0: /* B */
do_vertex(ndc_pos0, selectionFac0, stippleStart0, stipplePos0, half_size, edge_ofs.xy);
do_vertex(hs_pos0, selectionFac0, stippleStart0, stipplePos0, half_size, edge_ofs.xy);
break;
case 2: /* C */
case 4:
do_vertex(ndc_pos0, selectionFac0, stippleStart0, stipplePos0, -half_size, -edge_ofs.xy);
do_vertex(hs_pos0, selectionFac0, stippleStart0, stipplePos0, -half_size, -edge_ofs.xy);
break;
case 5: /* D */
do_vertex(ndc_pos1, selectionFac1, stippleStart1, stipplePos1, -half_size, -edge_ofs.xy);
do_vertex(hs_pos1, selectionFac1, stippleStart1, stipplePos1, -half_size, -edge_ofs.xy);
break;
}
}

View File

@ -3,7 +3,7 @@
void main()
{
vec3 world_pos = point_object_to_world(vec3(au, 0.0));
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
finalColor = ((flag & FACE_UV_SELECT) != 0) ? colorFaceDot : vec4(colorWire.rgb, 1.0);
gl_PointSize = pointSize;

View File

@ -3,7 +3,7 @@
void main()
{
vec3 world_pos = point_object_to_world(vec3(au, 0.0));
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
bool is_selected = (flag & FACE_UV_SELECT) != 0u;
bool is_active = (flag & FACE_UV_ACTIVE) != 0u;

View File

@ -5,7 +5,7 @@ void main()
/* `pos` contains the coordinates of a quad (-1..1). but we need the coordinates of an image
* plane (0..1) */
vec3 image_pos = pos * 0.5 + 0.5;
vec4 position = point_object_to_ndc(image_pos);
vec4 position = point_object_to_homogenous(image_pos);
gl_Position = position;
uvs = image_pos.xy;
}

View File

@ -64,7 +64,7 @@ float area_ratio_to_stretch(float ratio, float tot_ratio)
void main()
{
vec3 world_pos = point_object_to_world(vec3(pos, 0.0));
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
#ifdef STRETCH_ANGLE
vec2 v1 = angle_to_v2(uv_angles.x * M_PI);

View File

@ -9,6 +9,6 @@ void main()
/* `pos` contains the coordinates of a quad (-1..1). but we need the coordinates of an image
* plane (0..1) */
vec3 image_pos = pos * 0.5 + 0.5;
vec4 position = point_object_to_ndc(image_pos);
vec4 position = point_object_to_homogenous(image_pos);
gl_Position = position;
}

View File

@ -16,7 +16,7 @@ void main()
* Vertices are between 0.0 and 0.2, Edges between 0.2 and 0.4
* actual pixels are at 0.75, 1.0 is used for the background. */
float depth = is_selected ? (is_pinned ? 0.05 : 0.10) : 0.15;
gl_Position = vec4(point_world_to_ndc(world_pos).xy, depth, 1.0);
gl_Position = vec4(point_world_to_homogenous(world_pos).xy, depth, 1.0);
gl_PointSize = pointSize;
/* calculate concentric radii in pixels */

View File

@ -13,7 +13,7 @@ void main()
float screen_size = mul_project_m4_v3_zfac(p) * sizePixel;
vec3 world_pos = p + screen_pos * screen_size;
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
/* Convert to screen position [0..sizeVp]. */
edgePos = edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy;

View File

@ -42,7 +42,7 @@ void main()
ls_cell_location = ls_cell_location * 2.0 - 1.0;
vec3 ws_cell_location = (model_mat * vec4(ls_cell_location, 1.0)).xyz;
gl_Position = point_world_to_ndc(ws_cell_location);
gl_Position = point_world_to_homogenous(ws_cell_location);
gl_PointSize = sizeVertex * 2.0;
finalColor = color_from_id(color_id);

View File

@ -9,7 +9,7 @@ void main()
finalColor = vec4(obmat[0][3], obmat[1][3], obmat[2][3], obmat[3][3]);
vec3 world_pos = (ModelMatrix * vec4(pos, 1.0)).xyz;
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
gl_PointSize = sizeVertex * 2.0;

View File

@ -5,7 +5,7 @@
void main()
{
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
gl_PointSize = sizeObjectCenter;
float radius = 0.5 * sizeObjectCenter;

View File

@ -209,7 +209,7 @@ void main()
}
}
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
/* Convert to screen position [0..sizeVp]. */
edgePos = edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy;

View File

@ -10,7 +10,7 @@ vec2 screen_position(vec4 p)
void main()
{
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
#ifdef SELECT_EDGES
/* HACK: to avoid losing sub-pixel object in selections, we add a bit of randomness to the

View File

@ -5,6 +5,6 @@
void main()
{
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
view_clipping_distances(world_pos);
}

View File

@ -7,13 +7,13 @@ void main()
vec3 world_pos = point_object_to_world(pos);
if (isCameraBackground) {
/* Model matrix converts to view position to avoid jittering (see #91398). */
gl_Position = point_view_to_ndc(world_pos);
gl_Position = point_view_to_homogenous(world_pos);
/* Camera background images are not really part of the 3D space.
* It makes no sense to apply clipping on them. */
view_clipping_distances_bypass();
}
else {
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
view_clipping_distances(world_pos);
}

View File

@ -45,7 +45,7 @@ void main()
vec3 world_pos;
if (hairThicknessRes > 1) {
/* Calculate the thickness, thicktime, worldpos taken into account the outline. */
float outline_width = point_world_to_ndc(center_wpos).w * 1.25 * sizeViewportInv.y *
float outline_width = point_world_to_homogenous (center_wpos).w * 1.25 * sizeViewportInv.y *
fclem marked this conversation as resolved

Did you run make format? there is an extra blank space here that should have been fixed by clang format.

Did you run `make format`? there is an extra blank space here that should have been fixed by clang format.
drw_view.wininv[1][1];
thickness += outline_width;
float thick_time = float(gl_VertexID % hairThicknessRes) / float(hairThicknessRes - 1);
@ -59,7 +59,7 @@ void main()
world_pos = center_wpos;
}
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
#ifdef USE_GEOM
vert.pos = point_world_to_view(world_pos);

View File

@ -32,8 +32,8 @@ void main()
vec3 ray_ori = pos;
vec3 ray_dir = (is_persp) ? (drw_view.viewinv[3].xyz - pos) : drw_view.viewinv[2].xyz;
vec3 isect = ray_plane_intersection(ray_ori, ray_dir, gpDepthPlane);
vec4 ndc = point_world_to_ndc(isect);
gl_FragDepth = (ndc.z / ndc.w) * 0.5 + 0.5;
vec4 hs = point_world_to_homogenous(isect);
fclem marked this conversation as resolved

Rename to hs_isect.

Rename to `hs_isect`.
gl_FragDepth = (hs.z / hs.w) * 0.5 + 0.5;
}
else {
gl_FragDepth = gl_FragCoord.z;

View File

@ -30,7 +30,7 @@ void main()
{
vec3 world_pos = pointcloud_get_pos();
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
/* Small bias to always be on top of the geom. */
gl_Position.z -= 1e-3;

View File

@ -29,7 +29,7 @@ void main()
{
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
#ifdef USE_GEOM
vert.pos = point_world_to_view(world_pos);
#endif

View File

@ -46,7 +46,7 @@ void main()
vertex_id_from_index_id(4 * line_prim_id + i), pos, vec3);
world_pos[i] = point_object_to_world(in_pos);
view_pos[i] = point_world_to_view(world_pos[i]);
gl_pos[i] = point_world_to_ndc(world_pos[i]);
gl_pos[i] = point_world_to_homogenous(world_pos[i]);
gl_pos[i].z -= 1e-3;
}

View File

@ -6,7 +6,7 @@ void main()
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
bool is_select = (nor.w > 0.0);
bool is_hidden = (nor.w < 0.0);

View File

@ -9,7 +9,7 @@ void main()
bool is_hidden = (nor.w < 0.0);
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
/* Add offset in Z to avoid Z-fighting and render selected wires on top. */
/* TODO: scale this bias using Z-near and Z-far range. */
gl_Position.z -= (is_select ? 2e-4 : 1e-4);

View File

@ -6,7 +6,7 @@ void main()
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
uv_interp = mu;

View File

@ -14,7 +14,7 @@ void main()
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
finalColor = srgb_to_linear_attr(ac);

View File

@ -6,7 +6,7 @@ void main()
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
/* Separate actual weight and alerts for independent interpolation */
weight_interp = max(vec2(weight, -weight), 0.0);

View File

@ -9,7 +9,7 @@ void main()
bool is_hidden = (nor.w < 0.0) && useSelect;
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
/* Add offset in Z to avoid Z-fighting and render selected wires on top. */
/* TODO: scale this bias using Z-near and Z-far range. */
gl_Position.z -= (is_select ? 2e-4 : 1e-4);

View File

@ -21,7 +21,7 @@ void main()
vec3 world_pos = part_pos;
#ifdef USE_DOTS
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
/* World sized points. */
gl_PointSize = sizePixel * draw_size * drw_view.winmat[1][1] * sizeViewport.y / gl_Position.w;
#else
@ -34,7 +34,7 @@ void main()
world_pos += rotate(pos, part_rot) * draw_size;
}
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
#endif
/* Coloring */

View File

@ -5,5 +5,5 @@
void main()
{
vec3 world_pos = pointcloud_get_pos();
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
}

View File

@ -5,7 +5,7 @@
void main()
{
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
finalColor = vec4(selection);
finalColor.a *= opacity;

View File

@ -26,7 +26,7 @@ void main()
thickness,
thick_time);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
mask_weight = 1.0 - (selection_opacity - retrieve_selection() * selection_opacity);

View File

@ -4,7 +4,7 @@
void main()
{
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
faceset_color = mix(vec3(1.0), fset, faceSetsOpacity);
mask_color = 1.0 - (msk * maskOpacity);

View File

@ -4,6 +4,6 @@
void main()
{
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
finalColor = attribute_value;
}

View File

@ -17,7 +17,7 @@ void main()
time,
thickness,
thick_time);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
if (is_point_domain) {
finalColor = texelFetch(color_tx, hair_get_base_id());

View File

@ -4,6 +4,6 @@
void main()
{
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
finalColor = attribute_value;
}

View File

@ -5,6 +5,6 @@
void main()
{
vec3 world_pos = pointcloud_get_pos();
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
finalColor = pointcloud_get_customdata_vec4(attribute_tx);
}

View File

@ -95,5 +95,5 @@ void main()
pos += rotated_pos * cellSize;
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
}

View File

@ -189,5 +189,5 @@ void main()
#endif
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
gl_Position = point_world_to_homogenous(world_pos);
}

View File

@ -86,7 +86,7 @@ void main()
float facing = dot(wnor, V);
gl_Position = point_world_to_ndc(wpos);
gl_Position = point_world_to_homogenous(wpos);
#ifndef CUSTOM_DEPTH_BIAS
float facing_ratio = clamp(1.0 - facing * facing, 0.0, 1.0);