This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/draw/engines/eevee/shaders/surface_vert.glsl
Brecht Van Lommel c813a1b358 Cycles: add Point Info node
With (center) position, radius and random value outputs.

Eevee does not yet support rendering point clouds, but an untested
implementation of this node was added for when it does.

Ref T92573
2022-01-25 17:14:20 +01:00

64 lines
1.6 KiB
GLSL

#pragma BLENDER_REQUIRE(common_hair_lib.glsl)
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
#pragma BLENDER_REQUIRE(surface_lib.glsl)
#ifndef HAIR_SHADER
in vec3 pos;
in vec3 nor;
#endif
RESOURCE_ID_VARYING
void main()
{
GPU_INTEL_VERTEX_SHADER_WORKAROUND
PASS_RESOURCE_ID
#ifdef HAIR_SHADER
hairStrandID = hair_get_strand_id();
vec3 pos, binor;
hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
ModelMatrixInverse,
ViewMatrixInverse[3].xyz,
ViewMatrixInverse[2].xyz,
pos,
hairTangent,
binor,
hairTime,
hairThickness,
hairThickTime);
worldNormal = cross(hairTangent, binor);
vec3 world_pos = pos;
#elif defined(POINTCLOUD_SHADER)
pointcloud_get_pos_and_radius(pointPosition, pointRadius);
pointID = gl_VertexID;
#else
vec3 world_pos = point_object_to_world(pos);
#endif
gl_Position = point_world_to_ndc(world_pos);
/* Used for planar reflections */
gl_ClipDistance[0] = dot(vec4(world_pos, 1.0), clipPlanes[0]);
#ifdef MESH_SHADER
worldPosition = world_pos;
viewPosition = point_world_to_view(worldPosition);
# ifndef HAIR_SHADER
worldNormal = normalize(normal_object_to_world(nor));
# endif
/* No need to normalize since this is just a rotation. */
viewNormal = normal_world_to_view(worldNormal);
# ifdef USE_ATTR
# ifdef HAIR_SHADER
pos = hair_get_strand_pos();
# endif
pass_attr(pos, NormalMatrix, ModelMatrixInverse);
# endif
#endif
}