SEUS v11.0 光影添加教程
代码分三部分
A:
#define Depth_of_Field
#define Max_Blur_Amount 0.6//[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0] //bigger values for more blur
#define Aperture_Blur 0.1//[0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9] //bigger values for shallower depth of field, Best left at default
--------------------------------------------------------------------------------------------------------------------------
B:
if (isEyeInWater > 0.9) {
} else {
float depth = GetDepth(texcoord.xy);
if (depth > 0.9999f) {
depth = 1.0f;
}
float cursorDepth = GetDepth(vec2(0.5f, 0.5f));
if (cursorDepth > 0.9999f) {
cursorDepth = 1.0f;
}
const float blurclamp = 0.024; // Max_Blur_Amount
const float bias = Aperture_Blur;//aperture - bigger values for shallower depth of field
bool isHand = GetMaterialMask(texcoord.st, 5);
vec2 aspectcorrect = vec2(1.0, aspectRatio) * 1.5;
//float depth = texture2D(gdepthtex, texcoord.st).x;
depth += float(isHand) * 0.36f;
float factor = (depth - cursorDepth);
vec2 dofblur = vec2(factor * bias)*Max_Blur_Amount;
--------------------------------------------------------------------------------------------------------------------------
C:
#ifdef Depth_of_Field
DepthOfField(color);
#endif