Am Lightning System gearbeitet
This commit is contained in:
336
Common/MatDefs/Light/PBRLighting.j3md
Normal file
336
Common/MatDefs/Light/PBRLighting.j3md
Normal file
@@ -0,0 +1,336 @@
|
||||
MaterialDef PBR Lighting {
|
||||
|
||||
MaterialParameters {
|
||||
Int BoundDrawBuffer
|
||||
|
||||
// Alpha threshold for fragment discarding
|
||||
Float AlphaDiscardThreshold (AlphaTestFallOff)
|
||||
|
||||
//metallicity of the material
|
||||
Float Metallic : 1.0
|
||||
//Roughness of the material
|
||||
Float Roughness : 1.0
|
||||
// Base material color
|
||||
Color BaseColor : 1.0 1.0 1.0 1.0
|
||||
// The emissive color of the object
|
||||
Color Emissive
|
||||
// the emissive power
|
||||
Float EmissivePower : 3.0
|
||||
// the emissive intensity
|
||||
Float EmissiveIntensity : 2.0
|
||||
|
||||
// BaseColor map
|
||||
Texture2D BaseColorMap
|
||||
|
||||
// Metallic map
|
||||
Texture2D MetallicMap -LINEAR
|
||||
|
||||
// Roughness Map
|
||||
Texture2D RoughnessMap -LINEAR
|
||||
|
||||
//Metallic and Roughness are packed respectively in the b and g channel of a single map
|
||||
// r: AO (if AoPackedInMRMap is true)
|
||||
// g: Roughness
|
||||
// b: Metallic
|
||||
Texture2D MetallicRoughnessMap -LINEAR
|
||||
|
||||
// Texture of the emissive parts of the material
|
||||
Texture2D EmissiveMap
|
||||
|
||||
// Normal map
|
||||
Texture2D NormalMap -LINEAR
|
||||
// The scalar parameter applied to each normal vector of the normal map
|
||||
Float NormalScale
|
||||
|
||||
//The type of normal map: -1.0 (DirectX), 1.0 (OpenGl)
|
||||
Float NormalType : -1.0
|
||||
|
||||
// For Spec gloss pipeline
|
||||
Boolean UseSpecGloss
|
||||
Texture2D SpecularMap
|
||||
Texture2D GlossinessMap
|
||||
Texture2D SpecularGlossinessMap
|
||||
Color Specular : 1.0 1.0 1.0 1.0
|
||||
Float Glossiness : 1.0
|
||||
|
||||
// Parallax/height map
|
||||
Texture2D ParallaxMap -LINEAR
|
||||
|
||||
// Specular-AA
|
||||
Boolean UseSpecularAA : true
|
||||
// screen space variance,Use the slider to set the strength of the geometric specular anti-aliasing effect between 0 and 1. Higher values produce a blurrier result with less aliasing.
|
||||
Float SpecularAASigma
|
||||
// clamping threshold,Use the slider to set a maximum value for the offset that HDRP subtracts from the smoothness value to reduce artifacts.
|
||||
Float SpecularAAKappa
|
||||
|
||||
//Set to true if parallax map is stored in the alpha channel of the normal map
|
||||
Boolean PackedNormalParallax
|
||||
|
||||
//Sets the relief height for parallax mapping
|
||||
Float ParallaxHeight : 0.05
|
||||
|
||||
//Set to true to activate Steep Parallax mapping
|
||||
Boolean SteepParallax
|
||||
|
||||
//Horizon fade
|
||||
Boolean HorizonFade
|
||||
|
||||
// Set to Use Lightmap
|
||||
Texture2D LightMap
|
||||
|
||||
// A scalar multiplier controlling the amount of occlusion applied.
|
||||
// A value of `0.0` means no occlusion. A value of `1.0` means full occlusion.
|
||||
Float AoStrength
|
||||
|
||||
// Set to use TexCoord2 for the lightmap sampling
|
||||
Boolean SeparateTexCoord
|
||||
// the light map is a grayscale ao map, only the r channel will be read.
|
||||
Boolean LightMapAsAOMap
|
||||
Boolean AoPackedInMRMap
|
||||
//shadows
|
||||
Int FilterMode
|
||||
Boolean HardwareShadows
|
||||
|
||||
Texture2D ShadowMap0
|
||||
Texture2D ShadowMap1
|
||||
Texture2D ShadowMap2
|
||||
Texture2D ShadowMap3
|
||||
//pointLights
|
||||
Texture2D ShadowMap4
|
||||
Texture2D ShadowMap5
|
||||
|
||||
Float ShadowIntensity
|
||||
Vector4 Splits
|
||||
Vector2 FadeInfo
|
||||
|
||||
Matrix4 LightViewProjectionMatrix0
|
||||
Matrix4 LightViewProjectionMatrix1
|
||||
Matrix4 LightViewProjectionMatrix2
|
||||
Matrix4 LightViewProjectionMatrix3
|
||||
//pointLight
|
||||
Matrix4 LightViewProjectionMatrix4
|
||||
Matrix4 LightViewProjectionMatrix5
|
||||
Vector3 LightPos
|
||||
Vector3 LightDir
|
||||
|
||||
Float PCFEdge
|
||||
Float ShadowMapSize
|
||||
|
||||
// For hardware skinning
|
||||
Int NumberOfBones
|
||||
Matrix4Array BoneMatrices
|
||||
|
||||
// For Morph animation
|
||||
FloatArray MorphWeights
|
||||
Int NumberOfMorphTargets
|
||||
Int NumberOfTargetsBuffers
|
||||
|
||||
// For instancing
|
||||
Boolean UseInstancing
|
||||
|
||||
// For Vertex Color
|
||||
Boolean UseVertexColor
|
||||
|
||||
Boolean BackfaceShadows : false
|
||||
|
||||
Boolean UseFog
|
||||
Color FogColor
|
||||
Vector2 LinearFog
|
||||
Float ExpFog
|
||||
Float ExpSqFog
|
||||
|
||||
Texture2D SunLightExposureMap
|
||||
Boolean UseVertexColorsAsSunIntensity
|
||||
Float StaticSunIntensity
|
||||
Boolean BrightenIndoorShadows //should be set true when shadows are enabled, in order to prevent areas with low SunExposure from being way too dark when shadows are cast
|
||||
|
||||
// debug the final value of the selected layer as a color output
|
||||
Int DebugValuesMode
|
||||
// Layers:
|
||||
// 0 - albedo (unshaded)
|
||||
// 1 - normals
|
||||
// 2 - roughness
|
||||
// 3 - metallic
|
||||
// 4 - ao
|
||||
// 5 - emissive
|
||||
// 6 - exposure
|
||||
// 7 - alpha
|
||||
// 8 - geometryNormals
|
||||
}
|
||||
|
||||
Technique {
|
||||
LightMode SinglePassAndImageBased
|
||||
|
||||
VertexShader GLSL300 GLSL150 GLSL110: Common/MatDefs/Light/PBRLighting.vert
|
||||
FragmentShader GLSL300 GLSL150 GLSL110: Common/MatDefs/Light/PBRLighting.frag
|
||||
|
||||
WorldParameters {
|
||||
WorldViewProjectionMatrix
|
||||
CameraPosition
|
||||
WorldMatrix
|
||||
WorldNormalMatrix
|
||||
ViewProjectionMatrix
|
||||
ViewMatrix
|
||||
}
|
||||
|
||||
Defines {
|
||||
BOUND_DRAW_BUFFER: BoundDrawBuffer
|
||||
BASECOLORMAP : BaseColorMap
|
||||
NORMALMAP : NormalMap
|
||||
NORMALSCALE : NormalScale
|
||||
METALLICMAP : MetallicMap
|
||||
ROUGHNESSMAP : RoughnessMap
|
||||
EMISSIVEMAP : EmissiveMap
|
||||
EMISSIVE : Emissive
|
||||
SPECGLOSSPIPELINE : UseSpecGloss
|
||||
PARALLAXMAP : ParallaxMap
|
||||
NORMALMAP_PARALLAX : PackedNormalParallax
|
||||
STEEP_PARALLAX : SteepParallax
|
||||
LIGHTMAP : LightMap
|
||||
SEPARATE_TEXCOORD : SeparateTexCoord
|
||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
||||
NUM_BONES : NumberOfBones
|
||||
INSTANCING : UseInstancing
|
||||
USE_PACKED_MR: MetallicRoughnessMap
|
||||
USE_PACKED_SG: SpecularGlossinessMap
|
||||
SPECULARMAP : SpecularMap
|
||||
SPECULAR_AA : UseSpecularAA
|
||||
SPECULAR_AA_SCREEN_SPACE_VARIANCE : SpecularAASigma
|
||||
SPECULAR_AA_THRESHOLD : SpecularAAKappa
|
||||
GLOSSINESSMAP : GlossinessMap
|
||||
NORMAL_TYPE: NormalType
|
||||
VERTEX_COLOR : UseVertexColor
|
||||
AO_MAP: LightMapAsAOMap
|
||||
AO_PACKED_IN_MR_MAP : AoPackedInMRMap
|
||||
AO_STRENGTH : AoStrength
|
||||
NUM_MORPH_TARGETS: NumberOfMorphTargets
|
||||
NUM_TARGETS_BUFFERS: NumberOfTargetsBuffers
|
||||
HORIZON_FADE: HorizonFade
|
||||
EXPOSUREMAP : SunLightExposureMap
|
||||
USE_VERTEX_COLORS_AS_SUN_INTENSITY : UseVertexColorsAsSunIntensity
|
||||
STATIC_SUN_INTENSITY : StaticSunIntensity
|
||||
BRIGHTEN_INDOOR_SHADOWS : BrightenIndoorShadows
|
||||
DEBUG_VALUES_MODE : DebugValuesMode
|
||||
USE_FOG : UseFog
|
||||
FOG_LINEAR : LinearFog
|
||||
FOG_EXP : ExpFog
|
||||
FOG_EXPSQ : ExpSqFog
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Technique PreShadow {
|
||||
|
||||
VertexShader GLSL300 GLSL150 GLSL100: Common/MatDefs/Shadow/PreShadow.vert
|
||||
FragmentShader GLSL300 GLSL150 GLSL100: Common/MatDefs/Shadow/PreShadowPBR.frag
|
||||
|
||||
WorldParameters {
|
||||
WorldViewProjectionMatrix
|
||||
WorldViewMatrix
|
||||
ViewProjectionMatrix
|
||||
ViewMatrix
|
||||
}
|
||||
|
||||
Defines {
|
||||
BOUND_DRAW_BUFFER: BoundDrawBuffer
|
||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
||||
NUM_BONES : NumberOfBones
|
||||
INSTANCING : UseInstancing
|
||||
NUM_MORPH_TARGETS: NumberOfMorphTargets
|
||||
NUM_TARGETS_BUFFERS: NumberOfTargetsBuffers
|
||||
}
|
||||
|
||||
ForcedRenderState {
|
||||
FaceCull Off
|
||||
DepthTest On
|
||||
DepthWrite On
|
||||
PolyOffset 5 3
|
||||
ColorWrite Off
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Technique PostShadow {
|
||||
VertexShader GLSL310 GLSL300 GLSL150 GLSL100: Common/MatDefs/Shadow/PostShadow.vert
|
||||
FragmentShader GLSL310 GLSL300 GLSL150 GLSL100: Common/MatDefs/Shadow/PostShadowPBR.frag
|
||||
|
||||
WorldParameters {
|
||||
WorldViewProjectionMatrix
|
||||
WorldMatrix
|
||||
ViewProjectionMatrix
|
||||
ViewMatrix
|
||||
}
|
||||
|
||||
Defines {
|
||||
BOUND_DRAW_BUFFER: BoundDrawBuffer
|
||||
HARDWARE_SHADOWS : HardwareShadows
|
||||
FILTER_MODE : FilterMode
|
||||
PCFEDGE : PCFEdge
|
||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
||||
SHADOWMAP_SIZE : ShadowMapSize
|
||||
FADE : FadeInfo
|
||||
PSSM : Splits
|
||||
POINTLIGHT : LightViewProjectionMatrix5
|
||||
NUM_BONES : NumberOfBones
|
||||
INSTANCING : UseInstancing
|
||||
BACKFACE_SHADOWS: BackfaceShadows
|
||||
NUM_MORPH_TARGETS: NumberOfMorphTargets
|
||||
NUM_TARGETS_BUFFERS: NumberOfTargetsBuffers
|
||||
}
|
||||
|
||||
ForcedRenderState {
|
||||
Blend Modulate
|
||||
DepthWrite Off
|
||||
PolyOffset -0.1 0
|
||||
}
|
||||
}
|
||||
|
||||
Technique PreNormalPass {
|
||||
|
||||
VertexShader GLSL300 GLSL150 GLSL100 : Common/MatDefs/SSAO/normal.vert
|
||||
FragmentShader GLSL300 GLSL150 GLSL100 : Common/MatDefs/SSAO/normal.frag
|
||||
|
||||
WorldParameters {
|
||||
WorldViewProjectionMatrix
|
||||
WorldViewMatrix
|
||||
NormalMatrix
|
||||
ViewProjectionMatrix
|
||||
ViewMatrix
|
||||
}
|
||||
|
||||
Defines {
|
||||
BOUND_DRAW_BUFFER: BoundDrawBuffer
|
||||
BASECOLORMAP_ALPHA : BaseColorMap
|
||||
NUM_BONES : NumberOfBones
|
||||
INSTANCING : UseInstancing
|
||||
NUM_MORPH_TARGETS: NumberOfMorphTargets
|
||||
NUM_TARGETS_BUFFERS: NumberOfTargetsBuffers
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Technique Glow {
|
||||
|
||||
VertexShader GLSL300 GLSL150 GLSL100: Common/MatDefs/Misc/Unshaded.vert
|
||||
FragmentShader GLSL300 GLSL150 GLSL100: Common/MatDefs/Light/PBRGlow.frag
|
||||
|
||||
WorldParameters {
|
||||
WorldViewProjectionMatrix
|
||||
ViewProjectionMatrix
|
||||
ViewMatrix
|
||||
}
|
||||
|
||||
Defines {
|
||||
HAS_EMISSIVEMAP : EmissiveMap
|
||||
HAS_EMISSIVECOLOR : Emissive
|
||||
BOUND_DRAW_BUFFER: BoundDrawBuffer
|
||||
NEED_TEXCOORD1
|
||||
NUM_BONES : NumberOfBones
|
||||
INSTANCING : UseInstancing
|
||||
NUM_MORPH_TARGETS: NumberOfMorphTargets
|
||||
NUM_TARGETS_BUFFERS: NumberOfTargetsBuffers
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user