[Feature] Expose salt as an argument for samplers when used as functions
astrsh opened this issue ยท 0 comments
Pre-Request Checklist
- I have checked that I am on the latest version of Terra.
- I have searched github for similar features requests, including closed
ones, and found none. - I believe this is within the scope of Terra.
- This feature request is for all of Terra, and isn't something that
should be implemented by a pack or addon.
Feature Description
Include salt as an argument for sampler function calls when used in paralithic expressions and Terrascript sampler
calls.
What Problem Does This Solve?
In many instances, modifying the salt for calls to a sampler is desired. For example manually domain warping in an expression requires uniquely salted samples for translations for each coordinate.
With #345, samplers are relied upon to source randomness in Terrascripts. With salts not being exposed, producing unique sets of random values becomes a very cumbersome task.
A Solution You'd Like
Include an additional argument for function calls, eg: noise(x, y, salt)
, which gets added to the sampler's salt during function invocation.
Alternative Solutions
The current workarounds are either defining two identical samplers just with salt changed:
expression: |
noiseToBeWarped(
x + warpX(x, z) * warpAmp,
z + warpZ(x, z) * warpAmp
)
or translating the input coords such that samples are sufficiently different:
expression: |
noiseToBeWarped(
x + warp(x, z) * warpAmp,
z + warp(x, z+1000) * warpAmp
)
This works fine when there are a small amount of unique sample sets, however does not scale when the same sampler is to be used uniquely in many different places, like a generic pack sampler. Here are a couple examples of workarounds used in the overworld: