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 1elfdragon1 · Jun 21, 2015 at 02:17 PM · shaderlightingwatertransparent

Transparent Shader/Water With Shadows

I modified the Unity water shader (not water4, the other one), but i got some trouble with lighting. There are two issues;

EDIT:
I rewrote the shader to a surface shader instead of fragment, so I don't need a refraction camera anymore and the shadows also show under the plane, the only problem left is the shadows on the surface itself. how can the surface receive shadows. I got a little idea to create a ortho-cam facing from the surface to the main light (sun light), and check in the renderer texture in the shader by color picking or a depth texture. anyone knows how to do this?

OLD (fragment shader issue):

First, the shadows stop under water, this is because the render textures don't render the shadows. I already tried to use forward rendering path, but no effect.

And last, I used this: "http://answers.unity3d.com/questions/180298/how-do-i-sample-a-shadowmap-in-a-custom-shader.html" to get shadows casting on the water surface. but when enabling "Receive shadows" in the mesh renderer component, it becomes completely transparent. But I can manage to get the shadows on the surface but then the depth texture don't work anymore.

Does anyone know how to fix this?

(And sorry for my bad English..)

alt text

Note the shadows stop when reaching the plane

untitled.png (363.9 kB)
Comment
Add comment · Show 1
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 Gaming-Dudester · Jun 25, 2015 at 06:02 PM 0
Share

Where did u get the sand texture? It looks good.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Eno-Khaon · Jun 26, 2015 at 09:00 AM

Just to note: In Unity's shader pipeline, the shadows are applied to all objects rendered prior to "Geometry+500" -- Starting at +501, shadows are no longer applied, for the purposes of transparent objects and the like.

Therefore, among other options, you can use a GrabPass to view the area under the water, then use the rendering queue to determine when it's drawn.

Aside from that, messing with shadow settings (such as having water NOT cast a shadow) should be able to help you fine-tune the actual detail of the shadows.

Now, having said all of that, any vertex animation won't inherently be applied to the shadow-generating process without creating a custom shadow caster pass, so the more detail you have on your water surface, the harder it becomes to fully support it visually, unless you want a flat shadow plane regardless of the current state of vertex positions.

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

23 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

Related Questions

Semitransparent shader not visible in front of objects 1 Answer

How can I get correct lighting on a low poly water shader? 1 Answer

Diffuse 2-sided shader only accepts light on one side? 2 Answers

Underwater God Ray 3 Answers

Help with making a water shader receive light 1 Answer


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