Planetside Software Forums

General => Terragen Discussion => Topic started by: westergard on February 18, 2023, 08:46:18 AM

Title: EXR to RAW for Unity
Post by: westergard on February 18, 2023, 08:46:18 AM
Hi everyone, i'm looking in the forums but can't find anything recent on this.

I want to generate a terrain in TG4 that i can convert in a .RAW file so i can use it as a heightmap in Unity.

I am able in Terragen, using a simple shape shader, to generate and save a heightmap, but i can only do it in EXR or TER format.  Any idea how i can convert a EXR or TER format into a .RAW format that i can use in Unity?

Thanks so much in advance for your help.

Westergard
Title: Re: EXR to RAW for Unity
Post by: WAS on February 18, 2023, 01:37:48 PM
I don't think this is something you'll find as a real tool online, simply because RAWs should be RAW, directly from the capture sensor like a camera, radar device, etc.

That being said, you could probably force a TIFF to RAW. If you have Python installed something like this should work:

import PIL, numpy
im = PIL.Image.open('C:\image.tif')
imarray = numpy.array(im)
imarray.astype('int32').tofile("C:\image.raw") # Maybe use int16 instead, I imagine a 32bit terrain will crawl Unity