I would like to intersect my terrain with an invisible plain and just render the intersection line.
The excellent FractScape does something like that (see the yellow line in the attached screenshot).
I used a projector to do that, using a small stripe for the texture, using repeat (as opposed to clamp) for the texture so it covers the entire terrain. In order to not repeat vertically, the texture is very tall (8x1024), entirely transparent except for the 1-pixel stripe in the middle. So theoretically you could see it repeat vertically if the terrain was tall enough. But it would have to be real tall.
Thanks for the hint.
I cannot get it to work quite right though. What type of shader are you using on the texture? Any special parameters I should set on the projector component?
I’m still struggling to get it right though, I keep seeing weird artifacts. I have the impression I’m doing something wrong with the texture. My image is 8x1024, fully transparent except for a black 1px border and a 1px line in the middle.
I tried without the black border as well, but that doesn’t help either.
I must admit I don’t really understand what I’m doing with this, I’m mostly going by trial and error. Any further hints would be very welcome!
Here’s what it looks like without the border. Clearly better, but the line is not completely solid and the colors vary. Also, the line get’s repeated vertically (not visible in screenshot). Should I perhaps attach my projector to the camera?
Also, unlike in Fractscape, the line doesn’t bend to follow the terrain…
I did this a year ago or something, so I don’t really remember how I did it (and I don’t have the project here), but I will try.
Make a projector facing down, the orthographic size should be as large as the terrain, the shader should be the “Projector Additive” which can be found on the wiki.
Create a gradient texture going from black to white (middle) and back to black again, then assign it as the falloff, make sure “border mipmaps” is on.
Assign a 1*1 px texture as the cookie/main texture.
The last thing is that you need to change the clip values. Near clip should be set to zero or a quite small value, far clip should be set to the height/width you want the line to be, i.e quite small too.
I did this a year ago or something, so I don’t really remember how I did it (and I don’t have the project here), but I will try.
Make a projector facing down, the orthographic size should be as large as the terrain, the shader should be the “Projector Additive” which can be found on the wiki.
Create a gradient texture going from black to white (middle) and back to black again, then assign it as the falloff, make sure “border mipmaps” is on.
Assign a 1*1 px texture as the cookie/main texture.
The last thing is that you need to change the clip values. Near clip should be set to zero or a quite small value, far clip should be set to the height/width you want the line to be, i.e quite small too.
could do it with an overlaid shader in the renderer that you pass a ‘contourheight’ parameter to and where the shader only draws itself if it’s near that height. Something like