Hey all, I’ve been wrestling with this issue for a while now and have found some conflicting information that I’d like to understand better. We are using Google Photorealistic Tiles but want to have shadows, time of day etc. so we’re using them with the Cesium lit shader, however it seems they don’t actually respond to lighting until you check “Generate Smooth Normals”. The problem is turning on Generate Smooth Normals creates grid artifacts at the edge of tiles, which I understand is caused by the “skirts” that are part of the Google Photorealistic Tiles:
We’ve been using Google Photorealistic Tiles for a while now and I don’t remember this always being an issue… was there some update that caused this to be more prevalent?
Am I correct in saying that Unity lighting doesn’t work unless Generate Smooth Normals is checked? Has that also always been the case? I’ve seen some previous posts stating that lighting should still work, but this is what it looks like with smooth normals off:
Indeed, Generate Smooth Normals will make the cracks between tiles more pronounced due to the “rounded” edge appearance. Have you tried overriding the Opaque Material property on the tileset with CesiumDefaultTilesetMaterial? That should prompt flat normals to be generated for the tileset. Otherwise, the tileset will default to our unlit material.
Hi, yes, that’s what we’ve been doing. Both images are using the CesiumDefaultTilesetMaterial, the top one is with smooth normals on (which causes the grid lines) and the bottom is with smooth normals off (which causes lighting not to work). I’m just wondering if you all have found a way to reduce/hide the grid line effect while still allowing lighting.
I hit the same issue! CesiumDefaultTileSetMaterial could use some fixing. Or at least Cesium could add a “Simple Lit” basic shader or the likes. Also the normals are not rendered correctly it seems. They are not facing up in unity coordinates system, depending on where you are on the globe. Not sure why? It took me a while but I ended up writing my own shader using Toony Colors Pro addon that removed “Ramp Shading” from the shader. That fixed the issues of tiling. You can see my post from earlier here: Generate Smooth Normals causes tile artifacts - #2 by janine
@5DRealities that’s very interesting, do you have any more information about that “no ramp” effect? I don’t have Toony Colors Pro to test it out.
And @janine I did some more testing and figured it out (sort of): the reason the lighting wasn’t working with Generate Smooth Normals off was because it seems the default normals were flipped… multiplying them by -1 seems to make it work. Can you think of any reason why that would be the case? The project works for now but I’m curious if I messed something up or if this is a known issue.
EDIT: Actually that’s not it exactly. It seems that without Generate Smooth Normals it just picks a random direction for the normals? Can you explain how it works without Generate Smooth Normals?
Our code for generating flat normals is here. Then, there are a couple checks to see whether the model already came with normals or not.
It’s possible that there is a bug in the code, but when I use CesiumDefaultTilesetMaterial, I see shadows that are consistent with the Directional light in the scene.
There are some angles where the world is dark, even though you can technically see the sun in the sky. But I have a feeling that the lighting is still relatively correct, and we would just need a sky shader that actually reflects the time of day. It doesn’t seem like the normals are flipped.
Can you include screenshots of the faulty normals that you’re seeing? Perhaps there’s a particular area in the dataset where the errors are much more obvious.
Yes, I can confirm the generated normals are not correct. I believe shadows are cast correctly but the mesh is not lit properly. I found the same issue in this thread. Note I mentioned this is the other thread: Generate Smooth Normals causes tile artifacts - #2 by janine
“So If I generate the terrain at the Hawaii coordinates Lat: 21.3115 Lon: -157.6625 then the normals are not facing up. If I set the time to say 4pm, then the normals don’t recieve any light. If I set the time to 9am (Sun at the horizon) they receive full light from the directional light. A good way to test it is to turn off the environmental lighting Intensity Multiplier to 0 to see how the directional light is hitting the terrain. Depending where you are on Earth the lighting is always usually wrong.”
Thank you both for your input. I confirmed that I can see similar behavior when comparing the appearance of the data to a default cube mesh (sorry for not checking that earlier!). I opened an issue to track this bug here:
We’ll be sure to provide updates on that issue as we troubleshoot this.