I'm using Unity2021.3, and this is a URP project.
There is a 3D sprite in the scene that receives and casts shadow, the material for its spriteRender uses a shader that is a simple modification of Unity URP Simple Lit, and there is a spotLight in front of the 3D sprite with shadow enabled, and there is also a directional light in the scene. The 3D sprite casts shadow on the ground due to the directional light and the spotLight, everything is correct.
But if I switch to a new shader, it seems the SpotLight passes through the 3D sprite, rendering the shadow incorrectly, if I move the SpotLight to make it far away from the 3D sprite, then it seems the shadow is correct.
Please see the attached screenshot, the top three screens are custom shader, below two are the URP Simple Lit variant.
I'm wondering what the problem is with the new shader?
Thank you so much.
Related
When you insert a pipeline asset into graphics like this, the existing sprite default material should be pink, but it is the same.
Even the Sprite Lit Default material is not pink. Does anyone know a solution?
The current project is a project converted from 3D to 2D, and 3D URP was applied well in the past.
So I have a HD2D Setup in Unity, meaning a 3D world containing 2D sprites (billboards). I am using URP and created a Lit Shader with the following configuration:
This Shader is attached to a material and this material is attached to my sprite. My problem is, when I rotate the global directional light, the sprite with this shader attached has sort of a delay in adjusting its darkness to the global light (in the video, the environment is bright (morning) but the sprite is still very dark in color (see next picture) and vice versa). This behavior can be seen in the video I uplaoded here:
https://www.youtube.com/watch?v=uAm71ftfy2Y
Desired outcome:
The sprite gets darker as the sun fades (similar to the white Quad that can be seen in the video scene).
Does anyone have an idea which setting I need to tweak here? Thanks for any advice.
I figured it out. For some reason, URP Pipeline was not set under Edit-->ProjectSettings-->Graphics. Once set, I was able to set [X] Will be affected by shadows in shader graph. This solved the problem
I'm trying to import an Blender object with texture to Unity.
I did a simple cube with smart UV Projet unwrap, i added a texture and then exported it as .FBX file.
When in Unity, even if the cube has the right material with the right texture, the cube has a dark version of the texture.
Unity cube with dark shadowed texture
Blender cube with bright texture
Here's what i tried:
Flipping my normals in or out in Blender.
Change normals and tangents settings in unity to calculate.
Trying to change pretty much all Model settings in inspector in unity.
Just as a guess, it looks a little bit like you have no light source in your Unity scene. If you want the texture brightness constant without factors like scene lighting you need to change the material to some unlit variant in unity.
Also, check the albedo tint of the material. It seems that sometimes when extracting, it automatically adds a gray tint to it.
MaterialInspectorImage
i'm making a tank based game and when i made a model of the tank in blender and imported it to unity. When I placed a camera inside the wall was completely transparent from the inside but not the outside.
Is there any simple fix to this problem?
In blender you have to make sure your normals are facing outward. If you are using planes imported from Unity they will only show up on one side, its better to use cubes if you want them to be visible for both sides. If you are using a plane you can create a custom 'CULL OFF' shader so that backface culling will disable on its material and will show on both sides.
I am trying to project shadows from sprites on 3D objects, i followed some tips here and there but i still have issues.
I created a material that use Legacy Shaders/Transparent/Cutout/Diffuse and add it to my sprite, i also enable ShadowCastingMode and receiveShadows on the SpriteRenderer.
The result is that my sprite actually cast a shadow now, but the sprite itself is also shadowed, which is not the result i am looking for.
Without the shader:
With the shader:
I know absolutely nothing about materials and shader so this is me just walking in the dark.
Also this is a brand new project and i am using the template 3D with extra if it makes any difference.