Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by PommPoirAbricot · Jun 17, 2014 at 11:32 AM · shadermobiletransparencyreflectionspecular

[FOUND] Mobile shader with those mixed effects : Transparency, specular, diffuse, cubemap reflection ?

Hello everybody

Does you know some free or paid mobile shaders with those combined/mixed effects ?

  • Transparency

  • specular

  • diffuse

  • cubemap reflection

Thanks a lot for your answers

Edit :

Good news ! I solved my problem with ShaderForge

The shader that matchs my effects is this one :

Shader "Shader Forge/chrome" { Properties { _Color ("Color", Color) = (0.8161765,0.8161765,0.8161765,1) _Diffuse_Tex ("Diffuse_Tex", 2D) = "white" {} _Reflect ("Reflect", Cube) = "_Skybox" {} _Alpha ("Alpha", Range(0, 1)) = 1 [HideInInspector]_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5 } SubShader { Tags { "IgnoreProjector"="True" "Queue"="Transparent" "RenderType"="Transparent" } Pass { Name "ForwardBase" Tags { "LightMode"="ForwardBase" } Blend SrcAlpha OneMinusSrcAlpha ZWrite Off

         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag
         #define UNITY_PASS_FORWARDBASE
         #include "UnityCG.cginc"
         #pragma multi_compile_fwdbase
         #pragma exclude_renderers xbox360 ps3 flash d3d11_9x 
         #pragma target 3.0
         uniform float4 _LightColor0;
         uniform float4 _Color;
         uniform samplerCUBE _Reflect;
         uniform sampler2D _Diffuse_Tex; uniform float4 _Diffuse_Tex_ST;
         uniform float _Alpha;
         struct VertexInput {
             float4 vertex : POSITION;
             float3 normal : NORMAL;
             float2 texcoord0 : TEXCOORD0;
         };
         struct VertexOutput {
             float4 pos : SV_POSITION;
             float2 uv0 : TEXCOORD0;
             float4 posWorld : TEXCOORD1;
             float3 normalDir : TEXCOORD2;
         };
         VertexOutput vert (VertexInput v) {
             VertexOutput o;
             o.uv0 = v.texcoord0;
             o.normalDir = mul(float4(v.normal,0), _World2Object).xyz;
             o.posWorld = mul(_Object2World, v.vertex);
             o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
             return o;
         }
         fixed4 frag(VertexOutput i) : COLOR {
             i.normalDir = normalize(i.normalDir);
             float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);

/////// Normals: float3 normalDirection = i.normalDir; float3 viewReflectDirection = reflect( -viewDirection, normalDirection ); float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz); ////// Lighting: float attenuation = 1; float3 attenColor = attenuation _LightColor0.xyz; /////// Diffuse: float NdotL = dot( normalDirection, lightDirection ); float3 w = texCUBE(_Reflect,viewReflectDirection).rgb*0.5; // Light wrapping float3 NdotLWrap = NdotL ( 1.0 - w ); float3 forwardLight = max(float3(0.0,0.0,0.0), NdotLWrap + w ); float3 diffuse = forwardLight attenColor + UNITY_LIGHTMODEL_AMBIENT.rgb; float3 finalColor = 0; float3 diffuseLight = diffuse; float2 node_58 = i.uv0; finalColor += diffuseLight (tex2D(_Diffuse_Tex,TRANSFORM_TEX(node_58.rg, _Diffuse_Tex)).rgb*_Color.rgb); /// Final Color: return fixed4(finalColor,_Alpha); } ENDCG } Pass { Name "ForwardAdd" Tags { "LightMode"="ForwardAdd" } Blend One One ZWrite Off

         Fog { Color (0,0,0,0) }
         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag
         #define UNITY_PASS_FORWARDADD
         #include "UnityCG.cginc"
         #include "AutoLight.cginc"
         #pragma multi_compile_fwdadd
         #pragma exclude_renderers xbox360 ps3 flash d3d11_9x 
         #pragma target 3.0
         uniform float4 _LightColor0;
         uniform float4 _Color;
         uniform samplerCUBE _Reflect;
         uniform sampler2D _Diffuse_Tex; uniform float4 _Diffuse_Tex_ST;
         uniform float _Alpha;
         struct VertexInput {
             float4 vertex : POSITION;
             float3 normal : NORMAL;
             float2 texcoord0 : TEXCOORD0;
         };
         struct VertexOutput {
             float4 pos : SV_POSITION;
             float2 uv0 : TEXCOORD0;
             float4 posWorld : TEXCOORD1;
             float3 normalDir : TEXCOORD2;
             LIGHTING_COORDS(3,4)
         };
         VertexOutput vert (VertexInput v) {
             VertexOutput o;
             o.uv0 = v.texcoord0;
             o.normalDir = mul(float4(v.normal,0), _World2Object).xyz;
             o.posWorld = mul(_Object2World, v.vertex);
             o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
             TRANSFER_VERTEX_TO_FRAGMENT(o)
             return o;
         }
         fixed4 frag(VertexOutput i) : COLOR {
             i.normalDir = normalize(i.normalDir);
             float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);

/////// Normals: float3 normalDirection = i.normalDir; float3 viewReflectDirection = reflect( -viewDirection, normalDirection ); float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w)); ////// Lighting: float attenuation = LIGHT_ATTENUATION(i); float3 attenColor = attenuation _LightColor0.xyz; /////// Diffuse: float NdotL = dot( normalDirection, lightDirection ); float3 w = texCUBE(_Reflect,viewReflectDirection).rgb*0.5; // Light wrapping float3 NdotLWrap = NdotL ( 1.0 - w ); float3 forwardLight = max(float3(0.0,0.0,0.0), NdotLWrap + w ); float3 diffuse = forwardLight attenColor; float3 finalColor = 0; float3 diffuseLight = diffuse; float2 node_59 = i.uv0; finalColor += diffuseLight (tex2D(_Diffuse_Tex,TRANSFORM_TEX(node_59.rg, _Diffuse_Tex)).rgb*_Color.rgb); /// Final Color: return fixed4(finalColor * _Alpha,0); } ENDCG } } FallBack "Diffuse" CustomEditor "ShaderForgeMaterialInspector" }

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by PommPoirAbricot · Jun 18, 2014 at 12:26 PM

Solution FOUND !! See my Edit in my question !

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by screenname_taken · Jun 17, 2014 at 11:51 AM

Unity already has them and they work fine. Do you have any particular issues with the shaders?

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image PommPoirAbricot · Jun 17, 2014 at 11:54 AM 0
Share

No particular issues Do you have please the names of the shaders matching those 4 effects at the same time ?

avatar image tanoshimi · Jun 17, 2014 at 12:06 PM 0
Share

Reflective/Specular and Transparent/Specular seem to be what you're after.

avatar image PommPoirAbricot · Jun 17, 2014 at 12:16 PM 0
Share

Almost but

it lacks the transparency for Reflective/Specular

it lacks the reflection for Transparent/Scpecular

And those shader must works for $$anonymous$$obile

avatar image tanoshimi · Jun 17, 2014 at 12:23 PM 0
Share

The source for the built-in shaders is available at http://download.unity3d.com/download_unity/builtin_shaders-4.5.1.zip, and it's trivial to combine the bits of each shader that you want.

There's no reason why those shaders won't work on mobile - sure, it's generally not a good idea to use complex shaders on mobile, and you'll be unlikely to get good performance, but if you're set on having all those features then you're inevitably going to take a performance hit.

avatar image PommPoirAbricot · Jun 17, 2014 at 12:33 PM 0
Share

Ok i will try that, but i still remain open about ideas Thanks tanoshimi

Edit : Ok i have no idea how to add transparancy to Reflective/Specular shader Can someone please help me ?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

transparent + reflection shader (river water problems) 2 Answers

Creating realistic glass 4 Answers

Check performance of shader for mobile 1 Answer

Specular map to decide reflection 0 Answers

Metallic/Specular map broke fading in build 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges