Position Node Of ShaderGraph

Hi!

I hope to achieve the deformation of objects through ShaderGraph.
For convenience, I simplify the problem to the stretching effect of a Cube.


As shown in the figure below, an additional height offset is added to the [Position.ObjectSpace] node, and its value is [Position.ObjectSpace.x].

Since the value range of [Position.ObjectSpace.x] is [-0.5,0.5], the Cube will be stretched.

From the figure below, you can see that the Cube is stretched into a slope, which is in line with my expectations.


I want to make further adjustments to ①, for example, from the side view, I hope to show the changes shown in the figure below.

Therefore, I take the absolute value of [Position.ObjectSpace.x], and my expectation is that the new value range will be [0,0.5].

However, from the performance shown in the figure below, it seems that the absolute value obtained becomes a constant.
targetDemo

I don’t quite understand why this problem occurs, and I really hope to get an answer!
Thank you!

Hello.
Do you use the default Unity cube?
If so, you won’t be able to achieve the desired deformation simply because it has only one polygon on each side. Your mesh must have a loop at the center.


1 Like