- Home /
ignore depth buffer for terrain
Hello. Is it possible to make one material render always over terrain (but below detail meshes and grass!). I want to achieve a situation where that green grid would never be cut away by terrain mesh, but still render below terrain grass, detail meshes and other objects. So it has to do something with depth buffer? Like set the grid material to ignore terrain textures' depth? but how..?
Thanks in advance!
Answer by ScroodgeM · Aug 28, 2012 at 09:14 PM
solution 1
use projector for terrain-only layer
solution 2
paint grid on terrain as any other texture. this can be done also procedurally by scripting
solution 3
reproduce geometry of terrain to plain with grid
solution 4
improve shaders to draw grid between terrain and terrain details with ignoring z-buffer
For #1...wouldn't the projector also project on any trees and details?
With #3, you would just create a mesh with the grid texture, modify the vertices to match the contour of the terrain, and place it just a little above it.
Thank you for the answers! solution 1 is quite good.. unfortunately the projector material doesn't work exactly as needed.. and jc_, no it won'd project on trees and other stuff. Solution 2 isn't that good in current scenario. About s.4 - unfortunately I nor somebody else form our $$anonymous$$m hasn't got enough shader scripting skills to change those shaders to achieve the z-buffer ignoring effect. So unless some nice guy wants to do that job (change shaders) for us, or at least give some clues how to do that, I'll stay with the easiest solution (which is 3). Actually I will just flatten the terrain in that area so it won't go above that grid plane.
projector has 2 possible shader options - additive or multiply. I just need a material with alpha channel, but when I set the projector material to be transparent/diffuse or whatever, it just fills the whole terrain with that texture, not the projector area
set texture as Clamp ins$$anonymous$$d of Repeat in texture import settings
Your answer
Follow this Question
Related Questions
Retrieving depth buffer of a frame 2 Answers
Make a simple tree 1 Answer
I want to use depth value which is send by kinect 0 Answers