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 stripe103 · Nov 13, 2013 at 01:12 AM · shaderwater

Can you make the Simple Water Shader gradient support transparency?

Hello there.

I would just like to know if anyone knows of a way to edit the Simple Water Shader so that it, via the gradient, allows you to change not only color, but transparency as well.

I've seen it here and there edits of it that makes the entire water mesh semi-transparent, but this is not what I want and doesn't seem to work properly anyway, as it only shows shadows underneath and not the actual mesh colors.

Currently, the only thing that happens if you apply transparency to the gradient image, is that it makes the color more white, which would work if I only had a white color underneath, which I do not =)

Basically I'd like it to be more transparent when you look straight down into the water and another color when looking across it.

So yeah, does anyone know of any edit to make this possible?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Ferb · Sep 30, 2014 at 04:48 PM

First, may I say that being more transparent depending on the view angle sounds like a great idea!

If you look at the source in FX-Water Simple.shader, it already has a value called 'Fresnel' worked out. I'm not sure where the name Fresnel comes from, but apparently that's working out exactly what you want to know - whether you're looking straight at the water or looking across it.

Since it's worked out from a dot product, I'd say the Fresnel is 1 when looking straight at the water, so you probably want the alpha to be something like 1-(0.5*Fresnel). (It's possible it'll be -1 when looking at the water or something though - a bit of trial and error may be necessary.)

Now I've never programmed surface shaders (only vertex/fragment shaders), so I can't say for sure whether it works the same way as the stuff I've done before, but I suspect that you'll set the alpha by setting col.a, and that the alpha value won't have any effect until you add a line like 'Blend SrcAlpha OneMinusSrcAlpha' just underneath the '#CGPROGRAM' line, and change the tags to '"Queue"="Transparent" "RenderType"="Transparent"'.

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

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

17 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

Related Questions

Make indie water look good when stretched out? 2 Answers

How can I make subnautica style water? 0 Answers

Shader add vertex displacement 0 Answers

fx water shader option is not showing in unity 2017, why? 1 Answer

Setting unitys new shader graphs properties via C# 2 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