Closed jheising closed 6 years ago
Have seen this issue with a few Unity projects, believe it's a couple of configuration issues with the Projector that aren't always obvious. Can you confirm the texture you're using for the projected material is set to clamp - as per Unity's docs:
Note: When creating a projector, always be sure to set the wrap mode of the texture’s material of the projector to clamp. else the projector’s texture will be seen repeated
I was able to get an expected projection after doing this:
Hopefully this fixes it. If you're still seeing your issue after checking the texture, worth passing us a few shots of your scene and material setup to try and debug it further.
Thanks! It's actually set to tile (non-clamped) because I want the grid to be repeating. The problem is that it seems to repeat over some terrain objects, but not others.
The strange thing is that it seems to be very dependent on camera position.
For example, here is a case where it does not cover all the terrain:
But then if I zoom slightly out, it does end up covering it:
Here's a different perspective of the scene. Notice how some of the geometry fails to receive the projector, but some of it does:
This is expected based on how Unity's projector works - WRLD splits up the terrain into mesh tiles (You'll see these in your scene hierarchy as you run), and the projector works by first figuring out which meshes it intersects, then applying the projected textures to them. If the texture wrapping isn't restricted to 'clamp', it just applies the projected texture to the entire mesh, which is why some tiled blocks of the terrain have it applied and some don't. It'll also get bigger as you zoom out because we swap out the smaller, high detail tiles for larger low detail tiles as you zoom out.
If you want to get a grid texture appearing across the whole terrain, the Unity projector probably won't cut it (Unless you use a lot of them!) - you might need to investigate implementing a custom shader for the terrain to achieve this affect. (https://forum.unity.com/threads/wireframe-grid-shader.60071/ has an example that can be used to achieve something similar to the shot below)
Thanks much! I was actually able to implement it using a projector, custom shader and playing around with the projector clipping planes.
Results below:
Hello, I'm trying to project a grid over wlrd3d terrain, but the Unity Projector/Light shader seems to be missing from certain parts of it. See the following screenshot:
If I move the projector it seems to randomly change. Is this perhaps a z-fight issue? Any thoughts on how I might fix this? Thanks!