Hi. I’m creating custom mesh based on array of heights.
Each element of array contains vertex with its own positions (world and UV). UV is just takes 2D from world position. Then I create polygons:
It works with gentle slopes, but on large height difference texture stretches:
I know that flat texture cannot be applied to volume, but I want something like that:
Tried to apply Noise expression instead of texture and result was fine:
I don’t know, how it works, but somehow it applies noise texture without stretches.
Now I’m trying to read source code of this node expression. Found several files:
MaterialExpressionNoise.h
MaterialExpressions.cpp
Common.ush
and I don’t see any magic: UMaterialExpressionNoise::Compile takes input argument Position and passes it to Compiler->Noise. So, my idea is replace Noise function by Texture. But I don’t pass Position in Material:

My question is how it works and how can I get the same behavior but with my own logic? Thank you.



