void DoSubsurfaceArea() { MGUI.PropertyGroup(() => { me.ShaderProperty(subsurface, "Enable"); MGUI.ToggleGroup(subsurface.floatValue == 0); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN1(); me.TexturePropertySingleLine(Tips.thicknessMapText, thicknessMap, thicknessMap.textureValue ? thicknessMapPower : null); if (thicknessMap.textureValue) { MGUI.TexPropLabel("Power", 94); } me.ShaderProperty(scatterCol, Tips.scatterCol); me.ShaderProperty(scatterAlbedoTint, Tips.scatterAlbedoTint); MGUI.Space8(); me.ShaderProperty(scatterIntensity, Tips.scatterIntensity); me.ShaderProperty(scatterAmbient, Tips.scatterAmbient); me.ShaderProperty(scatterPow, Tips.scatterPow); me.ShaderProperty(scatterDist, Tips.scatterDist); me.ShaderProperty(wrappingFactor, Tips.wrappingFactor); MGUI.SpaceN2(); }); MGUI.ToggleGroupEnd(); }); }
void DoVariantArea() { MGUI.PropertyGroup(() => { me.ShaderProperty(workflow, Tips.standWorkflow); me.ShaderProperty(blendMode, Tips.standBlendMode); me.ShaderProperty(samplingMode, Tips.samplingMode); if (blendMode.floatValue > 0) { me.ShaderProperty(useAlphaMask, Tips.separateAlpha); } if (samplingMode.floatValue == 3) { me.ShaderProperty(triplanarFalloff, Tips.triplanarFalloff); } if (samplingMode.floatValue == 4) { me.ShaderProperty(edgeFadeMin, "Edge Fade Min"); me.ShaderProperty(edgeFadeMax, "Edge Fade Max"); } if (blendMode.floatValue == 1) { me.ShaderProperty(alphaCutoff, Tips.alphaCutoffText); } me.ShaderProperty(useSmoothness, Tips.useSmoothness); if (workflow.floatValue > 0 && samplingMode.floatValue < 3) { me.ShaderProperty(useHeight, Tips.useHeight); } }); }
void DoDetailArea() { MGUI.BoldLabel("Detail Textures"); MGUI.PropertyGroup(() => { me.TexturePropertySingleLine(Tips.detailAlbedoText, detailAlbedoMap, detailAlbedoMap.textureValue ? detailAlbedoBlend : null); me.TexturePropertySingleLine(Tips.detailNormalMapText, detailNormalMap, detailNormalMap.textureValue ? detailNormalMapScale : null); me.TexturePropertySingleLine(Tips.detailRoughnessMapText, detailRoughnessMap, detailRoughnessMap.textureValue ? detailRoughBlend : null); MGUI.sRGBWarning(detailRoughnessMap); me.TexturePropertySingleLine(Tips.detailAOMapText, detailAOMap, detailAOMap.textureValue ? detailAOBlend : null); MGUI.sRGBWarning(detailAOMap); MGUI.SpaceN2(); }); }
void DoFilteringArea() { MGUI.PropertyGroup(() => { me.ShaderProperty(filtering, "Enable"); MGUI.ToggleGroup(filtering.floatValue == 0); MGUI.BoldLabel("Base Color"); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN1(); me.ShaderProperty(hue, "Hue"); me.ShaderProperty(saturation, "Saturation"); me.ShaderProperty(brightness, "Brightness"); me.ShaderProperty(contrast, "Contrast"); MGUI.SpaceN2(); }); MGUI.Space4(); MGUI.BoldLabel("Detail Color"); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN1(); me.ShaderProperty(hueDet, "Hue"); me.ShaderProperty(saturationDet, "Saturation"); me.ShaderProperty(brightnessDet, "Brightness"); me.ShaderProperty(contrastDet, "Contrast"); MGUI.SpaceN2(); }); if (emissionEnabled) { MGUI.Space4(); MGUI.BoldLabel("Emission Color"); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN1(); me.ShaderProperty(hueEmiss, "Hue"); me.ShaderProperty(saturationEmiss, "Saturation"); me.ShaderProperty(brightnessEmiss, "Brightness"); me.ShaderProperty(contrastEmiss, "Contrast"); MGUI.SpaceN2(); }); } MGUI.Space4(); MGUI.BoldLabel("Global Color"); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN1(); me.ShaderProperty(huePost, "Hue"); me.ShaderProperty(saturationPost, "Saturation"); me.ShaderProperty(brightnessPost, "Brightness"); me.ShaderProperty(contrastPost, "Contrast"); MGUI.SpaceN2(); }); MGUI.ToggleGroupEnd(); }); }
void DoRimArea() { MGUI.PropertyGroup(() => { me.ShaderProperty(rimTog, "Enable"); MGUI.ToggleGroup(rimTog.floatValue == 0); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN2(); me.ShaderProperty(rimBlend, Tips.rimBlend); me.ShaderProperty(rimCol, Tips.rimCol); me.ShaderProperty(rimStr, Tips.rimStr); me.ShaderProperty(rimWidth, Tips.rimWidth); me.ShaderProperty(rimEdge, Tips.rimEdge); MGUI.SpaceN2(); }); MGUI.ToggleGroupEnd(); }); }
public override void OnGUI(MaterialEditor me, MaterialProperty[] props) { if (!me.isVisible) { return; } ClearDictionaries(); foreach (var property in GetType().GetFields(bindingFlags)) { if (property.FieldType == typeof(MaterialProperty)) { property.SetValue(this, FindProperty(property.Name, props)); } } Material mat = (Material)me.target; if (m_FirstTimeApply) { m_FirstTimeApply = false; } header = "WaterHeader_Pro"; if (!EditorGUIUtility.isProSkin) { header = "WaterHeader"; } Texture2D headerTex = (Texture2D)Resources.Load(header, typeof(Texture2D)); Texture2D collapseIcon = (Texture2D)Resources.Load("CollapseIcon", typeof(Texture2D)); GUILayout.Label(headerTex); MGUI.Space4(); if (!foldouts.ContainsKey(mat)) { foldouts.Add(mat, toggles); } EditorGUI.BeginChangeCheck(); { // Surface baseTabButtons.Add(() => { Toggles.CollapseFoldouts(mat, foldouts, 1); }, MGUI.collapseLabel); baseTabButtons.Add(() => { ResetSurface(); }, MGUI.resetLabel); Action surfaceTabAction = () => { MGUI.PropertyGroup(() => { me.RenderQueueField(); me.ShaderProperty(_CullMode, "Culling Mode"); me.ShaderProperty(_ZWrite, "ZWrite"); me.ShaderProperty(_Opacity, "Opacity"); me.ShaderProperty(_DistortionStrength, "Distortion Strength"); MGUI.Space2(); }); MGUI.PropertyGroup(() => { me.TexturePropertySingleLine(texLabel, _MainTex, _Color, _BaseColorStochasticToggle); MGUI.TexPropLabel(Tips.stochasticLabel, 172); MGUI.TextureSOScroll(me, _MainTex, _MainTexScroll); me.ShaderProperty(_BaseColorOffset, Tips.parallaxOffsetLabel); me.ShaderProperty(_BaseColorDistortionStrength, "Distortion Strength"); }); MGUI.DisplayInfo(" This shader requires a \"Depth Light\" prefab be present in the scene.\n (Found in: Assets/Mochie/Unity/Prefabs)"); }; Foldouts.Foldout("BASE", foldouts, baseTabButtons, mat, me, surfaceTabAction); // Primary Normal norm0TabButtons.Add(() => { ResetPrimaryNormal(); }, MGUI.resetLabel); Action norm0TabAction = () => { MGUI.Space4(); MGUI.PropertyGroup(() => { me.TexturePropertySingleLine(Tips.waterNormalMap, _NormalMap0, _Normal0StochasticToggle); MGUI.TexPropLabel(Tips.stochasticLabel, 172); me.ShaderProperty(_NormalStr0, "Strength"); MGUI.Vector2Field(_NormalMapScale0, "Scale"); MGUI.Vector2Field(_NormalMapScroll0, "Scrolling"); me.ShaderProperty(_Rotation0, "Rotation"); me.ShaderProperty(_NormalMapOffset0, Tips.parallaxOffsetLabel); }); }; Foldouts.Foldout("PRIMARY NORMAL", foldouts, norm0TabButtons, mat, me, norm0TabAction); // Secondary Normal norm1TabButtons.Add(() => { ResetSecondaryNormal(); }, MGUI.resetLabel); Action norm1TabAction = () => { me.ShaderProperty(_Normal1Toggle, "Enable"); MGUI.Space4(); MGUI.PropertyGroup(() => { MGUI.ToggleGroup(_Normal1Toggle.floatValue == 0); me.TexturePropertySingleLine(Tips.waterNormalMap, _NormalMap1, _Normal1StochasticToggle); MGUI.TexPropLabel(Tips.stochasticLabel, 172); me.ShaderProperty(_NormalStr1, "Strength"); MGUI.Vector2Field(_NormalMapScale1, "Scale"); MGUI.Vector2Field(_NormalMapScroll1, "Scrolling"); me.ShaderProperty(_Rotation1, "Rotation"); me.ShaderProperty(_NormalMapOffset1, Tips.parallaxOffsetLabel); MGUI.ToggleGroupEnd(); }); }; Foldouts.Foldout("SECONDARY NORMAL", foldouts, norm1TabButtons, mat, me, norm1TabAction); // Reflections & Specular reflSpecTabButtons.Add(() => { ResetReflSpec(); }, MGUI.resetLabel); Action reflSpecTabAction = () => { MGUI.Space4(); me.ShaderProperty(_Roughness, Tips.waterRoughness); me.ShaderProperty(_Metallic, Tips.waterMetallic); MGUI.Space8(); me.ShaderProperty(_Reflections, "Reflections"); MGUI.PropertyGroup(() => { MGUI.ToggleGroup(_Reflections.floatValue == 0); if (_Reflections.floatValue == 2) { me.TexturePropertySingleLine(cubeLabel, _ReflCube); MGUI.Vector3Field(_ReflCubeRotation, "Rotation", false); } me.ShaderProperty(_ReflStrength, "Strength"); MGUI.ToggleFloat(me, "Screenspace Reflections", _SSR, _SSRStrength); if (_SSR.floatValue > 0) { me.ShaderProperty(_EdgeFadeSSR, "Edge Fade"); } me.ShaderProperty(_ReflTint, "Tint"); MGUI.ToggleGroupEnd(); }); MGUI.Space8(); me.ShaderProperty(_Specular, "Specular"); MGUI.PropertyGroup(() => { MGUI.ToggleGroup(_Specular.floatValue == 0); if (_Specular.floatValue == 2) { MGUI.Vector3Field(_LightDir, "Light Direction", false); } me.ShaderProperty(_SpecStrength, "Strength"); me.ShaderProperty(_SpecTint, "Tint"); MGUI.ToggleGroupEnd(); }); }; Foldouts.Foldout("REFLECTIONS & SPECULAR", foldouts, reflSpecTabButtons, mat, me, reflSpecTabAction); // Flow Mapping flowTabButtons.Add(() => { ResetFlowMapping(); }, MGUI.resetLabel); Action flowTabAction = () => { me.ShaderProperty(_FlowToggle, "Enable"); MGUI.Space4(); MGUI.PropertyGroup(() => { MGUI.ToggleGroup(_FlowToggle.floatValue == 0); me.TexturePropertySingleLine(flowLabel, _FlowMap); MGUI.Vector2Field(_FlowMapScale, "Scale"); me.ShaderProperty(_FlowSpeed, "Speed"); me.ShaderProperty(_FlowStrength, "Strength"); MGUI.ToggleGroupEnd(); }); }; Foldouts.Foldout("FLOW MAPPING", foldouts, flowTabButtons, mat, me, flowTabAction); // Vertex Offset vertTabButtons.Add(() => { ResetVertOffset(); }, MGUI.resetLabel); Action vertTabAction = () => { me.ShaderProperty(_VertOffsetMode, "Mode"); MGUI.Space4(); MGUI.ToggleGroup(_VertOffsetMode.floatValue == 0); if (_VertOffsetMode.floatValue == 1) { MGUI.PropertyGroup(() => { me.TexturePropertySingleLine(noiseLabel, _NoiseTex); me.ShaderProperty(_NoiseTexBlur, "Blur"); MGUI.Vector2Field(_NoiseTexScale, "Scale"); MGUI.Vector2Field(_NoiseTexScroll, "Scrolling"); }); MGUI.PropertyGroup(() => { MGUI.Vector3Field(_Offset, "Strength", false); me.ShaderProperty(_WaveHeight, "Strength Multiplier"); MGUI.SliderMinMax(_VertRemapMin, _VertRemapMax, -1f, 1f, "Remap", 1); }); } else if (_VertOffsetMode.floatValue == 2) { MGUI.BoldLabel("Global"); MGUI.PropertyGroup(() => { me.ShaderProperty(_WaveStrengthGlobal, "Strength"); me.ShaderProperty(_WaveScaleGlobal, "Scale"); me.ShaderProperty(_WaveSpeedGlobal, "Speed"); }); MGUI.BoldLabel("Wave 1"); MGUI.PropertyGroup(() => { me.ShaderProperty(_WaveStrength0, "Strength"); me.ShaderProperty(_WaveScale0, "Scale"); me.ShaderProperty(_WaveSpeed0, "Speed"); me.ShaderProperty(_WaveDirection0, "Direction"); }); MGUI.BoldLabel("Wave 2"); MGUI.PropertyGroup(() => { me.ShaderProperty(_WaveStrength1, "Strength"); me.ShaderProperty(_WaveScale1, "Scale"); me.ShaderProperty(_WaveSpeed1, "Speed"); me.ShaderProperty(_WaveDirection1, "Direction"); }); MGUI.BoldLabel("Wave 3"); MGUI.PropertyGroup(() => { me.ShaderProperty(_WaveStrength2, "Strength"); me.ShaderProperty(_WaveScale2, "Scale"); me.ShaderProperty(_WaveSpeed2, "Speed"); me.ShaderProperty(_WaveDirection2, "Direction"); }); MGUI.BoldLabel("Turbulence"); MGUI.PropertyGroup(() => { me.ShaderProperty(_Turbulence, Tips.turbulence); me.ShaderProperty(_TurbulenceSpeed, "Speed"); me.ShaderProperty(_TurbulenceScale, "Scale"); }); } MGUI.ToggleGroupEnd(); }; Foldouts.Foldout("VERTEX OFFSET", foldouts, vertTabButtons, mat, me, vertTabAction); // Caustics causticsTabButtons.Add(() => { ResetCaustics(); }, MGUI.resetLabel); Action causticsTabAction = () => { me.ShaderProperty(_CausticsToggle, "Enable"); MGUI.ToggleGroup(_CausticsToggle.floatValue == 0); MGUI.Space4(); MGUI.PropertyGroup(() => { me.ShaderProperty(_CausticsOpacity, "Strength"); me.ShaderProperty(_CausticsDisp, "Phase"); me.ShaderProperty(_CausticsSpeed, "Speed"); me.ShaderProperty(_CausticsScale, "Scale"); me.ShaderProperty(_CausticsFade, Tips.causticsFade); MGUI.Vector3Field(_CausticsRotation, "Rotation", false); }); MGUI.PropertyGroup(() => { me.ShaderProperty(_CausticsDistortion, "Distortion Strength"); me.ShaderProperty(_CausticsDistortionScale, "Distortion Scale"); MGUI.Vector2Field(_CausticsDistortionSpeed, "Distortion Speed"); }); MGUI.ToggleGroupEnd(); }; Foldouts.Foldout("CAUSTICS", foldouts, causticsTabButtons, mat, me, causticsTabAction); // Foam foamTabButtons.Add(() => { ResetFoam(); }, MGUI.resetLabel); Action foamTabAction = () => { me.ShaderProperty(_FoamToggle, "Enable"); MGUI.Space4(); MGUI.ToggleGroup(_FoamToggle.floatValue == 0); MGUI.PropertyGroup(() => { me.TexturePropertySingleLine(foamLabel, _FoamTex, _FoamColor, _FoamStochasticToggle); MGUI.TexPropLabel(Tips.stochasticLabel, 172); MGUI.Space2(); MGUI.Vector2Field(_FoamTexScale, "Scale"); MGUI.Vector2Field(_FoamTexScroll, "Scrolling"); me.ShaderProperty(_FoamOffset, Tips.parallaxOffsetLabel); me.ShaderProperty(_FoamDistortionStrength, "Distortion Strength"); MGUI.ToggleFloat(me, Tips.foamNormal, _FoamNormalToggle, _FoamNormalStrength); }); MGUI.PropertyGroup(() => { me.TexturePropertySingleLine(noiseLabel, _FoamNoiseTex); MGUI.Vector2Field(_FoamNoiseTexScale, "Scale"); MGUI.Vector2Field(_FoamNoiseTexScroll, "Scrolling"); me.ShaderProperty(_FoamNoiseTexStrength, Tips.foamNoiseTexStrength); me.ShaderProperty(_FoamNoiseTexCrestStrength, Tips.foamNoiseTexCrestStrength); }); MGUI.PropertyGroup(() => { me.ShaderProperty(_FoamRoughness, Tips.foamRoughness); me.ShaderProperty(_FoamPower, Tips.foamPower); me.ShaderProperty(_FoamOpacity, Tips.foamOpacity); me.ShaderProperty(_FoamCrestStrength, Tips.foamCrestStrength); me.ShaderProperty(_FoamCrestThreshold, Tips.foamCrestThreshold); }); MGUI.ToggleGroupEnd(); }; Foldouts.Foldout("FOAM", foldouts, foamTabButtons, mat, me, foamTabAction); // Depth Fog fogTabButtons.Add(() => { ResetFog(); }, MGUI.resetLabel); Action fogTabAction = () => { me.ShaderProperty(_FogToggle, "Enable"); MGUI.Space4(); MGUI.PropertyGroup(() => { MGUI.ToggleGroup(_FogToggle.floatValue == 0); me.ShaderProperty(_FogTint, "Color"); me.ShaderProperty(_FogPower, "Power"); MGUI.ToggleGroupEnd(); }); }; Foldouts.Foldout("DEPTH FOG", foldouts, fogTabButtons, mat, me, fogTabAction); // Edge Fade edgeFadeTabButtons.Add(() => { ResetEdgeFade(); }, MGUI.resetLabel); Action edgeFadeTabAction = () => { me.ShaderProperty(_EdgeFadeToggle, "Enable"); MGUI.Space4(); MGUI.PropertyGroup(() => { MGUI.ToggleGroup(_EdgeFadeToggle.floatValue == 0); me.ShaderProperty(_EdgeFadePower, "Power"); me.ShaderProperty(_EdgeFadeOffset, "Offset"); MGUI.ToggleGroupEnd(); }); }; Foldouts.Foldout("EDGE FADE", foldouts, edgeFadeTabButtons, mat, me, edgeFadeTabAction); // Rain rainTabButtons.Add(() => { ResetRain(); }, MGUI.resetLabel); Action rainTabAction = () => { me.ShaderProperty(_RainToggle, "Enable"); MGUI.Space4(); MGUI.PropertyGroup(() => { MGUI.ToggleGroup(_RainToggle.floatValue == 0); me.ShaderProperty(_RippleStr, "Strength"); me.ShaderProperty(_RippleSpeed, "Speed"); me.ShaderProperty(_RippleScale, "Scale"); MGUI.ToggleGroupEnd(); }); }; Foldouts.Foldout("RAIN", foldouts, rainTabButtons, mat, me, rainTabAction); } ApplyMaterialSettings(mat); GUILayout.Space(20); float buttonSize = 35f; Rect footerRect = EditorGUILayout.GetControlRect(); footerRect.x += (MGUI.GetInspectorWidth() / 2f) - buttonSize - 5f; footerRect.width = buttonSize; footerRect.height = buttonSize; if (GUI.Button(footerRect, MGUI.patIconTex)) { Application.OpenURL("https://www.patreon.com/mochieshaders"); } footerRect.x += buttonSize + 5f; footerRect.y += 17f; GUIStyle formatting = new GUIStyle(); formatting.fontSize = 15; formatting.fontStyle = FontStyle.Bold; if (EditorGUIUtility.isProSkin) { formatting.normal.textColor = new Color(0.8f, 0.8f, 0.8f, 1); formatting.hover.textColor = new Color(0.8f, 0.8f, 0.8f, 1); GUI.Label(footerRect, versionLabel, formatting); footerRect.y += 20f; footerRect.x -= 35f; footerRect.width = 70f; footerRect.height = 70f; GUI.Label(footerRect, MGUI.mochieLogoPro); GUILayout.Space(90); } else { GUI.Label(footerRect, versionLabel, formatting); footerRect.y += 20f; footerRect.x -= 35f; footerRect.width = 70f; footerRect.height = 70f; GUI.Label(footerRect, MGUI.mochieLogo); GUILayout.Space(90); } }
public override void OnGUI(MaterialEditor me, MaterialProperty[] props) { if (!me.isVisible) { return; } ClearDictionaries(); foreach (var property in GetType().GetFields(bindingFlags)) { if (property.FieldType == typeof(MaterialProperty)) { property.SetValue(this, FindProperty(property.Name, props)); } } if (_DstBlend.floatValue == 0) { _DstBlend.floatValue = 10; } Material mat = (Material)me.target; if (m_FirstTimeApply) { CacheRenderersUsingThisMaterial(mat); m_FirstTimeApply = false; } header = "ParticleHeader_Pro"; if (!EditorGUIUtility.isProSkin) { header = "ParticleHeader"; } Texture2D headerTex = (Texture2D)Resources.Load(header, typeof(Texture2D)); Texture2D collapseIcon = (Texture2D)Resources.Load("CollapseIcon", typeof(Texture2D)); GUILayout.Label(headerTex); MGUI.Space4(); List <ParticleSystemVertexStream> streams = new List <ParticleSystemVertexStream>(); streams.Add(ParticleSystemVertexStream.Position); streams.Add(ParticleSystemVertexStream.UV); streams.Add(ParticleSystemVertexStream.AnimBlend); streams.Add(ParticleSystemVertexStream.Custom1X); streams.Add(ParticleSystemVertexStream.Center); streams.Add(ParticleSystemVertexStream.Color); string warnings = ""; List <ParticleSystemVertexStream> rendererStreams = new List <ParticleSystemVertexStream>(); foreach (ParticleSystemRenderer renderer in m_RenderersUsingThisMaterial) { if (renderer != null) { renderer.GetActiveVertexStreams(rendererStreams); bool streamsValid = rendererStreams.SequenceEqual(streams); if (!streamsValid) { warnings += " " + renderer.name + "\n"; } } } EditorGUI.BeginChangeCheck(); { foreach (var obj in _BlendMode.targets) { ApplyMaterialSettings((Material)obj); } if (!foldouts.ContainsKey(mat)) { foldouts.Add(mat, toggles); } // ----------------- // Render Settings // ----------------- baseTabButtons.Add(() => { Toggles.CollapseFoldouts(mat, foldouts, 1); }, MGUI.collapseLabel); baseTabButtons.Add(() => { ResetBase(); }, MGUI.resetLabel); Action baseTabAction = () => { if (warnings != "") { EditorGUILayout.HelpBox("Incorrect or missing vertex streams detected:\n" + warnings, MessageType.Warning, true); if (GUILayout.Button(applyStreamsText, EditorStyles.miniButton)) { foreach (ParticleSystemRenderer renderer in m_RenderersUsingThisMaterial) { if (renderer != null) { if (renderer != null) { renderer.SetActiveVertexStreams(streams); } } } } } // Blending mode dropdown MGUI.PropertyGroup(() => { me.RenderQueueField(); me.ShaderProperty(_BlendMode, "Blending Mode"); me.ShaderProperty(_Culling, "Culling"); me.ShaderProperty(_ZTest, "ZTest"); }); MGUI.PropertyGroup(() => { me.ShaderProperty(_Opacity, "Opacity"); MGUI.ToggleSlider(me, "Cutout", _IsCutout, _Cutoff); MGUI.ToggleSlider(me, Tips.falloffMode, _Softening, _SoftenStr); me.ShaderProperty(_FlipbookBlending, Tips.flipbookBlending); }); MGUI.PropertyGroup(() => { me.TexturePropertySingleLine(texLabel, _MainTex, _Color); me.TexturePropertySingleLine(tex2Label, _SecondTex, _SecondColor, _SecondTex.textureValue ? _TexBlendMode : null); if (_SecondTex.textureValue) { MGUI.TexPropLabel("Blending", 113); } }); }; Foldouts.Foldout("BASE", foldouts, baseTabButtons, mat, me, baseTabAction); // Filtering filterTabButtons.Add(() => { ResetFiltering(); }, MGUI.resetLabel); Action filterTabAction = () => { me.ShaderProperty(_Filtering, "Enable"); MGUI.Space4(); MGUI.PropertyGroup(() => { MGUI.ToggleGroup(_Filtering.floatValue == 0); me.ShaderProperty(_AutoShift, Tips.autoShift); if (_AutoShift.floatValue == 1) { me.ShaderProperty(_AutoShiftSpeed, "Speed"); } else { me.ShaderProperty(_Hue, "Hue"); } me.ShaderProperty(_Saturation, "Saturation"); me.ShaderProperty(_Brightness, "Brightness"); me.ShaderProperty(_Contrast, "Contrast"); me.ShaderProperty(_HDR, "HDR"); MGUI.ToggleGroupEnd(); }); }; Foldouts.Foldout("FILTERING", foldouts, filterTabButtons, mat, me, filterTabAction); // Distortion distortTabButtons.Add(() => { ResetDistortion(); }, MGUI.resetLabel); Action distortTabAction = () => { me.ShaderProperty(_Distortion, "Enable"); MGUI.Space4(); MGUI.ToggleGroup(_Distortion.floatValue == 0); MGUI.PropertyGroup(() => { me.TexturePropertySingleLine(normalLabel, _NormalMap, _DistortMainTex); MGUI.TexPropLabel("Distort UVs", 124); MGUI.Vector2Field(_NormalMapScale, "Scale"); MGUI.SpaceN3(); MGUI.Vector2Field(_DistortionSpeed, "Scrolling"); me.ShaderProperty(_DistortionStr, "Strength"); me.ShaderProperty(_DistortionBlend, "Blend"); MGUI.ToggleGroupEnd(); }); }; Foldouts.Foldout("DISTORTION", foldouts, distortTabButtons, mat, me, distortTabAction); // Pulse pulseTabButtons.Add(() => { ResetPulse(); }, MGUI.resetLabel); Action pulseTabAction = () => { me.ShaderProperty(_Pulse, "Enable"); MGUI.Space4(); MGUI.PropertyGroup(() => { MGUI.ToggleGroup(_Pulse.floatValue == 0); me.ShaderProperty(_Waveform, "Waveform"); me.ShaderProperty(_PulseStr, "Strength"); me.ShaderProperty(_PulseSpeed, "Speed"); MGUI.ToggleGroupEnd(); }); }; Foldouts.Foldout("PULSE", foldouts, pulseTabButtons, mat, me, pulseTabAction); // Falloff falloffTabButtons.Add(() => { ResetFalloff(); }, MGUI.resetLabel); Action falloffTabAction = () => { me.ShaderProperty(_Falloff, "Enable"); MGUI.Space4(); MGUI.PropertyGroup(() => { MGUI.ToggleGroup(_Falloff.floatValue == 0); me.ShaderProperty(_FalloffMode, Tips.falloffMode); MGUI.Space4(); me.ShaderProperty(_MinRange, "Far Min Range"); me.ShaderProperty(_MaxRange, "Far Max Range"); MGUI.Space4(); me.ShaderProperty(_NearMinRange, "Near Min Range"); me.ShaderProperty(_NearMaxRange, "Near Max Range"); MGUI.ToggleGroupEnd(); }); }; Foldouts.Foldout("FALLOFF", foldouts, falloffTabButtons, mat, me, falloffTabAction); } GUILayout.Space(20); float buttonSize = 35f; Rect footerRect = EditorGUILayout.GetControlRect(); footerRect.x += (MGUI.GetInspectorWidth() / 2f) - buttonSize - 5f; footerRect.width = buttonSize; footerRect.height = buttonSize; if (GUI.Button(footerRect, MGUI.patIconTex)) { Application.OpenURL("https://www.patreon.com/mochieshaders"); } footerRect.x += buttonSize + 5f; footerRect.y += 17f; GUIStyle formatting = new GUIStyle(); formatting.fontSize = 15; formatting.fontStyle = FontStyle.Bold; if (EditorGUIUtility.isProSkin) { formatting.normal.textColor = new Color(0.8f, 0.8f, 0.8f, 1); formatting.hover.textColor = new Color(0.8f, 0.8f, 0.8f, 1); GUI.Label(footerRect, versionLabel, formatting); footerRect.y += 20f; footerRect.x -= 35f; footerRect.width = 70f; footerRect.height = 70f; GUI.Label(footerRect, MGUI.mochieLogoPro); GUILayout.Space(90); } else { GUI.Label(footerRect, versionLabel, formatting); footerRect.y += 20f; footerRect.x -= 35f; footerRect.width = 70f; footerRect.height = 70f; GUI.Label(footerRect, MGUI.mochieLogo); GUILayout.Space(90); } }
void DoRenderingArea(Material mat) { MGUI.PropertyGroup(() => { MGUI.PropertyGroupLayer(() => { MGUI.SpaceN2(); if (samplingMode.floatValue != 4) { me.ShaderProperty(culling, Tips.culling); } queueOffset.floatValue = (int)queueOffset.floatValue; me.ShaderProperty(queueOffset, Tips.queueOffset); MGUI.SpaceN1(); MGUI.DummyProperty("Render Queue:", mat.renderQueue.ToString()); MGUI.SpaceN4(); }); MGUI.Space1(); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN2(); MGUI.ToggleFloat(me, Tips.useFresnel, useFresnel, fresnelStrength); MGUI.ToggleFloat(me, Tips.highlightsText, highlights, specularStrength); MGUI.ToggleFloat(me, Tips.reflectionsText, reflections, reflectionStrength); MGUI.ToggleFloat(me, Tips.ssrText, ssr, ssrStrength); if (ssr.floatValue == 1) { me.ShaderProperty(edgeFade, Tips.edgeFadeText); } MGUI.ToggleFloat(me, Tips.reflVertexColor, reflVertexColor, reflVertexColorStrength); MGUI.ToggleFloat(me, Tips.reflShadows, reflShadows, reflShadowStrength); if (reflShadows.floatValue == 1) { me.ShaderProperty(brightnessReflShad, "Brightness", 1); me.ShaderProperty(contrastReflShad, "Contrast", 1); me.ShaderProperty(hdrReflShad, "HDR", 1); } MGUI.ToggleFloat(me, Tips.gsaa, gsaa, gsaaStrength); }); MGUI.Space1(); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN3(); me.ShaderProperty(_BakeryMode, Tips.bakeryMode); me.ShaderProperty(_BAKERY_SHNONLINEAR, "Bakery Non-Linear SH"); me.ShaderProperty(_BAKERY_LMSPEC, "Bakery Lightmap Specular"); me.ShaderProperty(bicubicLightmap, Tips.bicubicLightmap); #if LTCGI_INCLUDED me.ShaderProperty(ltcgi, "LTCGI"); if (ltcgi.floatValue == 1) { me.ShaderProperty(ltcgi_spec_off, "LTCGI Disable Specular"); me.ShaderProperty(ltcgi_diffuse_off, "LTCGI Disable Diffuse"); } #else ltcgi.floatValue = 0; mat.DisableKeyword("LTCGI"); #endif me.EnableInstancingField(); MGUI.SpaceN2(); me.DoubleSidedGIField(); MGUI.SpaceN3(); }); if (ssr.floatValue == 1) { MGUI.DisplayInfo("\nScreenspace reflections in VRChat requires the \"Depth Light\" prefab found in: Assets/Mochie/Unity/Prefabs\n\nIt is also is VERY expensive, please use it sparingly!\n"); } MGUI.Space1(); // me.TexturePropertySingleLine(new GUIContent("RNM0"), _RNM0); // me.TexturePropertySingleLine(new GUIContent("RNM1"), _RNM1); // me.TexturePropertySingleLine(new GUIContent("RNM2"), _RNM2); }); }
void DoUVArea() { bool needsHeightMaskUV = (((workflow.floatValue > 0 && useHeight.floatValue == 1) || (workflow.floatValue == 0 && heightMap.textureValue)) && parallaxMask.textureValue) && samplingMode.floatValue < 3; bool needsEmissMaskUV = emissionEnabled && emissionMask.textureValue; bool needsAlphaMaskUV = blendMode.floatValue > 0 && useAlphaMask.floatValue > 0; MGUI.PropertyGroup(() => { MGUI.BoldLabel("Primary"); EditorGUI.BeginChangeCheck(); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN2(); if (samplingMode.floatValue < 3) { me.ShaderProperty(uvPri, Tips.uvSetLabel.text); MGUI.TextureSOScroll(me, albedoMap, uv0Scroll); } else { MGUI.TextureSO(me, albedoMap); } if (EditorGUI.EndChangeCheck()) { emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; } me.ShaderProperty(uv0Rot, "Rotation"); MGUI.SpaceN2(); }); MGUI.Space4(); MGUI.BoldLabel("Detail"); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN2(); if (samplingMode.floatValue < 3) { me.ShaderProperty(uvSetSecondary, Tips.uvSetLabel.text); MGUI.TextureSOScroll(me, detailAlbedoMap, uv1Scroll); } else { MGUI.TextureSO(me, detailAlbedoMap); } me.ShaderProperty(uv1Rot, "Rotation"); me.ShaderProperty(detailSamplingMode, Tips.detailSamplingMode); MGUI.SpaceN4(); }); if (needsHeightMaskUV) { MGUI.Space4(); MGUI.BoldLabel("Height Mask"); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN2(); me.ShaderProperty(uvHeightMask, Tips.uvSetLabel.text); MGUI.TextureSOScroll(me, parallaxMask, uv2Scroll); MGUI.SpaceN2(); }); } if (needsEmissMaskUV) { MGUI.Space4(); MGUI.BoldLabel("Emission Mask"); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN2(); me.ShaderProperty(uvEmissMask, Tips.uvSetLabel.text); MGUI.TextureSOScroll(me, emissionMask, uv3Scroll); me.ShaderProperty(uv3Rot, "Rotation"); MGUI.SpaceN2(); }); } if (needsAlphaMaskUV) { MGUI.Space4(); MGUI.BoldLabel("Alpha Mask"); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN2(); me.ShaderProperty(uvAlphaMask, Tips.uvSetLabel.text); MGUI.TextureSOScroll(me, alphaMask, uv4Scroll); me.ShaderProperty(uv4Rot, "Rotation"); MGUI.SpaceN2(); }); } }); }
void DoPrimaryArea(Material material) { MGUI.PropertyGroup(() => { me.TexturePropertySingleLine(Tips.albedoText, albedoMap, albedoColor); if (useAlphaMask.floatValue == 1 && blendMode.floatValue > 0) { me.TexturePropertySingleLine(Tips.alphaMaskText, alphaMask, alphaMaskOpacity, alphaMaskChannel); } GUIContent roughLabel = Tips.roughnessText; GUIContent roughStrLabel = Tips.roughnessPackedText; if (useSmoothness.floatValue == 1) { roughLabel.text = "Smoothness"; roughStrLabel.text = "Smoothness Strength"; } else { roughLabel.text = "Roughness"; roughStrLabel.text = "Roughness Strength"; } if (workflow.floatValue == 1) { me.TexturePropertySingleLine(Tips.packedMapText, packedMap); MGUI.sRGBWarning(packedMap); if (packedMap.textureValue) { MGUI.PropertyGroupLayer(() => { MGUI.SpaceN3(); me.ShaderProperty(metallicChannel, "Metallic"); me.ShaderProperty(roughChannel, roughLabel.text); me.ShaderProperty(occlusionChannel, "Occlusion"); if (useHeight.floatValue == 1 && samplingMode.floatValue < 3) { me.ShaderProperty(heightChannel, "Height"); } MGUI.SpaceN3(); }); MGUI.PropertyGroupLayer(() => { MGUI.SpaceN2(); MGUI.ToggleSlider(me, Tips.metallicPackedText, metalMult, metallic); MGUI.ToggleSlider(me, roughStrLabel, roughMult, roughness); MGUI.ToggleSlider(me, Tips.occlusionPackedText, occMult, occlusionStrength); if (useHeight.floatValue == 1 && samplingMode.floatValue < 3) { MGUI.ToggleSlider(me, Tips.heightMapPackedText, heightMult, heightMapScale); me.ShaderProperty(steps, Tips.stepsText); me.ShaderProperty(parallaxOfs, Tips.parallaxOfsText); } MGUI.SpaceN2(); }); MGUI.Space8(); } if (useHeight.floatValue == 1 && samplingMode.floatValue < 3) { me.TexturePropertySingleLine(Tips.heightMaskText, parallaxMask); } } else { me.TexturePropertySingleLine(Tips.metallicMapText, metallicMap, metallic); MGUI.sRGBWarning(metallicMap); me.TexturePropertySingleLine(roughLabel, roughnessMap, roughness); MGUI.sRGBWarning(roughnessMap); me.TexturePropertySingleLine(Tips.occlusionText, occlusionMap, occlusionMap.textureValue ? occlusionStrength : null); MGUI.sRGBWarning(occlusionMap); if (samplingMode.floatValue < 3) { me.TexturePropertySingleLine(Tips.heightMapText, heightMap, heightMap.textureValue ? heightMapScale : null); MGUI.sRGBWarning(heightMap); if (heightMap.textureValue) { me.TexturePropertySingleLine(Tips.heightMaskText, parallaxMask); me.ShaderProperty(steps, Tips.stepsText, 2); me.ShaderProperty(parallaxOfs, Tips.parallaxOfsText, 2); } } } me.TexturePropertySingleLine(Tips.normalMapText, bumpMap, bumpMap.textureValue ? bumpScale : null); me.TexturePropertySingleLine(Tips.reflOverrideText, reflOverride); me.TexturePropertySingleLine(Tips.reflCubeText, reflCube, reflCube.textureValue ? cubeThreshold : null); me.TexturePropertySingleLine(Tips.detailMaskText, detailMask, detailMask.textureValue ? detailMaskChannel : null); DoEmissionArea(material); }); }