8
$\begingroup$

For the texture coordinates, I take the vector of the plate that is under the cube.

The length of which of the object vectors is taken? And why if I change the 2nd value in "Less Than", the transparency area increases? After all, the output in "Less Than" must be 0 or 1. This result suits me completely, I just want to figure out how it works.

enter image description here

enter image description here

enter image description here

Blend file: enter link description here

$\endgroup$
5
$\begingroup$

It will help to look at the values you're operating on.

If you go to Edit -> Preferences -> Add-Ons and enable Node Wrangler you gain a lot of functionality and keyboard shortcuts in the node graph. We're only interested in one of those functions right now, though. You can Ctrl + Shift + Click something to link its outputs to a viewer node and just see it in the viewport.

So if we take an object, like this extra long cone, and view it with this Mapping to Vector Math -> Length operation on it, we get this result.

enter image description here

Thanks to this visualization I can look at this and say this is essentially just wiping out the X and Y axes and then running an absolute value operation on the values, and I could rewrite it like this:

enter image description here

From here I hope it is easier to see what the Less Than node is comparing against. It completely transforms this map from a gradient to strictly either a 0 or a 1 at any position on the mesh. If the Value of this gradient is less than your defined threshold it reports a 1, otherwise it reports 0.

enter image description here

And so they're just using this method, animated over time, as the factor of a Mix Shader. This generates a hard cutoff between the diffuse shader and 100% transparency.

$\endgroup$
2
  • 1
    $\begingroup$ Thank you for posting such a clear explanation. Often, when trying to guide users, the core of the concept and logic used is lost by trying to show the end result only, not the actual process, muddling the learning experience. Looking forward to more answers like this. $\endgroup$ – susu Jan 28 at 12:46
  • $\begingroup$ Yay. Nice. Now it's all clear. Thanks :) $\endgroup$ – Ragirhid Jan 28 at 14:48
9
$\begingroup$

This seems to be some form of crude "Wipe" effect.

By using the object's local Z coordinate as input and running through the Less Than math function it basically makes an horizontal line mask.

In the vector node the X and Y axis Scale value to zero is turned down, which makes it basically output the pure Z axis, as opposed to all axis at once which would give a 45º tilted angle. This has basically the same effect as using a Separate XYZ node.

By linking it to transparency it basically makes the object opaque or transparent above/below a certain Z value defined in the Less Than node.

enter image description here

$\endgroup$
11
  • 1
    $\begingroup$ Z for up/down, if you wanted, say left/right you'd use the X coordinate, and Y for forward/backwards $\endgroup$ – Duarte Farrajota Ramos Jan 27 at 11:52
  • 1
    $\begingroup$ Oh one relevant detail I forgot to mention is that in the vector node he turned down the X and Y axis scale value to zero, which makes it basically output the Z axis as opposed to all axis at once which would give a 45 tilted angle. This has basically the same effect as using a Separate XYZ node $\endgroup$ – Duarte Farrajota Ramos Jan 27 at 12:03
  • 2
    $\begingroup$ The shader basically runs the algorithm on all visible pixels of the object, so it will output 0s and 1s, but it will be recalculated for each and every visible pixel of the mesh. $\endgroup$ – Gorgious Jan 27 at 13:15
  • 2
    $\begingroup$ @Ragirhid: you are right, just values of 0 and 1 are entering your mix shader fac value. But there is actually no "line", just the two "areas" - (visible and invisible) - for the values 0 and 1. If you want a "smooth" dividing of the two values, just plug in the length directly to the mix shader fac. Maybe than you understand what is happending. $\endgroup$ – Chris Jan 27 at 13:15
  • 1
    $\begingroup$ I recommend Node Wrangler addon to visualize the values $\endgroup$ – Allen Simpson Jan 27 at 15:55

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.