public void ResetToDefault() { scatteringDistance = Color.grey; transmissionTint = Color.white; texturingMode = TexturingMode.PreAndPostScatter; transmissionMode = TransmissionMode.ThinObject; thicknessRemap = new Vector2(0f, 5f); worldScale = 1f; ior = 1.4f; // Typical value for skin specular reflectance }
// Here we need to have one parameter in the diffusion profile parameter because the deserialization call the default constructor public DiffusionProfile(bool dontUseDefaultConstructor) { scatteringDistance = Color.grey; transmissionTint = Color.white; texturingMode = TexturingMode.PreAndPostScatter; transmissionMode = TransmissionMode.ThinObject; thicknessRemap = new Vector2(0f, 5f); worldScale = 1f; ior = 1.4f; // Typical value for skin specular reflectance }
public DiffusionProfile(string name) { this.name = name; scatteringDistance = Color.grey; transmissionTint = Color.white; texturingMode = TexturingMode.PreAndPostScatter; transmissionMode = TransmissionMode.ThinObject; thicknessRemap = new Vector2(0f, 5f); worldScale = 1f; ior = 1.4f; // TYpical value for skin specular reflectance }
// --- Public Methods --- public SubsurfaceScatteringProfile() { stdDev1 = new Color(0.3f, 0.3f, 0.3f, 0.0f); stdDev2 = new Color(0.6f, 0.6f, 0.6f, 0.0f); lerpWeight = 0.5f; texturingMode = TexturingMode.PreAndPostScatter; enableTransmission = false; thicknessRemap = new Vector2(0, 1); settingsIndex = SubsurfaceScatteringSettings.neutralProfileID; // Updated by SubsurfaceScatteringSettings.OnValidate() once assigned UpdateKernelAndVarianceData(); }
// --- Public Methods --- public SubsurfaceScatteringSettings() { numProfiles = 1; texturingMode = 0; profiles = new SubsurfaceScatteringProfile[numProfiles]; for (int i = 0; i < numProfiles; i++) { profiles[i] = new SubsurfaceScatteringProfile(); } OnValidate(); }
// <<< Old SSS Model // --- Public Methods --- public SubsurfaceScatteringProfile() { scatteringDistance = Color.grey; transmissionTint = Color.white; texturingMode = TexturingMode.PreAndPostScatter; transmissionMode = TransmissionMode.None; thicknessRemap = new Vector2(0.0f, 5.0f); worldScale = 1.0f; settingsIndex = SssConstants.SSS_NEUTRAL_PROFILE_ID; // Updated by SubsurfaceScatteringSettings.OnValidate() once assigned // Old SSS Model >>> scatterDistance1 = new Color(0.3f, 0.3f, 0.3f, 0.0f); scatterDistance2 = new Color(0.5f, 0.5f, 0.5f, 0.0f); lerpWeight = 1.0f; // <<< Old SSS Model BuildKernel(); }
public SubsurfaceScatteringProfile(string name) { this.name = name; scatteringDistance = Color.grey; transmissionTint = Color.white; texturingMode = TexturingMode.PreAndPostScatter; transmissionMode = TransmissionMode.None; thicknessRemap = new Vector2(0f, 5f); worldScale = 1f; // Old SSS Model >>> scatterDistance1 = new Color(0.3f, 0.3f, 0.3f, 0f); scatterDistance2 = new Color(0.5f, 0.5f, 0.5f, 0f); lerpWeight = 1f; // <<< Old SSS Model }
public DiffusionProfile(string name) { this.name = name; scatteringDistance = Color.grey; transmissionTint = Color.white; texturingMode = TexturingMode.PreAndPostScatter; transmissionMode = TransmissionMode.ThinObject; thicknessRemap = new Vector2(0f, 5f); worldScale = 1f; ior = 1.4f; // TYpical value for skin specular reflectance // Old SSS Model >>> scatterDistance1 = new Color(0.3f, 0.3f, 0.3f, 0f); scatterDistance2 = new Color(0.5f, 0.5f, 0.5f, 0f); lerpWeight = 1f; // <<< Old SSS Model }
public void OnValidate() { if (profiles.Length > maxNumProfiles) { Array.Resize(ref profiles, maxNumProfiles); } numProfiles = profiles.Length; texturingMode = (TexturingMode)Math.Max(0, Math.Min((int)texturingMode, (int)TexturingMode.MaxValue)); if (thicknessRemaps == null) { thicknessRemaps = new float[maxNumProfiles * 2]; } if (halfRcpVariancesAndLerpWeights == null) { halfRcpVariancesAndLerpWeights = new Vector4[maxNumProfiles * 2]; } if (halfRcpWeightedVariances == null) { halfRcpWeightedVariances = new Vector4[maxNumProfiles]; } if (filterKernels == null || filterKernels.Length != (maxNumProfiles * SubsurfaceScatteringProfile.numSamples)) { filterKernels = new Vector4[maxNumProfiles * SubsurfaceScatteringProfile.numSamples]; } transmissionFlags = 0; Color c = new Color(); for (int i = 0; i < numProfiles; i++) { transmissionFlags |= (profiles[i].enableTransmission ? 1 : 0) << i; c.r = Mathf.Clamp(profiles[i].stdDev1.r, 0.05f, 2.0f); c.g = Mathf.Clamp(profiles[i].stdDev1.g, 0.05f, 2.0f); c.b = Mathf.Clamp(profiles[i].stdDev1.b, 0.05f, 2.0f); c.a = 0.0f; profiles[i].stdDev1 = c; c.r = Mathf.Clamp(profiles[i].stdDev2.r, 0.05f, 2.0f); c.g = Mathf.Clamp(profiles[i].stdDev2.g, 0.05f, 2.0f); c.b = Mathf.Clamp(profiles[i].stdDev2.b, 0.05f, 2.0f); c.a = 0.0f; profiles[i].stdDev2 = c; profiles[i].lerpWeight = Mathf.Clamp01(profiles[i].lerpWeight); profiles[i].thicknessRemap.x = Mathf.Clamp(profiles[i].thicknessRemap.x, 0, profiles[i].thicknessRemap.y); profiles[i].thicknessRemap.y = Mathf.Max(profiles[i].thicknessRemap.x, profiles[i].thicknessRemap.y); profiles[i].UpdateKernelAndVarianceData(); } // Use the updated data to fill the cache. for (int i = 0; i < numProfiles; i++) { thicknessRemaps[2 * i] = profiles[i].thicknessRemap.x; thicknessRemaps[2 * i + 1] = profiles[i].thicknessRemap.y - profiles[i].thicknessRemap.x; halfRcpVariancesAndLerpWeights[2 * i] = profiles[i].halfRcpVariances[0]; halfRcpVariancesAndLerpWeights[2 * i].w = 1.0f - profiles[i].lerpWeight; halfRcpVariancesAndLerpWeights[2 * i + 1] = profiles[i].halfRcpVariances[1]; halfRcpVariancesAndLerpWeights[2 * i + 1].w = profiles[i].lerpWeight; halfRcpWeightedVariances[i] = profiles[i].halfRcpWeightedVariances; for (int j = 0, n = SubsurfaceScatteringProfile.numSamples; j < n; j++) { filterKernels[n * i + j] = profiles[i].filterKernel[j]; } } }
/// <summary> /// Clone Constructor /// </summary> /// <param name="lbTerrainTexture"></param> public LBTerrainTexture(LBTerrainTexture lbTerrainTexture) { this.texture = lbTerrainTexture.texture; this.normalMap = lbTerrainTexture.normalMap; this.heightMap = lbTerrainTexture.heightMap; if (lbTerrainTexture.textureName == null) { this.textureName = string.Empty; } else { this.textureName = lbTerrainTexture.textureName; } if (lbTerrainTexture.normalMapName == null) { this.normalMapName = string.Empty; } else { this.normalMapName = lbTerrainTexture.normalMapName; } this.tileSize = lbTerrainTexture.tileSize; this.smoothness = lbTerrainTexture.smoothness; this.metallic = lbTerrainTexture.metallic; this.minHeight = lbTerrainTexture.minHeight; this.maxHeight = lbTerrainTexture.maxHeight; this.minInclination = lbTerrainTexture.minInclination; this.maxInclination = lbTerrainTexture.maxInclination; this.strength = lbTerrainTexture.strength; this.texturingMode = lbTerrainTexture.texturingMode; this.isCurvatureConcave = lbTerrainTexture.isCurvatureConcave; this.curvatureDistance = lbTerrainTexture.curvatureDistance; this.curvatureMinHeightDiff = lbTerrainTexture.curvatureMinHeightDiff; this.map = lbTerrainTexture.map; this.mapColour = lbTerrainTexture.mapColour; this.isDisabled = lbTerrainTexture.isDisabled; this.mapTolerance = lbTerrainTexture.mapTolerance; this.useNoise = lbTerrainTexture.useNoise; this.noiseTileSize = lbTerrainTexture.noiseTileSize; this.isMinimalBlendingEnabled = lbTerrainTexture.isMinimalBlendingEnabled; this.mapInverse = lbTerrainTexture.mapInverse; this.useAdvancedMapTolerance = lbTerrainTexture.useAdvancedMapTolerance; this.mapToleranceRed = lbTerrainTexture.mapToleranceRed; this.mapToleranceGreen = lbTerrainTexture.mapToleranceGreen; this.mapToleranceBlue = lbTerrainTexture.mapToleranceBlue; this.mapToleranceAlpha = lbTerrainTexture.mapToleranceAlpha; this.mapWeightRed = lbTerrainTexture.mapWeightRed; this.mapWeightGreen = lbTerrainTexture.mapWeightGreen; this.mapWeightBlue = lbTerrainTexture.mapWeightBlue; this.mapWeightAlpha = lbTerrainTexture.mapWeightAlpha; this.mapToleranceBlendCurvePreset = lbTerrainTexture.mapToleranceBlendCurvePreset; this.mapToleranceBlendCurve = lbTerrainTexture.mapToleranceBlendCurve; this.mapIsPath = lbTerrainTexture.mapIsPath; this.isTinted = lbTerrainTexture.isTinted; this.tintColour = lbTerrainTexture.tintColour; this.tintStrength = lbTerrainTexture.tintStrength; this.tintedTexture = lbTerrainTexture.tintedTexture; this.isRotated = lbTerrainTexture.isRotated; this.rotationAngle = lbTerrainTexture.rotationAngle; this.rotatedTexture = lbTerrainTexture.rotatedTexture; this.showTexture = lbTerrainTexture.showTexture; this.noiseOffset = lbTerrainTexture.noiseOffset; if (lbTerrainTexture.filterList != null) { this.filterList = new List <LBTextureFilter>(lbTerrainTexture.filterList); } else { this.filterList = new List <LBTextureFilter>(); } if (lbTerrainTexture.lbTerrainDataList == null) { this.lbTerrainDataList = null; } else { this.lbTerrainDataList = new List <LBTerrainData>(lbTerrainTexture.lbTerrainDataList); } lbTerrainTexture.blendCurveMode = BlendCurveMode.Auto; this.GUID = lbTerrainTexture.GUID; }
// Class constructor public LBTerrainTexture() { this.texture = null; this.normalMap = null; this.heightMap = null; this.tileSize = Vector2.one * 25f; this.smoothness = 0f; this.metallic = 0f; this.minHeight = 0.25f; this.maxHeight = 0.75f; this.minInclination = 0f; this.maxInclination = 30f; this.strength = 1f; // v2.0.6 Beta 5a changed default from Height to ConstantInfluence this.texturingMode = TexturingMode.ConstantInfluence; // Added v2.0.7 Beta 6 this.isCurvatureConcave = false; this.curvatureMinHeightDiff = 1f; this.curvatureDistance = 5f; // Added v1.4.2 Beta 5b this.textureName = string.Empty; this.normalMapName = string.Empty; // Added v1.1 Beta 4-9 this.map = null; this.mapColour = UnityEngine.Color.red; this.isDisabled = false; this.mapTolerance = 1; this.useNoise = true; this.noiseTileSize = 100f; // Added v1.2 Beta 3 this.isMinimalBlendingEnabled = false; // Added v1.2 Beta 12 this.mapInverse = false; // Added v1.3.1 Beta 8f this.useAdvancedMapTolerance = false; this.mapToleranceRed = 0; this.mapToleranceGreen = 0; this.mapToleranceBlue = 0; this.mapToleranceAlpha = 0; this.mapWeightRed = 1f; this.mapWeightGreen = 1f; this.mapWeightBlue = 1f; this.mapWeightAlpha = 1f; this.mapToleranceBlendCurvePreset = (LBCurve.BlendCurvePreset)LBCurve.CurvePreset.Cubed; this.mapToleranceBlendCurve = LBCurve.SetCurveFromPreset((LBCurve.CurvePreset) this.mapToleranceBlendCurvePreset); // Added 1.3.2 Beta 5h this.mapIsPath = false; // Added 1.3.2 Beta 2e this.isTinted = false; this.tintColour = UnityEngine.Color.clear; this.tintStrength = 0.5f; this.tintedTexture = null; // Added 1.3.2 Beta 7c this.isRotated = false; this.rotationAngle = 0f; this.rotatedTexture = null; // Added v1.3.0 Beta 3a this.showTexture = true; // Added v1.4.2 Beta 4a this.lbTerrainDataList = null; // Noise offset cannot be modified from the editor as it is randomly set when the terrain is textured // Added v2.0.0 // Assign a unique identifier GUID = System.Guid.NewGuid().ToString(); // Added v2.2.4 blendCurveMode = BlendCurveMode.BlendMinMaxValues; }