The first is model texture
The code in fs :
void main(void){
if (drawWireframe)
{
float ef = edgeFactor();
color = mix(wireColor, newFaceColor, ef);
}
float depth = logisticDepth(gl_FragCoord.z);
fragColor = vec4(vec3(depth), 1.0f);}
This is contour shader picture:
The code is
float linearizeDepth(float depth)
{
return (2.0 * near * far) / (far + near - (depth * 2.0 - 1.0) * (far - near));
}
float logisticDepth(float depth, float steepness = 0.1f, float offset = 5.0f)
{
float zVal = linearizeDepth(depth);
return (1 / (1 + exp(-steepness * (zVal - offset))));
}
void main(void)
{
float depth = logisticDepth(gl_FragCoord.z);
fragColor = vec4(vec3(depth,depth,depth), 1.0f);//-vec4(0,0,0.1,0);
}
Now the output like this:
And the code is like this
#version 410
out vec4 FragColor;
in vec3 ourColor;
in vec2 TexCoord;
uniform sampler2D texture1;
uniform sampler2D texture2;
uniform int width;
uniform int height;
int half_size=3;
void main()
{
vec4 color1 = texture(texture1, TexCoord);
vec4 color2 = texture(texture2, TexCoord);
vec4 color3;
if(color2.g<=color1.g &&color2.g!=1)
color3.rgb=vec3(1,0,0);
else //if(color2.r==1)
color3.rgb=vec3(1,1,1);
FragColor = color2;
}
But I need the output lines are same weight


