diff options
Diffstat (limited to 'Studio/Content/Material Library/carpaint_yellow_standard.shader')
-rw-r--r-- | Studio/Content/Material Library/carpaint_yellow_standard.shader | 231 |
1 files changed, 231 insertions, 0 deletions
diff --git a/Studio/Content/Material Library/carpaint_yellow_standard.shader b/Studio/Content/Material Library/carpaint_yellow_standard.shader new file mode 100644 index 0000000..7e79511 --- /dev/null +++ b/Studio/Content/Material Library/carpaint_yellow_standard.shader @@ -0,0 +1,231 @@ +<Material name="carpaint_yellow_standard" version="1.0"> + <MetaData > + <Property formalName="Environment Map" name="uEnvironmentTexture" description="Environment texture for the material" type="Texture" filter="linear" minfilter="linearMipmapLinear" clamp="repeat" usage="environment" default="./maps/materials/spherical_checker.png" category="Material"/> + <Property formalName="Enable Environment" name="uEnvironmentMappingEnabled" description="Enable environment mapping" type="Boolean" default="True" category="Material"/> + <Property formalName="Baked Shadow Map" name="uBakedShadowTexture" description="Baked shadow texture for the material" type="Texture" filter="linear" minfilter="linearMipmapLinear" clamp="repeat" usage="shadow" default="./maps/materials/shadow.png" category="Material"/> + <Property formalName="Shadow Mapping" name="uShadowMappingEnabled" description="Enable shadow mapping" type="Boolean" default="False" category="Material"/> + <Property formalName="Gradient1D Map" description="Gradient texture of the material" hidden="True" name="randomGradient1D" type="Texture" filter="linear" minfilter="linearMipmapLinear" clamp="repeat" usage="gradient" default="./maps/materials/randomGradient1D.png"/> + <Property formalName="Gradient2D Map" description="Gradient texture of the material" hidden="True" name="randomGradient2D" type="Texture" filter="linear" minfilter="linearMipmapLinear" clamp="repeat" usage="gradient" default="./maps/materials/randomGradient2D.png"/> + <Property formalName="Gradient3D Map" description="Gradient texture of the material" hidden="True" name="randomGradient3D" type="Texture" filter="linear" minfilter="linearMipmapLinear" clamp="repeat" usage="gradient" default="./maps/materials/randomGradient3D.png"/> + <Property formalName="Gradient4D Map" description="Gradient texture of the material" hidden="True" name="randomGradient4D" type="Texture" filter="linear" minfilter="linearMipmapLinear" clamp="repeat" usage="gradient" default="./maps/materials/randomGradient4D.png"/> + <Property formalName="Unit Conversion Factor" name="unit_conversion" description="Unit conversion factor" type="Float" default="1.000000" category="Other"/> + <Property formalName="Normal Base Color" name="normal_base_color" description="Base color of the material" type="Color" default="0.659 0.4261 0.0494" category="Material"/> + <Property formalName="Grazing Base Color" name="grazing_base_color" description="Grazing base color of the material" type="Color" default="0.393 0.2654 0.0549" category="Material"/> + <Property formalName="Orange Peel Amount" name="peel_amount" description="Orange peel bumpiness of the material" type="Float" default="0.100000" category="Material"/> + <Property formalName="Orange Peel Size" name="peel_size" description="Orange peel bump size" type="Float" default="0.100000" category="Material"/> + </MetaData> + <Shaders type="GLSL" version="330"> + <Shader> + <Shared> </Shared> +<VertexShader> + </VertexShader> + <FragmentShader> + +// add enum defines +#define texture_coordinate_uvw 0 +#define texture_coordinate_world 1 +#define texture_coordinate_object 2 +#define scatter_reflect 0 +#define scatter_transmit 1 +#define scatter_reflect_transmit 2 + +#define QT3DS_ENABLE_UV0 1 +#define QT3DS_ENABLE_WORLD_POSITION 1 +#define QT3DS_ENABLE_TEXTAN 1 +#define QT3DS_ENABLE_BINORMAL 1 + +#include "vertexFragmentBase.glsllib" + +// set shader output +out vec4 fragColor; + +// add structure defines +struct layer_result +{ + vec4 base; + vec4 layer; + mat3 tanFrame; +}; + + +struct texture_coordinate_info +{ + vec3 position; + vec3 tangent_u; + vec3 tangent_v; +}; + + +struct texture_return +{ + vec3 tint; + float mono; +}; + + +// temporary declarations +texture_coordinate_info tmp2; +vec3 ftmp0; +float ftmp1; + vec4 tmpShadowTerm; + +layer_result layers[2]; + +#include "SSAOCustomMaterial.glsllib" +#include "sampleLight.glsllib" +#include "sampleProbe.glsllib" +#include "sampleArea.glsllib" +#include "cube.glsllib" +#include "random255.glsllib" +#include "perlinNoise.glsllib" +#include "perlinNoiseBumpTexture.glsllib" +#include "coordinateSource.glsllib" +#include "square.glsllib" +#include "calculateRoughness.glsllib" +#include "evalBakedShadowMap.glsllib" +#include "evalEnvironmentMap.glsllib" +#include "luminance.glsllib" +#include "microfacetBSDF.glsllib" +#include "physGlossyBSDF.glsllib" +#include "simpleGlossyBSDF.glsllib" +#include "weightedLayer.glsllib" +#include "miNoise.glsllib" +#include "flakeNoiseTexture.glsllib" +#include "directionalFactor.glsllib" +#include "diffuseReflectionBSDF.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 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * microfacetBSDF( layers[0].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, 0.000000, 0.000000, scatter_reflect ); + + layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color.rgb, grazing_base_color.rgb, 5.000000, diffuseReflectionBSDF( normal, lightDir, viewDir, lightDiffuse, 0.000000 ) ); + layers[1].layer += tmpShadowTerm * microfacetBSDF( layers[1].tanFrame, lightDir, viewDir, lightSpecular, materialIOR, 0.200000, 0.200000, scatter_reflect ); + +#endif +} + +void computeFrontAreaColor( in int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_ENABLE_CG_LIGHTING + layers[0].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[0].tanFrame, varWorldPos, lightIdx, viewDir, 0.000000, 0.000000 ); + + layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color.rgb, grazing_base_color.rgb, 5.000000, lightDiffuse * sampleAreaDiffuse( layers[1].tanFrame, varWorldPos, lightIdx ) ); + layers[1].layer += tmpShadowTerm * lightSpecular * sampleAreaGlossy( layers[1].tanFrame, varWorldPos, lightIdx, viewDir, 0.200000, 0.200000 ); + +#endif +} + +void computeFrontLayerEnvironment( in vec3 normal, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_ENABLE_LIGHT_PROBE + layers[0].layer += tmpShadowTerm * microfacetSampledBSDF( layers[0].tanFrame, viewDir, 0.000000, 0.000000, scatter_reflect ); + + layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color.rgb, grazing_base_color.rgb, 5.000000, diffuseReflectionBSDFEnvironment( normal, 0.000000 ) * aoFactor ); + layers[1].layer += tmpShadowTerm * microfacetSampledBSDF( layers[1].tanFrame, viewDir, 0.200000, 0.200000, scatter_reflect ); + +#else + layers[0].layer += tmpShadowTerm * sampleGlossyAniso( layers[0].tanFrame, viewDir, 0.000000, 0.000000 ); + + layers[1].base += tmpShadowTerm * directionalFactor( normal, viewDir, normal_base_color.rgb, grazing_base_color.rgb, 5.000000, sampleDiffuse( layers[1].tanFrame ) * aoFactor ); + layers[1].layer += tmpShadowTerm * sampleGlossyAniso( layers[1].tanFrame, viewDir, 0.200000, 0.200000 ); + +#endif +} + +vec3 computeBackMaterialEmissive() +{ + return( vec3(0, 0, 0) ); +} + +void computeBackLayerColor( in vec3 normal, in vec3 lightDir, in vec3 viewDir, in vec3 lightDiffuse, in vec3 lightSpecular, in float materialIOR, float aoFactor ) +{ +#if QT3DS_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 int lightIdx, in vec4 lightDiffuse, in vec4 lightSpecular ) +{ +#if QT3DS_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, in vec3 viewDir, float aoFactor ) +{ +#if !QT3DS_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.0 : luminance( vec3( 1, 1, 1 ) ) ); +} + +float evalCutout() +{ + return( 1.000000 ); +} + +vec3 computeNormal() +{ + return( normal ); +} + +void computeTemporaries() +{ + tmp2 = coordinateSource(texture_coordinate_object, 0 ); + ftmp0 = perlinNoiseBumpTexture( tmp2, ( peel_amount/10.000000 ), ( peel_size*unit_conversion ), false, false, 0.000000, 1, false, vec3( 0.000000, 0.000000, 0.000000 ), 1.000000, 0.000000, 1.000000, normal ); + ftmp1 = flakeNoiseTexture(tmp2, 0.000000, ( unit_conversion*0.002000 ), 0.350000 ).mono; + tmpShadowTerm = evalBakedShadowMap( texCoord0 ); +} + +vec4 computeLayerWeights( in float alpha ) +{ + vec4 color; + color = weightedLayer( ftmp1, vec4( vec3( 1, 0.117, 0.087 ), 1.0).rgb, layers[1].layer, layers[1].base * vec4( vec3( 1, 1, 1 ), 1.0), alpha ); + color = fresnelLayer( ftmp0, vec3( 1.5, 1.5, 1.5 ), 1.000000, vec4( vec3( 1, 1, 1 ), 1.0).rgb, layers[0].layer, color, color.a ); + return color; +} + + +void initializeLayerVariables(void) +{ + // 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(ftmp0, tangent), ftmp0 ) ); + layers[1].base = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].layer = vec4(0.0, 0.0, 0.0, 1.0); + layers[1].tanFrame = orthoNormalize( mat3( tangent, cross(normal, tangent), normal ) ); +} + + </FragmentShader> + </Shader> + </Shaders> +<Passes > + <ShaderKey value="5"/> + <LayerKey count="2"/> + <Pass > + </Pass> +</Passes> +</Material> |