Is a dissolve like effect possible in unity: this is from fear3 It would be a some how animated noise which is used as a Opacity map. And it's not a regular noise. It's more like Perlin. And what i wonder about is, the edges get filled with a third red map. Any wisdom would be welcome. Is i t even possible to realtime draw on a map in unity ?
Check out http://unity3d.com/support/resources/unite-presentations/shader-tricks-in-game-production At least I think that was the one, I didn't want to download it again to make sure. The shader they use to spread across the terrain might give you some ideas of how it could be done.
Should be kinda easy to create using clip() (hoping that this function exists in CG, there is also something like that in GLSL, I think it is called discard and it is clip() in HLSL). Just look up from a noise texture which maybe even has some black to white gradient in it to have few bigger parts disappear and not only many small ones and substract a value which is 0 in the biginning and growing up to 1 from it. Use the result as parameter for clip(). The red outline around the dissolving parts can be determined in a similar way. The red outline around the whole object looks like a simple dot product of the camera direction and the normal. Add some shading and you are done .
Thanks i watched the videos. Makes totaly sense but is pretty advanced stuff to me. But i will keep track. I want this shader to blend in some objects.
Hmm, just had an idea about this. Make a second texture that's a grayscale image. Make the chunks you want to appear first black, the ones you want to appear last white, smooth gradient in between. Pass a value from your shader from your program, increasing this value from 0 to 1 over time. The shader could compare the value passed from the program to the red channel of the grayscale image. If the value is greater than the red value, render the pixel from the diffuse map/normal/etc, if not, render it w/ a 0 alpha value. If it's within a certain range then render it dark red with a 1 alpha value. This would give you decent control over what parts appeared in what order, how fast, etc. EDIT: Thinking more about this, you could just the existing Transparent Cutout shaders, then just use the alpha channel of your texture to determine what appears when. Change the alpha cutoff value to make more stuff appear.
I thought I'd have a go at some dissolve shaders (compatible with Unity 3). The red channel of the noise texture determines the dissolve pattern, and the alpha of the main color determines the cutoff. Dissolve diffuse Dissolve specular Dissolve reflective Noise texture
to BobTheFish: i don't know how to use your shaders to get a animated effect would it be possible if you create a package with an example scene so i can see the end result working? that would be very nice, thnx in forward
wow thnx - it works perfectly! that's an amazing effect and so simple to use! thnx to BobTheFish Meh11 for explaining me!!! one more little thing xD is there somehow a way to get those little red "glowin" edges working, like on the pictures above ? xD I really appricate if others are not avaricious or selfish! one more...THNX AGAIN! =)
is there somehow a way to get those little red "glowin" edges working, like on the pictures above ? =)
but where or how to use "this term" to get the red edges? i use the shader like he posted it. do i need to animate a material value ? cause nothing seem to work i also used his noise texture. the vanishing happens. but the red edges don't! Also i miss a emessive value. and i tried to copy emessive strings into the shader, but without success. :/ scripting is not my fortitude
please someone can help me? how to use thi value? > "BobTheFish used this _Color.a - texd.r as alpha value" it's in the shader. but how do i activate it so i can see the red borders like on the photos shown above?
Please can anyone response to my issue? Shader works. But the red edges not. Don't know how. Tried everything.
Sorry I took so long to reply, I have been away from the forums for a while. I hadn't tried red edges but I modified my shader a bit to see if it could do what you wanted. Try replacing the section from "void surf" to "ENDCG" with this: Code (csharp): void surf (Input IN, inout SurfaceOutput o) { half4 tex = tex2D(_MainTex, IN.uv_MainTex); half4 texd = tex2D(_DissolveTex, IN.uv_DissolveTex); o.Albedo = tex.rgb * _Color.rgb; o.Gloss = tex.a; o.Alpha = _Color.a - texd.r; if ((o.Alpha < 0)(o.Alpha > -0.1)(_Color.a>0)) { o.Alpha = 1; o.Albedo = float3(1,0,0); } o.Specular = _Shininess; } ENDCG The -0.1 in there can be used to modify the thickness of the redness, for example -0.2 is thicker and -0.05 is thinner. If you're using my noise texture, you'll probably want to turn its tiling down to 0.1 or less to get a decent effect.
a friend of mine recently put one up on the unify wiki, i made a thread for him here http://forum.unity3d.com/threads/80682-Dissolve-With-Texture-(shader) and you can take a look to see if its close to something you were looking for
Hi Master =D i changed the strings exactly with the new ones, but the result is a defekt shader. shader changes objects to purple with an error message: "SurfShaderInternalFunc", undefined variable "_Shininess" at line 34 xO If i would be able to write a shader, i would not bother you! By the way, is it somehow possible to make that shader working with emessive? Beside the fact i don't know how to delete things like specular values, cause i'd like to optimize the shader for iOS purposes. A honest big THNX for your efforts!!!!!!!!!!!
I got it working by deleting the "o.Specular = _Shininess;" string xD, since i don't need any specular effects! But still i am trying to get the shader working with emessive. no matter what i try, which line i take out and replace from other emessive shaders. i don't get it working by the way - the effect with the red edges looks crispy-superordenary-extra-coool!!! =D are you working in the game industry? greetings and best regards!!! and another BIG THNX for you!!!!!!
That top pictured effect is just what I'm looking for the death of my "Alien Zombies" only with green blood Now does anyone have a tutorial on how to do this step by freaking step??
Yup, and what I need to know, is what goes where and how to set it up... near I can tell no one has mentioned how to set something like this up?? Unless I missed something?
Still i need the shader with emessive color values, so i can use it for IOS purposes. please!!!! someone who can help me on that issue?
would anyone please give me a hint what causes to stop emessive color change lines in that shader, so i dont need to use a realtime lightsource? as a non scripter i allready tried everything to get it working, but without success. the goal would be a iOS shader.
Code (csharp): // Created by Nils Daumann on 04.06.2011. // Copyright (c) 2011 Nils Daumann // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // www.slindev.com Shader "SlinDev/Mobile/Special/TexDissolveColNocull" { Properties { _Color("Dissolve Color (RGB), Range (A)", Color) = (1.0, 1.0, 1.0, 1.0) _AlphaDisc("Dissolve state", Range(0, 1)) = 0.5 _MainTex("Base (RGB), Dissolve Mask (A)", 2D) = "white" {} } //GLSL shader used on devices rendering with OpenGL ES 2.0 SubShader { Tags {"IgnoreProjector"="True" "RenderType"="TransparentCutout"} Pass { Tags {"LightMode" = "Always"} Cull Off GLSLPROGRAM #pragma fragmentoption ARB_precision_hint_fastest uniform vec4 _Color; uniform float _AlphaDisc; uniform sampler2D _MainTex; varying mediump vec2 texcoord; #ifdef VERTEX void main() { gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex; texcoord = gl_MultiTexCoord0.xy; } #endif #ifdef FRAGMENT void main() { gl_FragColor = texture2D(_MainTex, texcoord); if(gl_FragColor.a < _AlphaDisc+_Color.a) gl_FragColor.rgb = _Color.rgb; if(gl_FragColor.a < _AlphaDisc) discard; } #endif ENDGLSL } } //CG/HLSL shader used on all other devices with shader support SubShader { Tags {"IgnoreProjector"="True" "RenderType"="TransparentCutout"} Pass { Tags {"LightMode" = "Always"} Cull Off CGPROGRAM #pragma exclude_renderers gles #pragma vertex vert #pragma fragment frag #pragma fragmentoption ARB_precision_hint_fastest uniform float4 _Color; uniform float _AlphaDisc; uniform sampler2D _MainTex; struct appdata_base { float4 vertex : POSITION; float4 texcoord : TEXCOORD0; }; struct v2f { float4 pos : POSITION; float2 texcoord : TEXCOORD0; }; v2f vert(appdata_base v) { v2f o; o.pos = mul(UNITY_MATRIX_MVP, v.vertex); o.texcoord.xy = v.texcoord.xy; return o; } float4 frag(v2f i) : COLOR { half4 Color = tex2D(_MainTex, i.texcoord); if(Color.a < _AlphaDisc+_Color.a) Color.rgb = _Color.rgb; clip(Color.a-_AlphaDisc); return Color; } ENDCG } } //Fallback for devices not supporting shaders at all SubShader { Tags {"IgnoreProjector"="True" "RenderType"="TransparentCutout"} Pass { Tags {"LightMode" = "Always"} Cull Off AlphaTest Greater [_AlphaDisc] SetTexture [_MainTex] { ConstantColor [_Color] Combine texture*constant, texture*constant } } } }
My goal is to modify this shader so it works only with emessive, without the need for a lightsource. Code (csharp): Shader "Dissolve/DissolveDiffuse" { Properties { _Color ("Main Color", Color) = (1,1,1,1) _MainTex ("Base (RGB)", 2D) = "white" {} _DissolveTex ("Dissolve (R)", 2D) = "white" {} } SubShader { Tags {"IgnoreProjector"="True" "RenderType"="TransparentCutout"} LOD 300 CGPROGRAM #pragma surface surf Lambert alphatest:Zero sampler2D _MainTex; sampler2D _DissolveTex; float4 _Color; struct Input { float2 uv_MainTex; float2 uv_DissolveTex; }; void surf (Input IN, inout SurfaceOutput o) { half4 tex = tex2D(_MainTex, IN.uv_MainTex); half4 texd = tex2D(_DissolveTex, IN.uv_DissolveTex); o.Albedo = tex.rgb * _Color.rgb; o.Gloss = tex.a; o.Alpha = _Color.a - texd.r; if ((o.Alpha < 0)(o.Alpha > -0.07)(_Color.a>0)) { o.Alpha = 1; o.Albedo = float3(1,0.5,0); } } ENDCG } Fallback "Transparent/Cutout/VertexLit" }
even if this works, it's not an optimized shader for iOS. addition: sorry it seems to be a nice shader, just with a different tecnique. addition#2: to clarify my inaccurate words, i thought the shader is for standalone games, cause i didn't figure out how it works. That's why i used the blindfold words "not optimized". i apologize for that!
It is probably as optimized as it can be. I bet that everything you would consider more optimized, would be slower.
sorry for misunderstanding, i tried your shader again and i realized you wrote that one different. so i need a alpha channel with a noise to get the effect working, as you wrote before. i see. but my question and problem is now. the dissolve effect shell appear on wrecks from destroyed enemies. the thing is, all the enemies and the wrecks of them are sharing the same texture but not the same material by using the dissolve effect from bobthefish. if i integrate now a alpha channel on this texture and save this to a png, with the goal of using your shader, then i have a transparent texture on all enemies, and the noisy transparencies of the alpha channel effects also on the enemies, or? and beside that isn't that taking to much performance and brings z-order problems, if my enemies are getting consecutive by an z-order? sorry for misinterpretation, if so! and BIG THNX too for your efforts!
Guys stop with the begging stuff now, you have a perfectly good shader and it didn't cost anything. Consider paying for a great shader if you want further support from the authors. iOS will be very slow at this stuff unless you're using ipad2, its simply the nature of mobile. To fix your issue, just swap the material from a normal material to this dissolve effect when required by changing renderer.material = newmat;
in the 1st moment i thought the shader is a joke. i realized the functionality of it after i looked another time on it. pitty you didn't read my last post to that. i apologized for that and one hand washes the other! i think so... peace!
i changed the texture into a TIFF with Alpha Channel. Your Version is much more editable, then the other shader, cause the color value of the dissolve is also animatable. i still miss the emessive value, but i am anyway thankfull for this shader!
i have a problem: i am working on Unity WINDOWS and MAC OSX. The shader works on Windows but not on Unity MAC. I also looked in build settings for "switch platform" - its on iOS - and also the emulation on OpenGL 2.0. even without emulation, the shader is not working. i just see a bright blinking, when animation material parameter changes somewhere. On Unity Windows everything works perfect with the same scene! What can be the problem? I need that shader working on iOS please help!!
I can't help with that shader but here's my code updated to be emissive, and it also has function to easily change edge colour and width. If you want it diffuse instead of emissive, just replace any word "Emissive" to "Albedo". Code (csharp): Shader "Dissolve/DissolveEmissive" { Properties { _Color ("Main Color", Color) = (1,1,1,1) _EdgeColor ("Edge Color", Color) = (1,0,0) _EdgeWidth ("Edge Width", Range(0,1)) = 0.1 _MainTex ("Base (RGB)", 2D) = "white" {} _DissolveTex ("Dissolve (R)", 2D) = "white" {} } SubShader { Tags {"IgnoreProjector"="True" "RenderType"="TransparentCutout"} LOD 300 CGPROGRAM #pragma surface surf Lambert alphatest:Zero sampler2D _MainTex; sampler2D _DissolveTex; float4 _Color; float3 _EdgeColor; float _EdgeWidth; struct Input { float2 uv_MainTex; float2 uv_DissolveTex; }; void surf (Input IN, inout SurfaceOutput o) { half4 tex = tex2D(_MainTex, IN.uv_MainTex); half4 texd = tex2D(_DissolveTex, IN.uv_DissolveTex); o.Emission = tex.rgb * _Color.rgb; o.Gloss = tex.a; o.Alpha = _Color.a - texd.r; if ((o.Alpha < 0)(o.Alpha > -_EdgeWidth)(_Color.a>0)) { o.Alpha = 1; o.Emission = _EdgeColor; } } ENDCG } Fallback "Transparent/Cutout/Soft Edge Unlit" }
Aww I wish Nah I have no training so I basically don't know what I'm doing Yep just copy the code from my post just above, paste it in a new shader file, make a new material, and choose the right shader. Make sure you have a dissolve texture like the one on page 1 of this thread.
I am curious, does these shaders work on fixed function pipeline (eg. OpenGL ES 1.1 - Pre-iPhone 3GS)?? I know for certain a dissolve shader that works for 2G iDevices exist - take a look at the video below, scroll to 0:48 and watch closely at the airship's destruction : This game "AirAttack" was made in Unity, and I bought it on iPod 2G and I can confirm that effect looks the same on iPod 2G. So does anyone know how it is achieved in OpenGL ES 1.1 (MBX Lite)?
Bly the looks of it, a mix between a vertex-based blending shader using an alpha texture. That should be quite quick on iPod2G hardware. It's also how we used to do dissolves on DX7 and below Edit: A simpler way of doing that effect is just to modulate the alpha at each vertex in a script.
Feels good when good stuff are being shared. I think what Sicklilmonky meant is that we need some kind of script changing the dissolve variable. The live demo looks just how it's supposed to be! Did anyone try this on iOS?
Hey, I have recently released a Dissolve Shaders Package, which includes 5 different dissolve shaders and it's available on the Assets Store. http://u3d.as/content/andrew-m-/dissolve-shaders-package/2H6
Hope this can help it is simple dissolve http://www.unifycommunity.com/wiki/index.php?title=Dissolve_With_Texture
Hey guys great thread, I haven't tried any of these cool shaders yet but would it be possible to have another texture replacing the existing one instead of the cut out effect, if so which channel or slot would have to be modified ? THX a lot
@cedrico in fact I just accomplished to recreate that effect and added it to my Dissolve Shader Pack Here's a simple preview
Been trying to get bob's shader working by slowly reducing the alpha of the main color, but I get no effect. Once I get to .6 alpha, the object completely disappears. I'm using the provided noise texture and unity 3.5. Is there something else I need to do to animate it?