How to scale using a Texture3D?

I’ve been following this tutorial on raymarching and have got it to where I like:

However when I scale up the container, it doesn’t match the original tiling. I’ve attached reference pictures and was hoping someone could help me out. Thanks!

Custom node:

float density =0;
float transmission = 0;
float lightAccumulation = 0;
float finalLight=0;


for(int i=0;i<numSteps;i++){
rayOrigin += (rayDir*stepSize);
float3 samplePos =rayOrigin+Offset;

float sampledDensity = tex3D(Volume,samplePos).r;
density += sampledDensity*densityScale;
float3 lightRayOrigin = samplePos;
for(int j=0;j<numLightSteps;j++){
lightRayOrigin += LightDir*lightStepSize;
float lightDensity = tex3D(Volume,lightRayOrigin).r;
lightAccumulation += lightDensity*densityScale;
}
float lightTransmission = exp(-lightAccumulation);
float shadow = darknessThreshold + lightTransmission * (1.0 - darknessThreshold);
finalLight += density * transmittance *shadow;
transmittance *= exp(-density*lightAbsorb);


}
transmission = exp(-density);

output = float3(finalLight,transmission,transmittance);



Been at that point with the same tutorial. You can scale it by multiplying the samplePos with a float3 for each axis. But this also distorts the result sometimes because the ray step size stays the same but has to traverse a bigger object.

You are a lifesaver, always on here helping me! it works perfectly now