Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
  • Help Room /
avatar image
0
Question by maechtigerhoros · Jul 10, 2017 at 10:28 PM · shadertransparencyrendertextureshadow

Transparent plane with RenderTexture - no show shadows?

Hey Hey, i know there are some more threads about this all over main portals but none really matched my needs...

I am trying to stream a cameras view, which sees objects and shadows but not the surface the shadow receives, to a RenderTexture. To get a shadow on a transparent surface, i found several working shaders like this (https://www.youtube.com/watch?v=M6zFKfF4gOE)

The RenderTexture is supposed to be on a transparent surface as well so it only shows the objects and their shadows. The Problem is, that the receiving plane doesn't show the shadow and i can't see why...

Does anybody have any suggestions?alt text alt text

bildschirmfoto-2017-07-11-um-001204.png (160.1 kB)
bildschirmfoto-2017-07-11-um-001443.png (173.7 kB)
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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by neosca · Jul 11, 2017 at 11:47 AM

I use this shader to create a material which only shows shadows and apply transparency to rest of the area. Create a new shader and copy the below code and compile. Than change the material from Standard to FX>MatteShadow

 Shader "FX/Matte Shadow" {
 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"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
     LOD 200
     Blend Zero SrcColor
  
 CGPROGRAM
  
 #pragma surface surf ShadowOnly alphatest:_Cutoff
  
 fixed4 _Color;
  
 struct Input {
     float2 uv_MainTex;
 };
  
 inline fixed4 LightingShadowOnly (SurfaceOutput s, fixed3 lightDir, fixed atten)
 {
     fixed4 c;
  
     c.rgb = s.Albedo*atten;
     c.a = s.Alpha;
     return c;
 }
 
 void surf (Input IN, inout SurfaceOutput o) {
     fixed4 c = _Color;
     o.Albedo = c.rgb;
     o.Alpha = 1;
 }
 
 ENDCG
 }
 Fallback "Transparent/Cutout/VertexLit"
 }
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 ivank · Aug 24, 2017 at 04:32 PM

@maechtigerhoros @neosca Hello, do I understand correctly that the subject of the question (and answer) is something in 3D graphics commonly called as matte shadow?

I can reccomend the free shader from Unity guy Keigiro Takahashi, which allows to adjust also the color and transparency of the shadows: https://github.com/keijiro/ShadowDrawer

It has however the same drawback as the one provided by Neosca - it does not work against skyboxes - only against the solid color or another object (plane - floor, wall). Unfortunately it seems to be caused by Unity design itself :-(

Hope it helps a little

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 dkollmann · Mar 08, 2018 at 03:29 PM

Does this still work with the current Unity version? I have trouble to get it to work as expected. The shadows are visible but so is the plane.

alt text

Some feedback would be gret since I am unsure if the problem is with my set up or in general with the shader.

Thanks, Daniel


shadowplane.png (183.3 kB)
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

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

Related Questions

Something wrong with the cut out feature of the standard shader? 0 Answers

RenderTexture Scope Effect 0 Answers

FBX Model looks wrong after scaling 0 Answers

How to make dynamic ripple with shader? 0 Answers

How to make 2D Sprite Shadow? 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