Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 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 /
avatar image
0
Question by reissgrant · Oct 04, 2010 at 02:48 PM · shadows

Any way to access the Cascaded Shadow Map texture?

I want to perform some effects only on the shadowed areas of the scene.

Is there any way to access the shadows texture of the scene?

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 skovacs1 · Oct 04, 2010 at 05:30 PM

It's not that there is anything such as a shadows texture, necessarily. I think your understanding of 3D graphics may be a bit confused, but resolving that goes far beyond simply providing a solution to your use case.

There are 3 ways that you can really create shadows:

  1. Let Unity's rendering calculate shadows for you
  2. Create shadows in a projector
  3. Bake shadows into a texture or lightmap

How are you creating your shadows?

The general solution might be to author an image effect (Pro Only) which will detect shadowed areas based on some computation of what you see as shadowed. This depends on what you would define as shadowed and is quite subjective to your use case. One way could be to use the overall intensity of each pixel in the image for example.

  1. If you are letting the renderer do your shadows, to apply effects to the shadowed areas, you could author a shader which computes the lighting component and performs your effect based on the value. You might consider doing this as a separate render with shader replacement.

  2. If you are using projected shadows, then you could consider doing changes to your cookie or light. A shader solution above might also work. Anything more complex might generally require a second render pass and manipulation of a renderTexture (Pro Only) to get the pixels being hit by your shadow.

  3. If you have baked shadows, you could apply effects to the textures in some script since they are just assets. You could also generally write a shader which gets the shadowed values from the texture or baked lighting texture and applies some effect based on that, but that's more expensive and needless when you could do the work in advance with a script you run in the editor beforehand. If your shadows are baked into your actual texture, depending on your effects, you could apply them directly to the texture where it is shadowed outside of Unity.

Some of this also depends on what kind of effects you are trying to accomplish. If they are just simple visual effects which change the surface's appearance with respect to lighting, you can generally achieve this with shaders. One shader which use to be used in case 1. and 2. was this desaturate darks shader, but it hasn't been updated for Unity 3 and would probably require some tweaking if not a full re-write into a surface shader. It works by getting the lighting component and applying some changes based on this value.

Comment
Add comment · Show 3 · 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 reissgrant · Oct 04, 2010 at 06:51 PM 0
Share

When I say shadow texture, I mean the cascaded shadow map that is generated from my main directional light. Specifically, "_Shadow$$anonymous$$apTexture" in the "Internal-PrePassCollectShadows" if that is even accessible. As a last resort I will consider calculating either a simple Lambert term or do a shader replace - render to texture with a white color. After I deter$$anonymous$$e what is in direct light, I'd like to mask (or exclude from calculation) SSAO in those areas.

avatar image skovacs1 · Oct 05, 2010 at 06:46 PM 0
Share

_Shadow$$anonymous$$apTexture in Internal-PrePassCollectShadows? That sounds fairly low level and from my knowledge of Unity, inaccessible.

avatar image skovacs1 · Oct 05, 2010 at 06:46 PM 0
Share

If you're trying to selectively omit objects from the SSAO image effect, then I'd recommend doing a quick render pass with replaced shaders (grayscale is fine) to render to a texture in your SSAO script's SSAO material and then in the composite pass of the SSAO shader, have it use the texture that you've added as a mask by doing something like multiplying the ao term by your mask's pixel values. This way wherever your mask says not to apply SSAO, it won't.

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

No one has followed this question yet.

Related Questions

Shadows not working 0 Answers

Lightmapped terrain no shadow from dynamic objects 0 Answers

Change Mesh Renderer size property? 2 Answers

Shadows Are Too Dark 3 Answers

Very Strange Realtime Shadows 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