removed getElementXD() and getElementXDNormalized() from core GLSL headers...

removed getElementXD() and getElementXDNormalized() from core GLSL headers since the same functionality is directly provided by GLSL with texture() and texelFetch() in a much cleaner way.
parent 0f093954
......@@ -60,17 +60,17 @@ void main() {
// perform MIP
out_Color = vec4(0.0);
for (float slice = 0.0; slice < 1.0; slice += _3dTextureParams._sizeRCP.z) {
out_Color = max(out_Color, lookupTF(_transferFunction, _transferFunctionParams, getElement3DNormalized(_texture3d, _3dTextureParams, vec3(ex_TexCoord.xy, slice)).r));
out_Color = max(out_Color, lookupTF(_transferFunction, _transferFunctionParams, texture(_texture3d, vec3(ex_TexCoord.xy, slice)).r));
}
}
else {
// render the corresponding slice
vec3 coord = vec3(ex_TexCoord.xy, (_sliceNumber + 0.5) / (_3dTextureParams._size.z));
out_Color = lookupTF(_transferFunction, _transferFunctionParams, getElement3DNormalized(_texture3d, _3dTextureParams, coord).r);
out_Color = lookupTF(_transferFunction, _transferFunctionParams, texture(_texture3d, coord).r);
}
}
else {
vec4 texel = getElement2DNormalized(_texture2d, _2dTextureParams, ex_TexCoord.xy);
vec4 texel = texture(_texture2d, ex_TexCoord.xy);
if (_2dTextureParams._numChannels == 1) {
out_Color = lookupTF(_transferFunction, _transferFunctionParams, texel.r);
}
......
......@@ -42,9 +42,9 @@ uniform sampler2D _depthTexture;
void main() {
vec2 fragCoord = gl_FragCoord.xy * _viewportSizeRCP;
out_Color = getElement2DNormalized(_colorTexture, _texParams, fragCoord);
out_Color = texture(_colorTexture, fragCoord);
#ifndef NO_DEPTH
gl_FragDepth = getElement2DNormalized(_depthTexture, _texParams, fragCoord).r;
gl_FragDepth = texture(_depthTexture, fragCoord).r;
#endif
}
......@@ -35,7 +35,7 @@ uniform TextureParameters2D _maskTexParams;
uniform vec4 _maskColor; ///< mask color
#define MASKING_PROLOG(COORDS) \
vec4 maskValue = getElement2DNormalized(_maskImage, _maskTexParams, (COORDS) ); \
vec4 maskValue = texture(_maskImage, (COORDS) ); \
if (distance(maskValue, _maskColor) > 0.01) {
#define MASKING_EPILOG \
......
......@@ -34,28 +34,3 @@ struct TextureParameters2D {
vec2 _sizeRCP;
int _numChannels;
};
/**
* Texture lookup function for 2D textures using pixel coordinates, i.e [(0,0) , textureSize].
* \param tex Sampler to texture
* \param texParams TextureParameters2D struct with texture for lookup
* \param texCoords Lookup coordinates in pixel coordinates
* \return The texel at the given coordinates.
*/
vec4 getElement2D(in sampler2D tex, in TextureParameters2D texParams, in vec2 texCoords) {
vec2 texCoordsNormalized = texCoords * texParams._sizeRCP;
//vec2 texCoordsTransformed = (texParams.matrix_ * vec4(texCoordsNormalized, 0.0, 1.0)).xy;
return texture(tex, texCoordsNormalized);
}
/**
* Texture lookup function for 2D textures using normalized texture coordinates, i.e. [0,1].
* \param tex Sampler to texture
* \param texParams TextureParameters2D struct with texture for lookup
* \param texCoords Lookup coordinates in normlized texture coordinates
* \return The texel at the given coordinates.
*/
vec4 getElement2DNormalized(in sampler2D tex, in TextureParameters2D texParams, in vec2 texCoords) {
//vec2 texCoordsTransformed = (texParams.matrix_ * vec4(texCoords, 0.0, 1.0)).xy;
return texture(tex, texCoords);
}
......@@ -48,31 +48,6 @@ struct TextureParameters3D {
vec2 _realWorldMapping;
};
/**
* Texture lookup function for 3D textures using voxel coordinates, i.e [(0,0) , textureSize].
* \param tex Sampler to texture
* \param texParams TextureParameters3D struct with texture for lookup
* \param texCoords Lookup coordinates in pixel coordinates
* \return The texel at the given coordinates.
*/
vec4 getElement3D(in sampler3D tex, in TextureParameters3D texParams, in vec3 texCoords) {
vec3 texCoordsNormalized = texCoords * texParams._sizeRCP;
//vec2 texCoordsTransformed = (texParams.matrix_ * vec4(texCoordsNormalized, 0.0, 1.0)).xy;
return texture(tex, texCoordsNormalized);
}
/**
* Texture lookup function for 3D textures using normalized texture coordinates, i.e. [0,1].
* \param tex Sampler to texture
* \param texParams TextureParameters3D struct with texture for lookup
* \param texCoords Lookup coordinates in normlized texture coordinates
* \return The texel at the given coordinates.
*/
vec4 getElement3DNormalized(in sampler3D tex, in TextureParameters3D texParams, in vec3 texCoords) {
//vec2 texCoordsTransformed = (texParams.matrix_ * vec4(texCoords, 0.0, 1.0)).xy;
return texture(tex, texCoords);
}
/**
* Transforms texture coordinates for texture \a tex to world coordinates using the texture's
* texture-to-world matrix.
......
......@@ -38,11 +38,11 @@ out vec4 out_Color;
#ifdef USE_3D_TEX
#define SAMPLER_TYPE sampler3D
#define TEXPARAMS_TYPE TextureParameters3D
#define TEXTURE_LOOKUP_FUNC getElement3DNormalized
#define TEXTURE_LOOKUP_FUNC texture
#else
#define SAMPLER_TYPE sampler2D
#define TEXPARAMS_TYPE TextureParameters2D
#define TEXTURE_LOOKUP_FUNC getElement2DNormalized
#define TEXTURE_LOOKUP_FUNC texture
#endif
uniform SAMPLER_TYPE _usImage;
......@@ -73,9 +73,9 @@ void main() {
vec2 texCoord = ex_TexCoord.xy;
#endif
vec4 texel = TEXTURE_LOOKUP_FUNC(_usImage, _usTextureParams, texCoord);
vec4 blurred = TEXTURE_LOOKUP_FUNC(_blurredImage, _blurredTextureParams, texCoord) * _blurredScale;
float confidence = clamp(TEXTURE_LOOKUP_FUNC(_confidenceMap, _confidenceTextureParams, texCoord).r * _confidenceScaling, 0.0, 1.0);
vec4 texel = TEXTURE_LOOKUP_FUNC(_usImage, texCoord);
vec4 blurred = TEXTURE_LOOKUP_FUNC(_blurredImage, texCoord) * _blurredScale;
float confidence = clamp(TEXTURE_LOOKUP_FUNC(_confidenceMap, texCoord).r * _confidenceScaling, 0.0, 1.0);
float uncertainty = lookupTF(_confidenceTF, _confidenceTFParams, confidence).a;
if (confidence <= 0.0) {
......
......@@ -47,12 +47,12 @@ void main() {
vec3 worldCoords = ex_Position.xyz / ex_Position.z;
vec3 texCoords = worldToTexture(_textureParameters, worldCoords);
out_Color = getElement3DNormalized(_strainTexture, _textureParameters, texCoords);
out_Color = texture(_strainTexture, texCoords);
while (length(out_Color) == 0.0) {
worldCoords -= normalize(ex_TexCoord) * 0.1;
texCoords = worldToTexture(_textureParameters, worldCoords);
out_Color = getElement3DNormalized(_strainTexture, _textureParameters, texCoords);
out_Color = texture(_strainTexture, texCoords);
}
#ifdef ENABLE_SHADING
......
......@@ -94,7 +94,7 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
vec3 samplePosition = entryPoint.rgb + t * direction;
// lookup intensity and TF
vec4 strain = getElement3DNormalized(_volume, _volumeTextureParams, samplePosition);
vec4 strain = texture(_volume, samplePosition);
vec4 color = (_volumeTextureParams._numChannels == 4) ? strain : vec4(strain.xyz, 0.0);
color.a = clamp(length(strain.xyz)/1.0, 0.0, 1.0);
......@@ -114,7 +114,7 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
vec3 newSamplePosition = entryPoint.rgb + newT * direction;
// lookup refined intensity + TF
vec4 newStrain = getElement3DNormalized(_volume, _volumeTextureParams, newSamplePosition);
vec4 newStrain = texture(_volume, newSamplePosition);
vec4 newColor = (_volumeTextureParams._numChannels == 4) ? newStrain : vec4(newStrain.xyz, 0.0);
newColor.a = clamp(length(newColor.xyz)/1.0, 0.0, 1.0);
......@@ -168,8 +168,8 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
// calculate depth value from ray parameter
gl_FragDepth = 1.0;
if (firstHitT >= 0.0) {
float depthEntry = getElement2DNormalized(_entryPointsDepth, _entryParams, texCoords).z;
float depthExit = getElement2DNormalized(_exitPointsDepth, _exitParams, texCoords).z;
float depthEntry = texture(_entryPointsDepth, texCoords).z;
float depthExit = texture(_exitPointsDepth, texCoords).z;
gl_FragDepth = calculateDepthValue(firstHitT/tend, depthEntry, depthExit);
}
return result;
......@@ -180,8 +180,8 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
***/
void main() {
vec2 p = gl_FragCoord.xy * _viewportSizeRCP;
vec3 frontPos = getElement2DNormalized(_entryPoints, _entryParams, p).rgb;
vec3 backPos = getElement2DNormalized(_exitPoints, _exitParams, p).rgb;
vec3 frontPos = texture(_entryPoints, p).rgb;
vec3 backPos = texture(_exitPoints, p).rgb;
//determine whether the ray has to be casted
if (frontPos == backPos) {
......
......@@ -52,13 +52,13 @@ uniform TextureParameters2D _drrClippedTexParams;
***/
void main() {
// fetch input textures
vec4 xRayColor = getElement2DNormalized(_xRayColor, _xRayTexParams, ex_TexCoord.xy);
float xRayDepth = getElement2DNormalized(_xRayDepth, _xRayTexParams, ex_TexCoord.xy).r;
vec4 sliceColor = getElement2DNormalized(_sliceColor, _sliceTexParams, ex_TexCoord.xy);
float sliceDepth = getElement2DNormalized(_sliceDepth, _sliceTexParams, ex_TexCoord.xy).r;
vec4 xRayColor = texture(_xRayColor, ex_TexCoord.xy);
float xRayDepth = texture(_xRayDepth, ex_TexCoord.xy).r;
vec4 sliceColor = texture(_sliceColor, ex_TexCoord.xy);
float sliceDepth = texture(_sliceDepth, ex_TexCoord.xy).r;
float drrFull = getElement2DNormalized(_drrFullColor, _drrFullTexParams, ex_TexCoord.xy).r;
float drrClipped = getElement2DNormalized(_drrClippedColor, _drrClippedTexParams, ex_TexCoord.xy).r;
float drrFull = texture(_drrFullColor, ex_TexCoord.xy).r;
float drrClipped = texture(_drrClippedColor, ex_TexCoord.xy).r;
float weightingFactor = 0.0;
if (drrClipped > 0)
......
......@@ -44,7 +44,7 @@ void main() {
out_Color = vec4(1.0);
}
else {
float intensity = getElement2DNormalized(_texture, _textureParameters, ex_TexCoord.xy).a;
float intensity = texture(_texture, ex_TexCoord.xy).a;
out_Color = lookupTF(_transferFunction, _transferFunctionParams, intensity);
// don't write fragment if fully transparent (in particular don't write to depth buffer!)
......
......@@ -89,7 +89,7 @@ float applyDepthGaussFilter(in vec2 texCoord) {
for (int i = -_halfKernelDimension; i <= _halfKernelDimension; ++i) {
// TODO: why the fuck does abs(i) not work here?!?
int absi = (i < 0) ? -i : i;
float curDepth = getElement2DNormalized(_depthPass2Texture, _pass2TexParams, texCoord + (_direction * _viewportSizeRCP * i)).r;
float curDepth = texture(_depthPass2Texture, texCoord + (_direction * _viewportSizeRCP * i)).r;
result += curDepth * _gaussKernel[absi];
}
result /= _norm;
......@@ -110,11 +110,11 @@ void main() {
gl_FragDepth = filteredDepth;
} else {
// we are in the second vertical pass and have to modulate the color
float curDepth = getElement2DNormalized(_depthTexture, _texParams, texCoord).r;
float curDepth = texture(_depthTexture, texCoord).r;
float deltaD = normalizeDepth(filteredDepth) - normalizeDepth(curDepth);
// apply depth darkening
vec4 curColor = getElement2DNormalized(_colorTexture, _texParams, texCoord);
vec4 curColor = texture(_colorTexture, texCoord);
if (curColor.a == 0)
discard;
......
......@@ -79,7 +79,7 @@ vec4 raycastDRR(in vec3 entryPoint, in vec3 exitPoint) {
vec3 samplePosition = entryPoint.rgb + t * direction;
// lookup intensity and TF
float intensity = getElement3DNormalized(_volume, _volumeTextureParams, samplePosition).r;
float intensity = texture(_volume, samplePosition).r;
vec4 color = lookupTF(_transferFunction, _transferFunctionParams, intensity);
#ifdef DEPTH_MAPPING
......@@ -130,8 +130,8 @@ vec4 raycastDRR(in vec3 entryPoint, in vec3 exitPoint) {
***/
void main() {
vec2 p = gl_FragCoord.xy * _viewportSizeRCP;
vec3 frontPos = getElement2DNormalized(_entryPoints, _entryParams, p).rgb;
vec3 backPos = getElement2DNormalized(_exitPoints, _exitParams, p).rgb;
vec3 frontPos = texture(_entryPoints, p).rgb;
vec3 backPos = texture(_exitPoints, p).rgb;
//determine whether the ray has to be casted
if (frontPos == backPos) {
......
......@@ -57,7 +57,7 @@ void main() {
float fragDepth = gl_FragCoord.z;
if (_integrateGeometry) {
float geometryDepth = getElement2DNormalized(_geometryDepthTexture, _geometryDepthTexParams, fragCoordNormalized).r;
float geometryDepth = texture(_geometryDepthTexture, fragCoordNormalized).r;
if (_isEntrypoint) {
// integrating geometry into Entrypoints
......@@ -76,7 +76,7 @@ void main() {
}
else {
// integrating geometry into Exitpoints
float entryDepth = getElement2DNormalized(_entryDepthTexture, _entryDepthTexParams, fragCoordNormalized).r;
float entryDepth = texture(_entryDepthTexture, fragCoordNormalized).r;
float exitDepth = gl_FragCoord.z;
if (geometryDepth <= entryDepth) {
......
......@@ -153,7 +153,7 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
}
// lookup intensity and TF
float intensity = getElement3DNormalized(_volume, _volumeTextureParams, samplePosition).r;
float intensity = texture(_volume, samplePosition).r;
vec4 color = lookupTF(_transferFunction, _transferFunctionParams, intensity);
#ifdef INTERSECTION_REFINEMENT
......@@ -172,7 +172,7 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
vec3 newSamplePosition = entryPoint.rgb + newT * direction;
// lookup refined intensity + TF
float newIntensity = getElement3DNormalized(_volume, _volumeTextureParams, newSamplePosition).r;
float newIntensity = texture(_volume, newSamplePosition).r;
vec4 newColor = lookupTF(_transferFunction, _transferFunctionParams, newIntensity);
if (newColor.a <= 0.0) {
......@@ -225,8 +225,8 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
// calculate depth value from ray parameter
gl_FragDepth = 1.0;
if (firstHitT >= 0.0) {
float depthEntry = getElement2DNormalized(_entryPointsDepth, _entryParams, texCoords).z;
float depthExit = getElement2DNormalized(_exitPointsDepth, _exitParams, texCoords).z;
float depthEntry = texture(_entryPointsDepth, texCoords).z;
float depthExit = texture(_exitPointsDepth, texCoords).z;
gl_FragDepth = calculateDepthValue(firstHitT/tend, depthEntry, depthExit);
}
......@@ -238,8 +238,8 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
***/
void main() {
vec2 p = gl_FragCoord.xy * _viewportSizeRCP;
vec3 frontPos = getElement2DNormalized(_entryPoints, _entryParams, p).rgb;
vec3 backPos = getElement2DNormalized(_exitPoints, _exitParams, p).rgb;
vec3 frontPos = texture(_entryPoints, p).rgb;
vec3 backPos = texture(_exitPoints, p).rgb;
//determine whether the ray has to be casted
if (frontPos == backPos) {
......
......@@ -37,6 +37,6 @@ uniform sampler2D _depthTexture;
uniform TextureParameters2D _texParams;
void main() {
out_Color = getElement2DNormalized(_colorTexture, _texParams, ex_TexCoord.xy);
gl_FragDepth = getElement2DNormalized(_depthTexture, _texParams, ex_TexCoord.xy).r;
out_Color = texture(_colorTexture, ex_TexCoord.xy);
gl_FragDepth = texture(_depthTexture, ex_TexCoord.xy).r;
}
......@@ -47,45 +47,45 @@ uniform float _alpha;
void main() {
if (_compositingMethod == 0) {
// only first
out_Color = getElement2DNormalized(_firstColor, _firstTexParams, ex_TexCoord.xy);
gl_FragDepth = getElement2DNormalized(_firstDepth, _firstTexParams, ex_TexCoord.xy).r;
out_Color = texture(_firstColor, ex_TexCoord.xy);
gl_FragDepth = texture(_firstDepth, ex_TexCoord.xy).r;
}
else if (_compositingMethod == 1) {
// only second
out_Color = getElement2DNormalized(_secondColor, _secondTexParams, ex_TexCoord.xy);
gl_FragDepth = getElement2DNormalized(_secondDepth, _secondTexParams, ex_TexCoord.xy).r;
out_Color = texture(_secondColor, ex_TexCoord.xy);
gl_FragDepth = texture(_secondDepth, ex_TexCoord.xy).r;
}
else if (_compositingMethod == 2) {
// alpha blending
vec4 firstColor = getElement2DNormalized(_firstColor, _firstTexParams, ex_TexCoord.xy);
float firstDepth = getElement2DNormalized(_firstDepth, _firstTexParams, ex_TexCoord.xy).r;
vec4 secondColor = getElement2DNormalized(_secondColor, _secondTexParams, ex_TexCoord.xy);
float secondDepth = getElement2DNormalized(_secondDepth, _secondTexParams, ex_TexCoord.xy).r;
vec4 firstColor = texture(_firstColor, ex_TexCoord.xy);
float firstDepth = texture(_firstDepth, ex_TexCoord.xy).r;
vec4 secondColor = texture(_secondColor, ex_TexCoord.xy);
float secondDepth = texture(_secondDepth, ex_TexCoord.xy).r;
out_Color = mix(firstColor, secondColor, _alpha);
gl_FragDepth = min(firstDepth, secondDepth);
}
else if (_compositingMethod == 3) {
// difference
vec4 firstColor = getElement2DNormalized(_firstColor, _firstTexParams, ex_TexCoord.xy);
float firstDepth = getElement2DNormalized(_firstDepth, _firstTexParams, ex_TexCoord.xy).r;
vec4 secondColor = getElement2DNormalized(_secondColor, _secondTexParams, ex_TexCoord.xy);
float secondDepth = getElement2DNormalized(_secondDepth, _secondTexParams, ex_TexCoord.xy).r;
vec4 firstColor = texture(_firstColor, ex_TexCoord.xy);
float firstDepth = texture(_firstDepth, ex_TexCoord.xy).r;
vec4 secondColor = texture(_secondColor, ex_TexCoord.xy);
float secondDepth = texture(_secondDepth, ex_TexCoord.xy).r;
out_Color = vec4(vec3(1.0) - abs(firstColor - secondColor).xyz, max(firstColor.w, secondColor.w));
gl_FragDepth = min(firstDepth, secondDepth);
}
else if (_compositingMethod == 4) {
// depth test
float firstDepth = getElement2DNormalized(_firstDepth, _firstTexParams, ex_TexCoord.xy).r;
float secondDepth = getElement2DNormalized(_secondDepth, _secondTexParams, ex_TexCoord.xy).r;
float firstDepth = texture(_firstDepth, ex_TexCoord.xy).r;
float secondDepth = texture(_secondDepth, ex_TexCoord.xy).r;
if (firstDepth > secondDepth) {
out_Color = getElement2DNormalized(_secondColor, _secondTexParams, ex_TexCoord.xy);
out_Color = texture(_secondColor, ex_TexCoord.xy);
gl_FragDepth = secondDepth;
}
else {
out_Color = getElement2DNormalized(_firstColor, _firstTexParams, ex_TexCoord.xy);
out_Color = texture(_firstColor, ex_TexCoord.xy);
gl_FragDepth = firstDepth;
}
}
......
......@@ -93,7 +93,7 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
vec3 samplePosition = entryPoint.rgb + t * direction;
// lookup intensity and TF
float intensity = getElement3DNormalized(_volume, _volumeTextureParams, samplePosition).r;
float intensity = texture(_volume, samplePosition).r;
vec4 color = lookupTF(_transferFunction, _transferFunctionParams, intensity);
#ifdef ENABLE_SHADOWING
......@@ -109,7 +109,7 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
// traverse ray from sample to light
while (! finished) {
// grab intensity and TF opacity
intensity = getElement3DNormalized(_volume, _volumeTextureParams, position).r;
intensity = texture(_volume, position).r;
shadowFactor += lookupTF(_transferFunction, _transferFunctionParams, intensity).a;
position += L;
......@@ -156,8 +156,8 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
// calculate depth value from ray parameter
gl_FragDepth = 1.0;
if (firstHitT >= 0.0) {
float depthEntry = getElement2DNormalized(_entryPointsDepth, _entryParams, texCoords).z;
float depthExit = getElement2DNormalized(_exitPointsDepth, _exitParams, texCoords).z;
float depthEntry = texture(_entryPointsDepth, texCoords).z;
float depthExit = texture(_exitPointsDepth, texCoords).z;
gl_FragDepth = calculateDepthValue(firstHitT/tend, depthEntry, depthExit);
}
return result;
......@@ -168,8 +168,8 @@ vec4 performRaycasting(in vec3 entryPoint, in vec3 exitPoint, in vec2 texCoords)
***/
void main() {
vec2 p = gl_FragCoord.xy * _viewportSizeRCP;
vec3 frontPos = getElement2DNormalized(_entryPoints, _entryParams, p).rgb;
vec3 backPos = getElement2DNormalized(_exitPoints, _exitParams, p).rgb;
vec3 frontPos = texture(_entryPoints, p).rgb;
vec3 backPos = texture(_exitPoints, p).rgb;
//determine whether the ray has to be casted
if (frontPos == backPos) {
......
......@@ -47,7 +47,7 @@ uniform vec4 _color;
void main() {
if (_useTexturing) {
vec4 texel = getElement3DNormalized(_texture, _textureParams, (_texCoordsMatrix * vec4(ex_TexCoord, 1.0)).xyz);
vec4 texel = texture(_texture, (_texCoordsMatrix * vec4(ex_TexCoord, 1.0)).xyz);
if (_textureParams._numChannels == 1) {
out_Color = lookupTF(_transferFunction, _transferFunctionParams, texel.r);
......
......@@ -40,7 +40,7 @@ uniform sampler1D _transferFunction;
uniform TFParameters1D _transferFunctionParams;
void main() {
float intensity = getElement3DNormalized(_texture, _textureParams, ex_TexCoord).r;
float intensity = texture(_texture, ex_TexCoord).r;
out_Color = lookupTF(_transferFunction, _transferFunctionParams, intensity);
// don't write fragment if fully transparent (in particular don't write to depth buffer!)
......
......@@ -45,16 +45,16 @@ uniform sampler2D _mirrorRenderedDepth;
uniform TextureParameters2D _mirrorRenderedTexParams;
void main() {
float normalDepth = getElement2DNormalized(_normalDepth, _normalTexParams, ex_TexCoord.xy).r;
float mirrorRenderedDepth = getElement2DNormalized(_mirrorRenderedDepth, _mirrorRenderedTexParams, ex_TexCoord.xy).r;
float normalDepth = texture(_normalDepth, ex_TexCoord.xy).r;
float mirrorRenderedDepth = texture(_mirrorRenderedDepth, ex_TexCoord.xy).r;
if (normalDepth <= mirrorRenderedDepth) {
out_Color = getElement2DNormalized(_normalColor, _normalTexParams, ex_TexCoord.xy);
out_Color = texture(_normalColor, ex_TexCoord.xy);
gl_FragDepth = normalDepth;
}
else {
out_Color = getElement2DNormalized(_mirrorColor, _mirrorTexParams, ex_TexCoord.xy);
gl_FragDepth = getElement2DNormalized(_mirrorDepth, _mirrorTexParams, ex_TexCoord.xy).r;
out_Color = texture(_mirrorColor, ex_TexCoord.xy);
gl_FragDepth = texture(_mirrorDepth, ex_TexCoord.xy).r;
}
if (out_Color.a == 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment