public static void SetRenderState(SurfaceType surfaceType, AlphaMode alphaMode, bool twoSided, ref ShaderPass pass) { // Get default render state from Master Node var options = ShaderGenerator.GetMaterialOptions(surfaceType, alphaMode, twoSided); // Update render state on ShaderPass if there is no active override if (string.IsNullOrEmpty(pass.ZWriteOverride)) { pass.ZWriteOverride = "ZWrite " + options.zWrite.ToString(); } if (string.IsNullOrEmpty(pass.ZTestOverride)) { pass.ZTestOverride = "ZTest " + options.zTest.ToString(); } if (string.IsNullOrEmpty(pass.CullOverride)) { pass.CullOverride = "Cull " + options.cullMode.ToString(); } if (string.IsNullOrEmpty(pass.BlendOverride)) { pass.BlendOverride = string.Format("Blend {0} {1}, {2} {3}", options.srcBlend, options.dstBlend, options.alphaSrcBlend, options.alphaDstBlend); } }
public WindowSurfaceCompositorOptions(IntPtr hwnd, Size size, Format format, AlphaMode mode, bool isTopMost = false) : base(hwnd, isTopMost) { this.Size = size; this.PixelFormat = format; this.AlphaMode = mode; }
public static void GetBlendMode(ShaderGraph.SurfaceType surfaceType, AlphaMode alphaMode, ref Pass pass) { if (surfaceType == ShaderGraph.SurfaceType.Opaque) { pass.BlendOverride = "Blend One Zero, One Zero"; } else { switch (alphaMode) { case AlphaMode.Alpha: pass.BlendOverride = "Blend One OneMinusSrcAlpha, One OneMinusSrcAlpha"; break; case AlphaMode.Additive: pass.BlendOverride = "Blend One One, One One"; break; case AlphaMode.Premultiply: pass.BlendOverride = "Blend One OneMinusSrcAlpha, One OneMinusSrcAlpha"; break; // This isn't supported in HDRP. case AlphaMode.Multiply: default: pass.BlendOverride = "Blend One OneMinusSrcAlpha, One OneMinusSrcAlpha"; break; } } }
protected StandardMap(Material mat, int MaxLOD = 1000) { mat.shader.maximumLOD = MaxLOD; _material = mat; if (mat.HasProperty(_Cutoff)) { _alphaCutoff = mat.GetFloat(_Cutoff); } switch (mat.renderQueue) { case (int)RenderQueue.AlphaTest: _alphaMode = AlphaMode.MASK; break; case (int)RenderQueue.Transparent: _alphaMode = AlphaMode.BLEND; break; case (int)RenderQueue.Geometry: default: _alphaMode = AlphaMode.OPAQUE; break; } }
public GLTFMaterial(GLTFMaterial material, GLTFRoot gltfRoot) : base(material, gltfRoot) { if (material == null) { return; } if (material.PbrMetallicRoughness != null) { PbrMetallicRoughness = new PbrMetallicRoughness(material.PbrMetallicRoughness, gltfRoot); } if (material.NormalTexture != null) { NormalTexture = new NormalTextureInfo(material.NormalTexture, gltfRoot); } if (material.OcclusionTexture != null) { OcclusionTexture = new OcclusionTextureInfo(material.OcclusionTexture, gltfRoot); } if (material.EmissiveTexture != null) { EmissiveTexture = new TextureInfo(material.EmissiveTexture, gltfRoot); } EmissiveFactor = material.EmissiveFactor; AlphaMode = material.AlphaMode; AlphaCutoff = material.AlphaCutoff; DoubleSided = material.DoubleSided; }
void UpdateAlphaValue(AlphaMode value) { var alphaSettings = _meshNode.MeshModel.AlphaSettings; alphaSettings.Mode = value; _meshNode.MeshModel.AlphaSettings = alphaSettings; }
internal TextureDescription( Memory <byte> bitData, D3D12_RESOURCE_DIMENSION resourceDimension, Size3 size, uint mipCount, uint arraySize, DXGI_FORMAT format, LoaderFlags loaderFlags, bool isCubeMap, Memory <ManagedSubresourceData> subresourceData, AlphaMode alphaMode, TexType underlyingTextureType) { BitData = bitData; ResourceDimension = resourceDimension; _size = size; MipCount = mipCount; ArraySize = arraySize; Format = format; LoaderFlags = loaderFlags; IsCubeMap = isCubeMap; SubresourceData = subresourceData; AlphaMode = alphaMode; UnderlyingTextureType = underlyingTextureType; }
public void WireframePropertiesGUI(MaterialEditor materialEditor, Material material) { AlphaMode alphaMode = (AlphaMode)wireframeAlphaMode.floatValue; EditorGUILayout.Space(); if (WireframeGridShaderGUI.logo == null) { WireframeGridShaderGUI.logo = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/Digicrafts/WireframeGrid/Shaders/Editor/logo.png"); } if (WireframeGridShaderGUI.logoStyle == null) { WireframeGridShaderGUI.logoStyle = new GUIStyle(GUI.skin.GetStyle("Label")); WireframeGridShaderGUI.logoStyle.alignment = TextAnchor.UpperCenter; WireframeGridShaderGUI.logoStyle.normal.background = WireframeGridShaderGUI.logo; } GUILayout.Label("", WireframeGridShaderGUI.logoStyle, GUILayout.Height(50)); EditorGUILayout.Space(); EditorGUILayout.HelpBox("Wireframe Settings", MessageType.None); EditorGUILayout.Space(); GUILayout.Label(Styles.wireframeBasicTitleText, EditorStyles.boldLabel); materialEditor.ShaderProperty(wireframeSize, Styles.wireframeSizeText.text); // materialEditor.ShaderProperty(_WireframeSizeScale,Styles._WireframeSizeScale.text); materialEditor.ShaderProperty(_GridSpacing, Styles._GridSpacing.text); materialEditor.ShaderProperty(_GridSpacingScale, Styles._GridSpacingScale.text); materialEditor.ShaderProperty(_GridUseWorldspace, Styles._GridUseWorldspace.text); materialEditor.ShaderProperty(wireframeDoubleSided, Styles.wireframeDoubleSidedText.text); materialEditor.ShaderProperty(wireframeAA, Styles.wireframeAAText.text); materialEditor.ShaderProperty(wireframeLighting, Styles.wireframeLightingText.text); EditorGUILayout.Space(); GUILayout.Label(Styles.wireframeColorTitleText, EditorStyles.boldLabel); materialEditor.TexturePropertyWithHDRColor(Styles.wireframeTexText, wireframeTex, wireframeColor, new ColorPickerHDRConfig(0, 2, 0, 2), true); if (alphaMode == AlphaMode.Mask) { materialEditor.TexturePropertySingleLine(Styles.wireframeMaskTexText, wireframeMaskTex); } WireframeAlphaModePopup(materialEditor, material); materialEditor.ShaderProperty(wireframeAlphaCutoff, Styles.wireframeAlphaCutoffText.text); if (wireframeEmissionColor != null) { materialEditor.ShaderProperty(wireframeEmissionColor, Styles.wireframeEmissionColor.text); } EditorGUILayout.Space(); materialEditor.TextureScaleOffsetProperty(wireframeTex); materialEditor.ShaderProperty(wireframeUV, Styles.wireframeUVText.text); EditorGUILayout.Space(); GUILayout.Label(Styles.wireframeAnimationTitleText, EditorStyles.boldLabel); materialEditor.ShaderProperty(wireframeTexAniSpeedX, Styles.wireframeTexAniSpeedXText.text); materialEditor.ShaderProperty(wireframeTexAniSpeedY, Styles.wireframeTexAniSpeedYText.text); EditorGUILayout.Space(); // Double Sided if (wireframeDoubleSided.floatValue > 0) { material.SetInt("_WireframeCull", (int)UnityEngine.Rendering.CullMode.Off); } else { material.SetInt("_WireframeCull", (int)UnityEngine.Rendering.CullMode.Back); } }
public ATC(AlphaMode alphaMode) { BitDepth = (alphaMode != AlphaMode.None) ? 8 : 4; BlockBitDepth = (alphaMode != AlphaMode.None) ? 128 : 64; _alphaMode = alphaMode; FormatName = "ATC_RGB" + ((alphaMode != AlphaMode.None) ? (alphaMode == AlphaMode.Interpolated) ? "A Interpolated" : "A Explicit" : ""); }
public static Surface CreateSurface(ComObject device, int variant, int width, int height, Format pixelFormat, AlphaMode alphaMode) { if (variant > 1) { return(new Surface((DesktopDevice)device, width, height, pixelFormat, alphaMode)); } return(variant == 1 ? new Surface((Device)device, width, height, pixelFormat, alphaMode) : null); }
public Material CreateMaterial(GLTFTexture.ImportResult[] textures, AlphaMode alphaMode, ShaderSettings shaderSettings) { // Shader Shader sh = null; #if UNITY_2019_1_OR_NEWER // LWRP support if (GraphicsSettings.renderPipelineAsset) { sh = GraphicsSettings.renderPipelineAsset.defaultShader; } #endif if (sh == null) { if (alphaMode == AlphaMode.BLEND) { sh = shaderSettings.SpecularBlend; } else { sh = shaderSettings.Specular; } } // Material Material mat = new Material(sh); mat.color = diffuseFactor; mat.SetColor("_SpecColor", specularFactor); mat.SetFloat("_Glossiness", glossinessFactor); // Diffuse texture if (diffuseTexture != null) { if (textures.Length <= diffuseTexture.index) { Debug.LogWarning("Attempted to get diffuseTexture texture index " + diffuseTexture.index + " when only " + textures.Length + " exist"); } else { mat.SetTexture("_MainTex", textures[diffuseTexture.index].image.texture); } } // Specular texture if (specularGlossinessTexture != null) { if (textures.Length <= specularGlossinessTexture.index) { Debug.LogWarning("Attempted to get specularGlossinessTexture texture index " + specularGlossinessTexture.index + " when only " + textures.Length + " exist"); } else { mat.SetTexture("_SpecGlossMap", textures[specularGlossinessTexture.index].image.GetFixedMetallicRoughness()); mat.EnableKeyword("_SPECGLOSSMAP"); } } return(mat); }
public static void SetMaterialKeywords(Material material, AlphaMode alphaMode, bool doubleSided) { // Clear all keywords for fresh start material.shaderKeywords = null; // Translate GLTF alpha mode to Surface and Blend modes switch (alphaMode) { case AlphaMode.OPAQUE: material.SetFloat("_AlphaClip", 0.0f); material.SetFloat("_Surface", 0.0f); break; case AlphaMode.MASK: material.SetFloat("_AlphaClip", 1.0f); material.SetFloat("_Surface", 0.0f); break; case AlphaMode.BLEND: material.SetFloat("_AlphaClip", 0.0f); material.SetFloat("_Surface", 1.0f); material.SetFloat("_Blend", 0.0f); break; default: throw new ArgumentOutOfRangeException(nameof(alphaMode), alphaMode, null); } // Set front (2) or double sided rendering (0) material.SetFloat("_Cull", doubleSided ? 0.0f : 2.0f); // Setup blending - consistent across all Universal RP shaders SetupMaterialBlendMode(material); // Receive Shadows if (material.HasProperty("_ReceiveShadows")) { SetKeyword(material, "_RECEIVE_SHADOWS_OFF", material.GetFloat("_ReceiveShadows") == 0.0f); } // Emission var shouldEmissionBeEnabled = material.HasProperty("_EmissionColor") && material.GetColor("_EmissionColor").maxColorComponent > 0.0f || material.HasProperty("_EmissionMap") && material.GetTexture("_EmissionMap") != null; SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled); // Normal Map if (material.HasProperty("_BumpMap")) { SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap")); } // Shader specific keyword functions SetURPMaterialKeywords(material); }
public static SurfaceMaterialOptions BuildMaterialOptions(SurfaceType surfaceType, AlphaMode alphaMode, bool twoSided, bool refraction) { SurfaceMaterialOptions materialOptions = new SurfaceMaterialOptions(); if (surfaceType == SurfaceType.Opaque) { materialOptions.srcBlend = SurfaceMaterialOptions.BlendMode.One; materialOptions.dstBlend = SurfaceMaterialOptions.BlendMode.Zero; materialOptions.zTest = SurfaceMaterialOptions.ZTest.LEqual; materialOptions.zWrite = SurfaceMaterialOptions.ZWrite.On; } else { if (refraction) { materialOptions.srcBlend = SurfaceMaterialOptions.BlendMode.One; materialOptions.dstBlend = SurfaceMaterialOptions.BlendMode.OneMinusSrcAlpha; } else { switch (alphaMode) { case AlphaMode.Alpha: materialOptions.srcBlend = SurfaceMaterialOptions.BlendMode.One; materialOptions.dstBlend = SurfaceMaterialOptions.BlendMode.OneMinusSrcAlpha; break; case AlphaMode.Additive: materialOptions.srcBlend = SurfaceMaterialOptions.BlendMode.One; materialOptions.dstBlend = SurfaceMaterialOptions.BlendMode.One; break; case AlphaMode.Premultiply: materialOptions.srcBlend = SurfaceMaterialOptions.BlendMode.One; materialOptions.dstBlend = SurfaceMaterialOptions.BlendMode.OneMinusSrcAlpha; break; // This isn't supported in HDRP. case AlphaMode.Multiply: materialOptions.srcBlend = SurfaceMaterialOptions.BlendMode.One; materialOptions.dstBlend = SurfaceMaterialOptions.BlendMode.OneMinusSrcAlpha; break; } } materialOptions.zTest = SurfaceMaterialOptions.ZTest.LEqual; materialOptions.zWrite = SurfaceMaterialOptions.ZWrite.Off; } materialOptions.cullMode = twoSided ? SurfaceMaterialOptions.CullMode.Off : SurfaceMaterialOptions.CullMode.Back; return(materialOptions); }
void ChangeBlendMode(ChangeEvent<Enum> evt) { // Make sure the mapping is correct by handling each case. AlphaMode alphaMode = GetAlphaMode((HairMasterNode.AlphaModeLit)evt.newValue); if (Equals(m_Node.alphaMode, alphaMode)) return; m_Node.owner.owner.RegisterCompleteObjectUndo("Alpha Mode Change"); m_Node.alphaMode = alphaMode; }
/// <summary> /// Sets the alpha mode to the input options. /// </summary> /// <param name="inputOptions">Pointer to input options object.</param> /// <param name="alphaMode">Alpha mode enumeration.</param> public void SetInputOptionsAlphaMode(IntPtr inputOptions, AlphaMode alphaMode) { if (inputOptions == IntPtr.Zero) { return; } LoadIfNotLoaded(); Functions.nvttSetInputOptionsAlphaMode func = GetFunction <Functions.nvttSetInputOptionsAlphaMode>(FunctionNames.nvttSetInputOptionsAlphaMode); func(inputOptions, alphaMode); }
/// <summary> /// Initializes a new instance of the <see cref="WritableBitmapResource"/> class. /// </summary> public WritableBitmapResource( Size bitmapSize, BitmapFormat format = BitmapFormat.Bgra, AlphaMode alphaMode = AlphaMode.Straight, double dpiX = 96.0, double dpiY = 96.0) { _loadedBitmaps = new D2D.ID2D1Bitmap[GraphicsCore.Current.DeviceCount]; _bitmapSize = bitmapSize; _pixelFormat = new PixelFormat( (Format)format, (Vortice.DCommon.AlphaMode)alphaMode); _dpiX = dpiX; _dpiY = dpiY; }
/// <summary> /// Initializes a new instance of the <see cref="WriteableBitmapResource"/> class. /// </summary> public WriteableBitmapResource( Size2 bitmapSize, BitmapFormat format = BitmapFormat.Bgra, AlphaMode alphaMode = AlphaMode.Straight, double dpiX = 96.0, double dpiY = 96.0) { m_loadedBitmaps = new D2D.Bitmap[GraphicsCore.Current.DeviceCount]; m_bitmapSize = bitmapSize; m_pixelFormat = new D2D.PixelFormat( (DXGI.Format)format, (D2D.AlphaMode)alphaMode); m_dpiX = dpiX; m_dpiY = dpiY; }
private Gltf.Material GetDefault(string name = "default", AlphaMode mode = AlphaMode.OPAQUE) { return(new Gltf.Material { AlphaMode = mode, Name = name, //EmissiveFactor = new double[] { 1, 1, 1 }, PbrMetallicRoughness = new PbrMetallicRoughness { BaseColorFactor = new double[] { 0.5, 0.5, 0.5, 1 }, MetallicFactor = 1.0, RoughnessFactor = 0.0 } }); }
public override void ReadFromString(ref string[] nodeParams) { try { base.ReadFromString(ref nodeParams); m_currentLightModel = ( StandardShaderLightModel )Enum.Parse(typeof(StandardShaderLightModel), GetCurrentParam(ref nodeParams)); //_isHidden = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); //_shaderCategory = GetCurrentParam( ref nodeParams ); //if ( _shaderCategory.Length > 0 ) // _shaderCategory = UIUtils.RemoveInvalidCharacters( _shaderCategory ); ShaderName = GetCurrentParam(ref nodeParams); if (m_shaderName.Length > 0) { ShaderName = UIUtils.RemoveShaderInvalidCharacters(ShaderName); } //_materialName = GetCurrentParam( ref nodeParams ); //_currentMaterial = AssetDatabase.LoadAssetAtPath<Material>( _materialName ); for (int i = 0; i < m_codeGenerationDataList.Count; i++) { m_codeGenerationDataList[i].IsActive = Convert.ToBoolean(GetCurrentParam(ref nodeParams)); } m_cullMode = ( CullMode )Enum.Parse(typeof(CullMode), GetCurrentParam(ref nodeParams)); m_zWriteMode = ( ZWriteMode )Enum.Parse(typeof(ZWriteMode), GetCurrentParam(ref nodeParams)); m_zTestMode = ( ZTestMode )Enum.Parse(typeof(ZTestMode), GetCurrentParam(ref nodeParams)); m_alphaMode = ( AlphaMode )Enum.Parse(typeof(AlphaMode), GetCurrentParam(ref nodeParams)); m_opacityMaskClipValue = Convert.ToSingle(GetCurrentParam(ref nodeParams)); m_keepAlpha = Convert.ToBoolean(GetCurrentParam(ref nodeParams)); m_castShadows = Convert.ToBoolean(GetCurrentParam(ref nodeParams)); m_queueOrder = Convert.ToInt32(GetCurrentParam(ref nodeParams)); if (UIUtils.CurrentShaderVersion() > 11) { m_customBlendMode = Convert.ToBoolean(GetCurrentParam(ref nodeParams)); m_renderType = ( RenderType )Enum.Parse(typeof(RenderType), GetCurrentParam(ref nodeParams)); m_renderQueue = ( RenderQueue )Enum.Parse(typeof(RenderQueue), GetCurrentParam(ref nodeParams)); } m_lastLightModel = m_currentLightModel; DeleteAllInputConnections(true); AddMasterPorts(); m_customBlendMode = TestCustomBlendMode(); } catch (Exception e) { Debug.Log(e); } }
private SharpGLTF.Schema2.AlphaMode GetAlphaMode(AlphaMode materialAssetAlpha) { switch (materialAssetAlpha) { case AlphaMode.Opaque: return(SharpGLTF.Schema2.AlphaMode.OPAQUE); case AlphaMode.Mask: return(SharpGLTF.Schema2.AlphaMode.MASK); case AlphaMode.Blend: return(SharpGLTF.Schema2.AlphaMode.BLEND); default: throw new ArgumentOutOfRangeException(nameof(materialAssetAlpha), materialAssetAlpha, null); } }
private ISwapChain CreateOrUpdateRenderTarget( IGraphicsDevice device, AlphaMode newAlphaMode, float newDpi, Size newSize, ISwapChain renderTarget) { Size renderTargetSize = new Size((int)renderTarget.Width, (int)renderTarget.Height); bool needsTarget = renderTarget != null; bool alphaModeChanged = renderTarget.AlphaMode != newAlphaMode; bool dpiChanged = renderTarget.LogicalDpi != newDpi; bool sizeChanged = renderTargetSize != newSize; bool needsCreate = needsTarget || alphaModeChanged; if (!needsCreate && !sizeChanged && !dpiChanged) { return(null); } if (newSize.Width <= 0 || newSize.Height <= 0) { // Zero-sized controls don't have swap chain objects return(null); } else if ((sizeChanged || dpiChanged) && !needsCreate) { renderTarget.ResizeBuffersWithWidthAndHeightAndDpi(newSize.Width, newSize.Height, newDpi); renderTargetSize = newSize; //renderTarget.LogicalDpi = newDpi; } else { //renderTarget.Target = this.Device.CreateSwapChain( // newSize.Width, // newSize.Height, // newDpi, // newAlphaMode); renderTarget.AlphaMode = newAlphaMode; //renderTarget.LogicalDpi = newDpi; renderTargetSize = newSize; } return(renderTarget); }
public HairMasterNode.AlphaModeLit GetAlphaModeLit(AlphaMode alphaMode) { switch (alphaMode) { case AlphaMode.Alpha: return HairMasterNode.AlphaModeLit.Alpha; case AlphaMode.Premultiply: return HairMasterNode.AlphaModeLit.Premultiply; case AlphaMode.Additive: return HairMasterNode.AlphaModeLit.Additive; default: { Debug.LogWarning("Not supported: " + alphaMode); return HairMasterNode.AlphaModeLit.Alpha; } } }
public MaterialInputs() { DiffuseColor = new Vector4(0, 0, 0, 1); DiffuseTexture = null; MetallicFactor = 0.0f; RoughnessFactor = 0.0f; MetallicRoughnessTexture = null; EmissiveFactor = new Vector3(0, 0, 0); EmissiveTexture = null; NormalTexture = null; OcclusionTexture = null; AlphaMode = AlphaMode.Opaque; AlphaCutoff = 0.0f; }
public D2DContext GetContext(GraphicsDevice graphicsDevice) { SharpDX.ComObject obj = GetRenderTargetResource(graphicsDevice); D2DContext context = GetOrCreateContext(obj); if (context == null) { return(null); } AlphaMode alphaMode = AlphaMode.Ignore; if (context.DxgiSurface == null || context.DxgiSurface.IsDisposed) { if (obj is SharpDX.DXGI.SwapChain) { var swapChain = (SharpDX.DXGI.SwapChain)obj; context.DxgiSurface = SharpDX.DXGI.Surface.FromSwapChain(swapChain, 0); alphaMode = AlphaMode.Ignore; } else if (obj is SharpDX.Direct3D11.Resource) { context.DxgiSurface = obj.QueryInterface <SharpDX.DXGI.Surface>(); alphaMode = AlphaMode.Premultiplied; } else { return(null); } } if (context.D2DRenderTarget == null || context.D2DRenderTarget.IsDisposed) { var rtProp = new RenderTargetProperties(new PixelFormat(SharpDX.DXGI.Format.Unknown, alphaMode)); var d2drt = new RenderTarget(this.factory2D, context.DxgiSurface, rtProp); d2drt.TextRenderingParams = new RenderingParams(factoryDWrite, 1f, 0f, 0f, PixelGeometry.Flat, RenderingMode.CleartypeGdiClassic); d2drt.TextAntialiasMode = SharpDX.Direct2D1.TextAntialiasMode.Grayscale; context.D2DRenderTarget = d2drt; context.DxgiSurface.Disposing += (o, e) => d2drt.Dispose(); } return(context); }
internal FormatTexture( ReadOnlyMemory <byte> bitData, TextureDesc desc, uint mipCount, LoaderFlags loaderFlags, bool isCubeMap, ReadOnlyMemory <SubresourceData> subresourceData, AlphaMode alphaMode, TexType underlyingTextureType) { Data = bitData; Desc = desc; MipCount = mipCount; LoaderFlags = loaderFlags; IsCubeMap = isCubeMap; SubresourceData = subresourceData; AlphaMode = alphaMode; UnderlyingTextureType = underlyingTextureType; }
public FabricMasterNode.AlphaModeFabric GetAlphaModeLit(AlphaMode alphaMode) { switch (alphaMode) { case AlphaMode.Alpha: return(FabricMasterNode.AlphaModeFabric.Alpha); case AlphaMode.Premultiply: return(FabricMasterNode.AlphaModeFabric.PremultipliedAlpha); case AlphaMode.Additive: return(FabricMasterNode.AlphaModeFabric.Additive); default: { Debug.LogWarning("Not supported: " + alphaMode); return(FabricMasterNode.AlphaModeFabric.Alpha); } } }
public EyeMasterNode.AlphaModeEye GetAlphaModeLit(AlphaMode alphaMode) { switch (alphaMode) { case AlphaMode.Alpha: return(EyeMasterNode.AlphaModeEye.Alpha); case AlphaMode.Premultiply: return(EyeMasterNode.AlphaModeEye.Premultiply); case AlphaMode.Additive: return(EyeMasterNode.AlphaModeEye.Additive); default: { Debug.LogWarning("Not supported: " + alphaMode); return(EyeMasterNode.AlphaModeEye.Alpha); } } }
public static BlendMode ConvertAlphaModeToBlendMode(AlphaMode alphaMode) { switch (alphaMode) { case AlphaMode.Additive: return(BlendMode.Additive); case AlphaMode.Alpha: return(BlendMode.Alpha); case AlphaMode.Premultiply: return(BlendMode.Premultiply); case AlphaMode.Multiply: // In case of multiply we fall back to alpha return(BlendMode.Alpha); default: throw new System.Exception("Unknown AlphaMode: " + alphaMode + ": can't convert to BlendMode."); } }
public Material (Int32 _baseColorTexture = -1, Int32 _metallicRoughnessTexture = -1, Int32 _normalTexture = -1, Int32 _occlusionTexture = -1) { workflow = Workflow.PhysicalyBaseRendering; baseColorTexture = _baseColorTexture; metallicRoughnessTexture = _metallicRoughnessTexture; normalTexture = _normalTexture; occlusionTexture = _occlusionTexture; emissiveTexture = -1; alphaMode = AlphaMode.Opaque; alphaCutoff = 1f; metallicFactor = 1f; roughnessFactor = 1; baseColorFactor = new Vector4 (1); emissiveFactor = new Vector4 (1); metallicRoughness = true; specularGlossiness = false; }
public static bool TryParse(string value, out AlphaMode type) { switch (value.ToUpper()) { case "OPAQUE": type = AlphaMode.Opaque; return(true); case "MASK": type = AlphaMode.Mask; return(true); case "BLEND": type = AlphaMode.Blend; return(true); default: type = AlphaMode.Opaque; return(false); } }
/// <summary> /// Initializes a new instance of the <see cref="ImageSourceFromWic"/>. /// </summary> public ImageSourceFromWic(DeviceContext2 context2, WIC.BitmapSource wicBitmapSource, ImageSourceLoadingOptions loadingOptions, AlphaMode alphaMode) : this(IntPtr.Zero) { context2.CreateImageSourceFromWic(wicBitmapSource, loadingOptions, alphaMode, this); }
private static extern void nvttSetInputOptionsAlphaMode(IntPtr inputOptions, AlphaMode alphaMode);
public void SetAlphaMode(AlphaMode alphaMode) { nvttSetInputOptionsAlphaMode(options, alphaMode); }
/// <summary> /// Initializes a new instance of the <see cref="PixelFormat"/> struct. /// </summary> /// <param name="format">A value that specifies the size and arrangement of channels in each pixel.</param> /// <param name="alphaMode">A value that specifies whether the alpha channel is using pre-multiplied alpha, straight alpha, whether it should be ignored and considered opaque, or whether it is unkown.</param> public PixelFormat(Format format, AlphaMode alphaMode) { Format = format; AlphaMode = alphaMode; }
/// <summary> /// Current alpha mode /// </summary> public static void SetCurrentAlphaMode(AlphaMode value) { switch (value) { case AlphaMode.DisableAlpha: Device.BlendState = new BlendState() { AlphaSourceBlend = Blend.Zero, AlphaDestinationBlend = Blend.One }; break; case AlphaMode.Default: Device.BlendState = new BlendState() { AlphaSourceBlend = Blend.SourceAlpha, AlphaDestinationBlend = Blend.InverseSourceAlpha }; break; case AlphaMode.SourceAlphaOne: Device.BlendState = new BlendState() { AlphaSourceBlend = Blend.SourceAlpha, AlphaDestinationBlend = Blend.One }; break; case AlphaMode.OneOne: Device.BlendState = new BlendState() { AlphaSourceBlend = Blend.One, AlphaDestinationBlend = Blend.One }; break; } }
private static extern void nvttSurfaceSetAlphaMode(IntPtr surface, AlphaMode alphaMode);