HDRP transparency shader casts shadows

Discussion in ' General Graphics ' started by ShushustormMar 28, Search Unity. Log in Create a Unity ID. Unity Forum. Forums Quick Links. Asset Store Spring Sale starts soon! Joined: Jan 6, Posts: Hello everyone! Do you know whether there a way to disable shadows from certain sources?

For example, in a project I am currently working on, I would like the terrain custom-made, not a Unity terrain to only recieve shadows from the main character and not by other sources, including itself. Is that possible? Many thanks in advance, Greetings, Shu. ShushustormMar 28, Joined: Apr 17, Posts: In the Mesh Renderer component you can select if that object will cast and receive shadows. So if there are some objects that you don't want to have a shadow, just disable shadow casting in their Mesh Renderer component.

JuliusMMar 28, Thank you very much! This is exactly what I was looking for! Joined: Dec 9, Posts: 2. You must log in or sign up to reply here. Show Ignored Content. Your name or email address: Password: Forgot your password?By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service.

The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I was trying to get shadows to cast from the Unlit Cutout shader. I don't really know how to do that.

I tried copying the shadow caster sections out of the standard Shader and it compiles, but it doesn't cast shadows. Here is what I have so far:. Learn more. Cast shadows using Unlit shader on Unity 5? Ask Question. Asked 5 years ago. Active 5 years ago. Viewed 4k times. Brendan Green This comment is quite latebut in case someone find it, Add Fallback "VertexLit". Active Oldest Votes. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.

Email Required, but never shown. The Overflow Blog. Q2 Community Roadmap.

unity transparent shader cast shadow

The Unfriendly Robot: Automatically flagging unwelcoming comments. Featured on Meta.Discussion in ' General Discussion ' started by RalstlinJan 24, Search Unity. Log in Create a Unity ID. Unity Forum. Forums Quick Links. Asset Store Spring Sale starts soon! Joined: Jan 12, Posts: I want to know if there is a way to make transparent materials to cast a softer shadow than a wall.

I can make the glass to dont cast shadow, but i cant find how to make the glass to cast soft shadow. Is there a way? Last edited: Jan 24, RalstlinJan 24, Joined: Dec 4, Posts: 3, Joined: Jan 26, Posts: You fake it. Use photoshop or gimp. Create your shadow, change the opacity, save it as a png, import it into unity, place it in the scene. Joined: Nov 12, Posts: 7, ArowxJan 26, My question was if is posible to make that a shader cast a shadow less dark than a wall, like some light cross through it.

RalstlinJan 28, Apologies, hmm try this Add another light set it to cast lighter shadows. Set it to a separate 'glass' layer and only effect objects in this layer. Put the glass object in this layer.

Does it work now? ArowxJan 28, Joined: Jul 12, Posts: New Unity Live Help updates. Check them out here! Discussion in ' Shaders ' started by lewinator56Jan 27, Search Unity. Log in Create a Unity ID. Unity Forum. Forums Quick Links.

Asset Store Spring Sale starts soon! Joined: Jan 25, Posts: Glass shouldn't cast a shadow should it?

No Shadow on my custom shader

As you can see, there is a shadow cast by the transparent material. I can get around this using an unlit transparent shader, but then i cant have any of the additional features in the HD-Render pipeline.

Joined: Dec 9, Posts: 1, Click on your window object. A "Mesh Renderer" component should be attached to it.

Transparency

There, you can turn "Cast Shadows" and "Receive Shadows" off. MauriJan 27, Joined: Sep 19, Posts: 1. The other material is transparent, so it should not cast shadows, and the other one is opaque and should cast shadows. If I turn shadows off, it will affect the whole object. In standard version of Unity everything works fine but is there any way in HDRP to solve this problem?

MisuFeb 5, Joined: Apr 9, Posts: 8.I have a fps with the standard controller and want to implement shadows. Everything works fine except I want to layer a soldier on top of my regular capsule. It cast shadows but it gets in the way of the camera. Can I make invisible to the camera AND still cast shadows?

How you're able to cast shadows with the free version of Unity, I don't know. It isn't supposed to be supported in Unity Free, but maybe I've misunderstood something in your question. Anyway, to have an invisible object cast shadows, you need a custom shader. I did a quick google and managed to dig one out here. Have a look at this:. I cannot do shaders in unity free. BTW in unity 4. See license comparison under Graphics:.

unity transparent shader cast shadow

Right-Click the project pane, select "Create" and "Shader". You will get a new shader file that has a shader stub in it. Open this file, and delete the shader stub. Copy-paste the short shadow-casting shader from manutoo's answer in that Unity Answers post I linked to.

unity transparent shader cast shadow

Save the file. Next, create a new Material, then choose the shader you've just created to render this material. It will be under the Transparent group. Put this new material on your first person and make sure it's the only material on the character. It should now render invisibly, yet cast shadows, provided they work with the directional lights as you mention.

Attachments: Up to 2 attachments including images can be used with a maximum of To help users navigate the site we have posted a site navigation guide.I have a fps with the standard controller and want to implement shadows. Everything works fine except I want to layer a soldier on top of my regular capsule. It cast shadows but it gets in the way of the camera. Can I make invisible to the camera AND still cast shadows? How you're able to cast shadows with the free version of Unity, I don't know.

It isn't supposed to be supported in Unity Free, but maybe I've misunderstood something in your question. Anyway, to have an invisible object cast shadows, you need a custom shader.

I did a quick google and managed to dig one out here. Have a look at this:. I cannot do shaders in unity free. BTW in unity 4. See license comparison under Graphics:. Right-Click the project pane, select "Create" and "Shader". You will get a new shader file that has a shader stub in it. Open this file, and delete the shader stub. Copy-paste the short shadow-casting shader from manutoo's answer in that Unity Answers post I linked to. Save the file. Next, create a new Material, then choose the shader you've just created to render this material.

It will be under the Transparent group. Put this new material on your first person and make sure it's the only material on the character. It should now render invisibly, yet cast shadows, provided they work with the directional lights as you mention.

Attachments: Up to 2 attachments including images can be used with a maximum of To help users navigate the site we have posted a site navigation guide. Make sure to check out our Knowledge Base for commonly asked Unity questions.This is the sixth installment of a tutorial series covering Unity's scriptable render pipeline. It's about adding support for alpha clipping and semi-transparent materials.

As explained in Rendering 11, Transparencyit's possible to cut holes in geometry by discarding fragments based on an alpha map. This technique is known as alpha clipping, alpha testing, or cutout rendering.

Besides that, it's exactly the same as rendering opaque geometry.

Is there a way to get the standard fade / transparent shader to recieve shadows?

So to support alpha clipping we only have to adjust our shader. Alpha clipping is only useful when a material's alpha varies across its surface. The most straightforward way to achieve this is with an alpha map. Here are two textures for that, one for square geometry like quads and cubes, and one for spheres. Import these textures and indicate that their alpha channel represents transparency.

Their RGB channels are uniform white so won't affects the material's appearance.

Unity Transparent Shadows

Add a main texture property to the Lit shader. We'll use is as the source for albedo and alpha, with solid white as the default. Create two new materials, one for lit alpha-clipped spheres and one for lit clipped squares, using the appropriate textures.

In the Lit include file, add declarations for the main texture and its sampler state. We need UV texture coordinates for sampling, which are part of the mesh data. So add them to the vertex input and output structs. We'll also return the alpha value from now on. That's not needed right now, but will be used later.

Alpha clipping is done by discarding fragments when their alpha value falls below some cutoff threshold. Add the corresponding variable to the UnityPerMaterial buffer. Then invoke the clip function with the fragment's alpha value minus the threshold. That will cause all fragments that end up below the threshold to be discarded, which means that they don't get rendered.

Objects with an alpa-clipped material are now rendered with holes in them. The size of the holes depends on the cutoff value.


thoughts on “Unity transparent shader cast shadow

Leave a Reply

Your email address will not be published. Required fields are marked *