- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在 Unity game engine 中创建 iOS 应用 .
我正在尝试重写我的着色器,以便使用它的 Material >绽放(发光)效果(如 Halo component )。
一个示例它的外观:
我真的在互联网上搜索了答案,但没有找到任何适合工作人员或适合我的问题的解决方案。
我的着色器的代码:
Shader "Unlit"
{
Properties
{
_MainTex("Base (RGB) Trans (A)", 2D) = "white" {}
_Color("Main Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
LOD 100
Cull off
ZWrite on
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
Lighting Off
SetTexture[_MainTex]
{
constantColor[_Color]
Combine texture * constant, texture * constant
}
}
}
}
最佳答案
着色器程序只是用于在屏幕上绘制三角形的代码。绽放效果是完全不同的野兽,and are screen-space calculations that are done after the geometry is drawn .仅通过修改对象的着色器不会获得光晕效果。
简单地说,使用着色器您永远无法绘制“线外”,此时您需要更改对象无法触及的像素。抱歉,这不在着色器的能力范围内。
不过,您可以通过实现 Image Effect 使其工作脚本,比如 unity 的 built-in bloom effect .将脚本添加到相机并激活相机的 HDR 设置后,您可以使用特殊的着色器来产生光晕,但在此之前不能。
正确设置效果(并在相机上启用 HDR 选项)后,您现在可以使用像素着色器中返回值大于 1 的任何着色器在对象周围生成发光效果。您发布的着色器是旧版着色器程序。这是更新后的代码,其中包含一个 Glow 倍增器:
Shader "Glow" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
_Color ("Color", Color) = (1,1,1,1)
_Glow ("Intensity", Range(0, 3)) = 1
}
SubShader {
Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
LOD 100
Cull Off
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
sampler2D _MainTex;
half4 _MainTex_ST;
fixed4 _Color;
half _Glow;
struct vertIn {
float4 pos : POSITION;
half2 tex : TEXCOORD0;
};
struct v2f {
float4 pos : SV_POSITION;
half2 tex : TEXCOORD0;
};
v2f vert (vertIn v) {
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.pos);
o.tex = v.tex * _MainTex_ST.xy + _MainTex_ST.zw;
return o;
}
fixed4 frag (v2f f) : SV_Target {
fixed4 col = tex2D(_MainTex, f.tex);
col *= _Color;
col *= _Glow;
return col;
}
ENDCG
}
}
}
关于ios - 为shader添加bloom(发光)效果(Unity游戏引擎),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38541925/
我正在尝试在 HTML5 Canvas 上绘制带有背景的字符串。我以 GMail 图标为例,请看这张图片(来自实验室设置页面): 如您所见,图片中的 8 周围有白光。到目前为止,这是我尝试过的: va
我有一个问题!我需要在文本上设置不透明度。 我尝试使用 jquery: $(document).ready(function() { $(".item h2").css({ opacity: 0.5
一直在研究 Scenekit 上的照明,虽然我现在可以应用照明节点来照亮某些东西,但我正在寻找一种从对象内部照明的方法。 举个例子,想象一下 NEON 或将光转换到其他物体上的灯泡。 有什么想法可以实
如何从搜索栏的背景中去除光彩/发光(渐变)。我想用一种颜色替换它。 来自这里: 像这样 最佳答案 使用 searchbar.backgroundImage = //your image here 你可
有什么方法可以在 div 周围添加光晕吗?看看 twitter 登录,输入框周围怎么会有蓝色的光芒,可以为 div 做吗? 最佳答案 CSS3 可以做到这一点 -webkit-box-shadow:0
我想不通这个。当 textarea 在 Firefox 中突出显示时,我试图摆脱那种蓝色光芒。 这是我的 CSS: textarea { margin:0; padding:0;
我有以下 Javascript 可以使文本链接持续发光/脉动。此链接显示同一页面的另一部分,因此我希望它在用户单击后停止。 $(document).ready(function()
一直在研究 Scenekit 上的照明,虽然我现在可以应用照明节点来照亮某些东西,但我正在寻找一种从对象内部照明的方法。 举个例子,想象一下 NEON 或将光转换到其他物体上的灯泡。 有什么想法可以实
我有一个导航菜单,我试图仅使用 CSS3 和 HTML 重新创建它。根据所附图片上的“主页”按钮,该设计要求在当前选择的菜单按钮上发光/发光。仅使用代码就可以实现这种效果,还是我需要使用发光图像?!
我想去除那些圆圈周围的“光晕”。您看到的那些路径是发光本身,而不是带有 2px 红色和蓝色实心环的标记。因此,删除那些路径元素。 highcharts 中应该有一个设置允许我禁用/修改这个“发光”。
我正在 Unity game engine 中创建 iOS 应用 . 我正在尝试重写我的着色器,以便使用它的 Material >绽放(发光)效果(如 Halo component )。 一个示例它的
几天来我一直在努力寻找任何资源来帮助我使用高级着色器语言和 DirectX 9 托管库编写简单的发光/模糊着色器。 我需要做的就是将一系列 CustomVertex.TransformedColore
有没有办法去除 Webkit 中 IFrame 的外发光? 我试过这个: iframe {outline: none; -moz-outline: 0; border: 1px solid #000;
我正在尝试在自定义按钮上实现悬停发光(见下图)。我在 Chrome 中玩游戏,无法通过 -webkit-radial-gradient 获得任何类似的外观。 button
这有点特殊,因此很难选择正确的标题或尝试找到已经存在的修复程序,但无论如何: 当我在网上搜索类似的东西时,我在网上找到了这个代码片段,并决定在我正在从事的元素中使用它: .text-glow:hove
我想知道如何在页面加载后使 div 以特定颜色发光。 Registrer deg 这是我想要发光的 div。谢谢:) 最佳答案 CSS3 可以做到这一点: -webkit-box-shadow:0 0
如果可能的话,我想从文本区域中删除样式并使其全白,没有任何边框或发光。我尝试过在 SO 上找到的不同内容,但没有任何效果(尝试使用 FF 和 Chrome)。 那么,这可能吗?如果可以,应该怎么做?
我正在使用 Window 7。我已经从我的窗口中删除了阴影,但 Visual Studio 2012 似乎忽略了该设置并且无论如何都会绘制阴影(或发光)。有没有办法去除那个阴影/发光? 最佳答案 来自
我想为以下绘图符号设置动画(脉冲、发光)。实现所需行为的最佳方法是什么。谢谢 最佳答案 您不能为绘图符号设置动画。您可以做的是在突出显示的点上放置一个绘图空间注释。创建一个自定义的 CPTLayer
我使用您出色的网站构建了 Accordion ,它取代了我新应用的 SSL 无法使用的旧 Ajax 脚本。 我的审美观有问题。当 Accordion 的标题处于事件/选定状态时,它会在背景周围产生蓝色
我是一名优秀的程序员,十分优秀!