// add structure defines
#define UIC_ENABLE_UV0 1
#define UIC_ENABLE_WORLD_POSITION 1
#define UIC_ENABLE_TEXTAN 1
#define UIC_ENABLE_BINORMAL 0
#include "vertexFragmentBase.glsllib"
// add temporary declarations
void main(void)
{
gl_Position = vertexMain();
}
// add enum defines
#define scatter_reflect 0
#define scatter_transmit 1
#define scatter_reflect_transmit 2
#define UIC_ENABLE_UV0 1
#define UIC_ENABLE_WORLD_POSITION 1
#define UIC_ENABLE_TEXTAN 1
#define UIC_ENABLE_BINORMAL 0
#include "vertexFragmentBase.glsllib"
// set shader output
out vec4 fragColor;
// add structure defines
struct layer_result
{
vec4 base;
vec4 layer;
mat3 tanFrame;
};
// temporary declarations
layer_result layers[1];
#include "SSAOCustomMaterial.glsllib"
#include "sampleLight.glsllib"
#include "sampleProbe.glsllib"
#include "sampleArea.glsllib"
#include "square.glsllib"
#include "calculateRoughness.glsllib"
#include "evalEnvironmentMap.glsllib"
#include "luminance.glsllib"
#include "physGlossyBSDF.glsllib"
#include "simpleGlossyBSDF.glsllib"
#include "fresnelLayer.glsllib"
bool evalTwoSided()
{
return( false );
}
vec3 computeFrontMaterialEmissive()
{
return( vec3( 0, 0, 0 ) );
}
void computeFrontLayerColor( in vec3 normal, in vec3 lightDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor )
{
#if UIC_ENABLE_CG_LIGHTING
layers[0].base += vec4( 0.0f, 0.0f, 0.0f, 1.0f );
layers[0].layer += kggxGlossyBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, roughness, roughness, scatter_reflect );
#endif
}
void computeFrontAreaColor( in mat3 lightFrame, vec3 lightPos, in float width, in float height, in vec4 lightDiffuse, in vec4 lightSpecular )
{
#if UIC_ENABLE_CG_LIGHTING
layers[0].base += vec4( 0.0f, 0.0f, 0.0f, 1.0f );
layers[0].layer += lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightFrame, lightPos, width, height, viewDir, roughness, roughness );
#endif
}
void computeFrontLayerEnvironment( in vec3 normal, float aoFactor )
{
#if !UIC_ENABLE_LIGHT_PROBE
layers[0].base += vec4( 0.0f, 0.0f, 0.0f, 1.0f );
layers[0].layer += simpleGlossyBSDFEnvironment( layers[0].tanFrame, roughness, roughness, scatter_reflect );
#else
layers[0].base += vec4( 0.0f, 0.0f, 0.0f, 1.0f );
layers[0].layer += sampleGlossyAniso( layers[0].tanFrame, viewDir, roughness, roughness );
#endif
}
vec3 computeBackMaterialEmissive()
{
return( vec3(0, 0, 0) );
}
void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor )
{
#if UIC_ENABLE_CG_LIGHTING
layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 );
#endif
}
void computeBackAreaColor( in mat3 lightFrame, vec3 lightPos, in float width, in float height, in vec4 lightDiffuse, in vec4 lightSpecular )
{
#if UIC_ENABLE_CG_LIGHTING
layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 );
#endif
}
void computeBackLayerEnvironment( in vec3 normal, float aoFactor )
{
#if !UIC_ENABLE_LIGHT_PROBE
layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 );
#else
layers[0].base += vec4( 0.0, 0.0, 0.0, 1.0 );
layers[0].layer += vec4( 0.0, 0.0, 0.0, 1.0 );
#endif
}
float computeIOR()
{
return( false ? 1.0f : luminance( vec3( 1, 1, 1 ) ) );
}
float evalCutout()
{
return( 1.000000 );
}
vec3 computeNormal()
{
return( normal );
}
void computeTemporaries()
{
}
vec4 computeLayerWeights( in float alpha )
{
vec4 color;
color = fresnelLayer( normal, vec3( 25.65, 25.65, 25.65 ), 1.000000, vec4( metal_color, 1.0).rgb, layers[0].layer, layers[0].base, alpha );
return color;
}
void main(void)
{
initializeBaseFragmentVariables();
computeTemporaries();
normal = normalize( computeNormal() );
// clear layers
layers[0].base = vec4(0.0, 0.0, 0.0, 1.0);
layers[0].layer = vec4(0.0, 0.0, 0.0, 1.0);
layers[0].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) );
float alpha = clamp( evalCutout(), 0.0, 1.0 );
#include "customMaterialFragBodyAO.glsllib"
fragColor = rgba;
}