'How to mask a texture with Unity Shader Graph

So the final effect that am trying to achieve can be found in this tutorial video (unity shader lab) and my case i want to reach this result: enter image description here

So far i created these properties:

enter image description here

And the result is this (no idea why "tiling" has 4 fields even though its a Vector2):

enter image description here

After that, i added 2 new properties:

enter image description here

A tiline and Offset node which has its offset controlled by the Position property, plugged it to a Sample Texture, and multiplied the output with the Emission texture output, and plugged the result to the Emission inpute of the PBR node:

enter image description here

and the result is this: enter image description here

It's kinda giving me what i want but its far from finished, what i can't figure out is:

  1. How to resize the mask area? because for now if i change the Tiling then the result is just too wrong:

enter image description here

  1. Is my "positioning" logic correct ? eventually i want the Position property to be controlled with a C# script based on a game object position, as you saw in my main preview example, i basically want the grid to glow under specific object, so am i doing it right ?

Thanks a lot in advance! i really hope the Shader graph community start getting bigger cause its been super hard to find answers even for the the most basic things.

Have a nice day!



Solution 1:[1]

Try setting the texture's wrap mode to clamp instead of repeat at the import settings.

Solution 2:[2]

@user40079 was't wrong, he/she just didn't tell you which texture needs to be clamped. I think mask texture need to be clamped to achieve what you want.

Here is my graph.

grid shader graph example for unity

Solution 3:[3]

The first 2 PCs explain about 23% of the variation in the data. The first 13 explain about 50% of the data and the first 26 explain 66%. You need to decide how many components are meaningful.

xxx.comp <- summary(xxx.pca)
xxx.comp$importance[, c(2, 13, 26)]
#                             PC2     PC13     PC26
# Standard deviation     3.679506 1.527898 1.225693
# Proportion of Variance 0.090260 0.015560 0.010020
# Cumulative Proportion  0.233080 0.497630 0.658610

Plotting the first two components shows some clustering:

plot(xxx.pca$x[, 1:2], pch=20)

Plot

You can start by identifying clusters in 2 dimensions, see if they make sense and then increase the number of dimensions.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user40079
Solution 2 Simon Lee
Solution 3 dcarlson