Hi,
I was trying to make a depth fade effect to smooth out the intersection of clouds and scene objects, however getting stuck with few problems.
It seems the Depth Fade Node cannot work properly if I don't put a light(with shadow on) in the scene.
If shadow on the light is turned on and the scene is not baked, the Depth Fade Node would just worked well, and this is the result I wanted.
But the Depth Fade node turned invalid if the light or the shadow is turned off...
And if we baked the scene, the Depth Fade node just won't work at all nonetheless the Shadow option on light is turned on or not.
Here is how the Depth Fade node applied.
The materials of the three rocks are simply Standard(specular).
I wonder If there are solutions of making Depth Fade node to work with no lighting and baked scene ?
Dose Depth Fade node only work with light that has shadow on
- Ricardo Teixeira
- Posts: 954
- Joined: Fri Aug 09, 2013 2:26 pm
Re: Dose Depth Fade node only work with light that has shado
Greetings,
Is that a single cloud object?
Thanks!
Is that a single cloud object?
Thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Re: Dose Depth Fade node only work with light that has shado
Hi,Ricardo Teixeira wrote:Greetings,
Is that a single cloud object?
Thanks!
The cloud is a mesh.( I split a mesh into four in order to share the texture map which has four shapes of cloud.)
I'm currently using the Unity 2017.2.0f3.
I have attached the screenshot and the test scene. Please have a look.
I'm looking forward to your further advises.Thanks.
- Attachments
-
- TestCloud.unitypackage
- (163.89 KiB) Downloaded 222 times
-
- Cloud.jpg (117.15 KiB) Viewed 4687 times
- Amplify_Borba
- Posts: 1239
- Joined: Mon Jul 24, 2017 9:50 am
Re: Dose Depth Fade node only work with light that has shado
Hello, this behavior is expected since the shadow casting pass is not being called due to the lack of light / shadows.
There is a workaround to this, which involves forcing the camera to generate a depth texture in order to access values from the depth buffer on an unlit scene.
You can add the following script to your MainCamera for this purpose:
Please let me know if this helps, thanks!
There is a workaround to this, which involves forcing the camera to generate a depth texture in order to access values from the depth buffer on an unlit scene.
You can add the following script to your MainCamera for this purpose:
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class EnableDepthTexture : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Camera.main.depthTextureMode = DepthTextureMode.Depth;
}Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Re: Dose Depth Fade node only work with light that has shado
Great! Such a nice trick! It's working now. You also provided me an explicit direction to learn such mechanism of unity.Amplify_Borba wrote:Hello, this behavior is expected since the shadow casting pass is not being called due to the lack of light / shadows.
There is a workaround to this, which involves forcing the camera to generate a depth texture in order to access values from the depth buffer on an unlit scene.
You can add the following script to your MainCamera for this purpose:
Please let me know if this helps, thanks!Code: Select all
using System.Collections; using System.Collections.Generic; using UnityEngine; [ExecuteInEditMode] public class EnableDepthTexture : MonoBehaviour { // Start is called before the first frame update void Start() { Camera.main.depthTextureMode = DepthTextureMode.Depth; }
Thank you Sir! and Happy new year!
- Amplify_Borba
- Posts: 1239
- Joined: Mon Jul 24, 2017 9:50 am
Re: Dose Depth Fade node only work with light that has shado
No problem, we're glad we could help.
Have you had the chance to rate and review Amplify Shader Editor? It would be awesome if you could share your experience with the Unity community, every bit helps and your feedback is extremely valuable to us.
Feel free to get back in touch if you have further issues or questions, thank you and a happy new year to you as well!
Have you had the chance to rate and review Amplify Shader Editor? It would be awesome if you could share your experience with the Unity community, every bit helps and your feedback is extremely valuable to us.
Feel free to get back in touch if you have further issues or questions, thank you and a happy new year to you as well!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!