As the title says, I'm looking for a way to clip a Sky Texture Background to above the Horizon only, anything below it should be black. I tried using the clip function of the mapping node but the result is something else. I also tried combining the sky texture with an rgb node with a mix shader and using the mapping node as Fac but didnt find a solution. Please show me a working node setup.

  • $\begingroup$ you talking about cycles here? $\endgroup$ – David Apr 23 '18 at 12:29

You can use Generated texture coordinate with World to read Z axis on -1 to 1 range. Here -1 is straight under, 1 is straight up and 0 is the horizon. Taking it from there, you could simply use Math node to test for Greater than 0. Math node returns 0 for under 0 and 1 immeadiately above 0 so you can achieve a sharp mask.

Clipped to black below 0

For smoother options you could use Color Ramp node, it even conveniently ignores anything below 0 in the range.

EDIT: Here are couple setups for Color Ramp. First ColorRamp range from horizon to Zenith, horizon is on the left of the ColorRamp at value 0.0.

ColorRamp range from Horizon to Zenith

And here we have shifted the -1 to 1 range between 0 and 1 by adding 1 and multiplying by 0.5. Horizon is in the middle of the ColorRamp at value 0.5.

ColorRamp range from Ground to Zenith

  • $\begingroup$ Thank you very much, your a genius! Btw I used it for the Fac of a Mix Shader that I mixed a RGB on black with, now it works as intended. $\endgroup$ – John McDon Apr 23 '18 at 12:00
  • $\begingroup$ Ok, so I added the Color Ramp between the Separate XYZ and the Color/Fac and it works, the only problem is, it doesnt go below the horizon. Gotta figure out how to achieve that. The good thing is you get the easing. $\endgroup$ – John McDon Apr 24 '18 at 21:08
  • $\begingroup$ @JohnMcDon I added some ColorRamp examples. $\endgroup$ – kheetor Apr 24 '18 at 21:19
  • $\begingroup$ Thanks again, I already implemented the Add and the Multiply node to move the border and control the easing. I made a node group for this but it's rather meant to be used as a factor for a mix node. If you wanna check it out: blenderartists.org/forum/… $\endgroup$ – John McDon Apr 27 '18 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.