I have a Volume Texture that im passing into my material, how can I get its unormalized values, so instead of 0-1 its 0-65535
VolumeTexture = NewObject<UVolumeTexture>(this, UVolumeTexture::StaticClass()); //LoadObject<UVolumeTexture>(nullptr, TEXT("/Script/Engine.VolumeTexture'/Game/TestingPurpose.TestingPurpose'"));
VolumeTexture->Source.Init(chunksize_, chunksize_, chunksize_, 1, ETextureSourceFormat::TSF_G16);
VolumeTexture->MipGenSettings = TMGS_NoMipmaps; // Disable mipmaps if not needed for better data handling
VolumeTexture->CompressionSettings = TextureCompressionSettings::TC_VectorDisplacementmap; // Or another appropriate setting
DynamicMaterial = UMaterialInstanceDynamic::Create(Planet->chunkMaterial, this);
DynamicMaterial->SetTextureParameterValue("VoxelIDs", VolumeTexture);
for (size_t y = 0; y < chunkSizePadded; y++)
{
for (size_t z = 0; z < chunkSizePadded; z++)
{
for (size_t x = 0; x < chunkSizePadded; x++)
{
auto voxelPos = FVector(x, y, z) - 1;
int voxelType = Planet->GetVoxel(voxelPos + ChunkCoord_ * chunksize_);
if (x > 0 && y > 0 && z > 0 && voxelPos.X < chunksize_ && voxelPos.Y < chunksize_ && voxelPos.Z < chunksize_) {
int32 Index = ((voxelPos.Z * chunksize_ * chunksize_) + (voxelPos.Y * chunksize_) + voxelPos.X) * 2;
uint16 RedValue = voxelType;//voxelType + 1; // Max value for 16-bit
// Set the red channel (2 bytes per pixel in R16 format)
TextureData[Index + 0] = RedValue & 0xFF; // Low byte
TextureData[Index + 1] = (RedValue >> 8) & 0xFF; // High byte
}
if (voxelType > 0) {
(*axisMaps)[0][y][z].set(x);
(*axisMaps)[1][z][x].set(y);
(*axisMaps)[2][x][y].set(z);
}
}
}
}