Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 ownerfate · Sep 06, 2015 at 08:39 PM · shaderstransparencyhair

trying to modify this shader for hair.

Hi, i have been trying to find shaders close to the one i use in my game, basically it's a mobile shader, which has cutoff and softness for hair, and is a diffused shader. - the closest things i have come to find are:

Vegetation shaders, ( really great, has diffuse, but is extremely dark. )

transparent/cutout/diffuse soft edge, is ok, but it lacks, a lot. ( bad quality )

and lastly ( the current one i use ) -- CutoutMob shader. ( this is the best one i have found so far. ) found it a year ago, never really used it for hair, until i got tired of trying to find replacement shaders for the vegetation.

i don't have 20 bucks to spend on stuff in the asset store at the moment, or time to update to unity 5.1 ( it was a pain getting my project back to working order after upgrading to 4.6. ( current version )

the only problem is, this shader is showing the object, when it's not supposed to. ( when selected, and really apparent when looking at it in an different angle.)

this is a photo of what i'm talking about.

alt text

and here is the shader's script: ( Unaltered )

      Shader "Custom/CutoutMob" {
     Properties {
     _Color ("Main Color", Color) = (1,1,1,1)
     _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
     _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
     }
      
     SubShader {
     Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
     LOD 200
      
     CGPROGRAM
     #pragma surface surf Lambert alpha noforwardadd
      
     sampler2D _MainTex;
     fixed4 _Color;
     float _Cutoff;
      
     struct Input {
     float2 uv_MainTex;
     };
      
     void surf (Input IN, inout SurfaceOutput o) {
     fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
     o.Albedo = c.rgb;
     if (c.a > _Cutoff)
     o.Alpha = c.a;
     else
     o.Alpha = 0;
     }
     ENDCG
     }
      
     Fallback "Diffuse"
     }

i don't work with shaders a lot, i don't know what i would have to do, to get it to function correctly.

( basically, i don't want the head to show through the hair. )

and here is another side of the hair. ( full glory of the problem ) alt text

if anyone has any advise on how to make the shader, Not show the model's head, while keeping the Alpha cutoff, and diffuse the same, that would be great.

thank you for your time, -

Ownerfate.

tok0002.jpg (16.6 kB)
tok0001.jpg (28.3 kB)
Comment
Add comment · Show 2
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 ownerfate · Sep 06, 2015 at 08:47 PM 0
Share

To the point:

i don't want objects showing through the shader.

( the diffuse and cutoff are fine )

avatar image ownerfate · Sep 06, 2015 at 11:35 PM 0
Share

ok, i found this script, that was actually VERY VERY close to what i'm looking for, if no one can alter the current shader script, here is where i found the one i'm using now.

unity forum link: http://forum.unity3d.com/threads/hair-shader-with-kajiya-kay-specularity-and-proper-sorting.167762/

it's all the way at the bottom.

but here is the script:

   Shader "Transparent/Double-Sided Vertex Lit" {
     Properties {
     _Color ("$$anonymous$$ain Color", Color) = (1,1,1,1)
     _$$anonymous$$ainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
     }
     SubShader {
     Tags {"RenderType"="Transparent" "Queue"="Transparent"}
     // Render into depth buffer only
     Pass {
     ZWrite On
     Blend SrcAlpha One$$anonymous$$inusSrcAlpha
     Color$$anonymous$$ask RGB
     Cull off
     $$anonymous$$aterial {
     Diffuse [_Color]
     Ambient [_Color]
     }
     Lighting On
     SetTexture [_$$anonymous$$ainTex] {
     Combine texture * primary DOUBLE, texture * primary
     }
     }
     }
     }​


UPDATE / Edit

Only works well with certain meshes, not all. ( i'll keep looking )

i tried to post this yesterday, but i think the maintenance on the site affected the submit button.

but, what i found yesterday was a script similar to the one above, this doesn't have soft edge, even though it's a soft edge test.

it's ok, i'll use it for the time being, until i can find what i'm looking for.

Script:

  • i seem to not be able to post the script? the submit button does nothing after i post the script.

0 Replies

· Add your reply
  • Sort: 

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

27 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

Fading objects to transparent - Apply shader with a script? 2 Answers

Character with hair (mobile) 0 Answers

Transparent + affected by light shader 1 Answer

Shader that makes object transparent as light hits it 0 Answers

Don't render an Area behind a plane 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