#677 Add clipping to trees and alpha masked blinn-phong

master
RunitaiLinden 2024-02-05 12:00:38 -06:00
parent 5abc68ad43
commit 4e61152ca2
5 changed files with 21 additions and 0 deletions

View File

@ -31,14 +31,20 @@ uniform float minimum_alpha;
uniform sampler2D diffuseMap;
in vec3 vary_position;
in vec3 vary_normal;
in vec4 vertex_color;
in vec2 vary_texcoord0;
vec2 encode_normal(vec3 n);
void mirrorClip(vec3 pos);
void main()
{
mirrorClip(vary_position);
vec4 col = texture(diffuseMap, vary_texcoord0.xy) * vertex_color;
if (col.a < minimum_alpha)

View File

@ -28,6 +28,7 @@
out vec4 frag_data[4];
in vec3 vary_normal;
in vec3 vary_position;
uniform float minimum_alpha;
@ -36,8 +37,12 @@ in vec2 vary_texcoord0;
vec2 encode_normal(vec3 n);
void mirrorClip(vec3 pos);
void main()
{
mirrorClip(vary_position);
vec4 col = diffuseLookup(vary_texcoord0.xy) * vertex_color;
if (col.a < minimum_alpha)

View File

@ -32,13 +32,16 @@ uniform sampler2D diffuseMap;
in vec4 vertex_color;
in vec3 vary_normal;
in vec2 vary_texcoord0;
in vec3 vary_position;
uniform float minimum_alpha;
vec2 encode_normal(vec3 n);
void mirrorClip(vec3 pos);
void main()
{
mirrorClip(vary_position);
vec4 col = texture(diffuseMap, vary_texcoord0.xy);
if (col.a < minimum_alpha)
{

View File

@ -24,6 +24,7 @@
*/
uniform mat4 texture_matrix0;
uniform mat4 modelview_matrix;
uniform mat4 modelview_projection_matrix;
uniform mat3 normal_matrix;
@ -34,11 +35,14 @@ in vec2 texcoord0;
out vec3 vary_normal;
out vec4 vertex_color;
out vec2 vary_texcoord0;
out vec3 vary_position;
void main()
{
//transform vertex
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
vary_normal = normalize(normal_matrix * normal);

View File

@ -299,6 +299,9 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gDeferredPBRAlphaProgram);
mShaderList.push_back(&gDeferredAvatarProgram);
mShaderList.push_back(&gDeferredTerrainProgram);
mShaderList.push_back(&gDeferredDiffuseAlphaMaskProgram);
mShaderList.push_back(&gDeferredNonIndexedDiffuseAlphaMaskProgram);
mShaderList.push_back(&gDeferredTreeProgram);
}
LLViewerShaderMgr::~LLViewerShaderMgr()