I had an idea for using the “line trace by channel" node to detect if there’s an obstruction between the sun and the object I needed.But however,my classmate told me it was hard to get the sun’s unreal position and then calculate.
I wonder if my idea is feasible or if there’s a better way to figher the problem out.
Any help would be greatly appreciated from the bottom of my heart.
Yes, that’s feasible. You wouldn’t want to cast your ray from the actual location of the sun, because it’s really far away and you’d run into precision problems. But you should be able to work out the direction the sunlight is arriving from based on the CesiumSunSky, and then start your trace ray opposite that direction and far enough away from your point of interest. Take a look at the DirectionalLight component on the CesiumSunSky.
1 Like