Page 1 of 2

unexpected downscaling on 712k multi-tile VT

PostPosted: Thu Nov 03, 2016 3:04 pm
by chris
Hi

I'm currently using the Amplify Texture trial version in Unity 5.4 terrains, and it seems to be a very interesting tool to have when dealing with GIS. I'm interested in that product so I'm trying to evaluate its limits. I'm usually working with multiple 8192x8192 png tiles and a _x#_y#.png naming convention.
The tool works fine for small datasets, but I'm having a hard time when testing with a bigger set wich is composed of a grid of 88 x 64 tiles, each one still being a 8192x8192 png image. This makes a total size of 720896 x 524288 pixels.

The virtualized texture I obtain seems to be greatly downscaled in respect to the original tile resolution. I've set the virtual texture properties to hardware level = Ultra, and a virtual size = 2048K (1024K also tested). I've played wiht the compression quality (=> 100%) and asked for lossless compression.

Since the total number of pixels does not exceed the max resolution limit of 2048k x 2048k, I assumed my grid size is ok. My tiles are in power of two resolution, but not the grid itself, can it be why I get a scaled result ?
I've previously tested with less tiles with no such scaling problem.

I must add that some of the tiles are missing in my data set (not the first tile so the grid can be computed), but Amplify seemed to compute the grid without complaining and render the virtual texture filling out the missing tile with black pixels, wich is fine for me but I wonder if those missing tiles can be confusing for AT (seems unlikely since there was no downscaling for smaller incomplete grids).

I did not compile the project yet, I'm still in the editor but the problem didn't arise before, with smaller datasets, so I suppose there is something wrong in my setting.

My workstation is a win10 PC, with a nVidia GeForce GTX 580 with 3Go VRAM, using Unity 5.4 64bits.


=> May I ask you to confirm the max resolution reachable for one virtualized texture and if that resolution is for each of the 16 allowed vtextures per scene ? What I understand is that the max resolution of one virtualized texture is 2048000 x 2048000 pixels, is that correct ? I also read "Virtually unlimited number of textures", then I suppose an increase in number of (input) textures implies a decrease in (input) textures resolution so the virtualized texture still fits in the 2048k x 2048k limit.

=> Do you have any advice to help me solve the downscaling problem I'm facing with my 88x64 grid of 8k textures ?


Thanks for your time.


Edit :
I've just discovered that for some reason my project was set for 32bits windows, not 64bits.
I'm switching to 64bit, waiting for the import process to do its stuff, then try again the VT generation.

Re: unexpected downscaling on 712k multi-tile VT

PostPosted: Thu Nov 03, 2016 4:12 pm
by Ricardo Teixeira
chris wrote:Hi

I'm currently using the Amplify Texture trial version in Unity 5.4 terrains, as it seems to be a very interesting tool to have when dealing with GIS. I'm interested in that product so I'm trying to evaluate its limits. I'm usually working with multiple 8192x8192 png tiles and a _x#_y#.png naming convention.
The tool works fine for small datasets, but I'm having a hard time when testing with a bigger set wich is composed of a grid of 88 x 64 tiles, each one still being a 8192x8192 png image. This makes a total size of 720896 x 524288 pixels.

The virtualized texture I obtain seems to be greatly downscaled in respect to the original tile resolution. I've set the virtual texture properties to hardware level = Ultra, and a virtual size = 2048K (1024K also tested). I've played wiht the compression quality (=> 100%) and asked for lossless compression.

Since the total number of pixels does not exceed the max resolution limit of 2048k x 2048k, I assumed my grid size is ok. My tiles are in power of two resolution, but not the grid itself, can it be why I get a scaled result ?
I've previously tested with less tiles with no such scaling problem.

I must add that some of the tiles are missing in my data set (not the first tile so the grid can be computed), but Amplify seemed to compute the grid without complaining and render the virtual texture filling out the missing tile with black pixels, wich is fine for me but I wonder if those missing tiles can be confusing for AT (seems unlikely since there was no downscaling for smaller incomplete grids).

I did not compile the project yet, I'm still in the editor but the problem didn't arise before, with smaller datasets, so I suppose there is something wrong in my setting.

My workstation is a win10 PC, with a nVidia GeForce GTX 580 with 3Go VRAM, using Unity 5.4 64bits.


=> May I ask you to confirm the max resolution reachable for one virtualized texture and if that resolution is for each of the 16 allowed vtextures per scene ? What I understand is that the max resolution of one virtualized texture is 2048000 x 2048000 pixels, is that correct ? I also read "Virtually unlimited number of textures", then I suppose an increase in number of (input) textures implies a decrease in (input) textures resolution so the virtualized texture still fits in the 2048k x 2048k limit.

=> Do you have any advice to help me solve the downscaling problem I'm facing with my 88x64 grid of 8k textures ?


Thanks for your time.


Edit :
I've just discovered that for some reason my project was set for 32bits windows, not 64bits.
I'm switching to 64bit, waiting for the import process to do its stuff, then try again the VT generation.



Hello,

Thank you for testing Amplify Texture 2, we really appreciate your feedback. 2048k x 2048k is indeed the maximum value per-VT, you should be able to build a 720896 x 524288 pixels virtual texture without any resolution issues. Unfortunately, AT2 does not handle missing tiles, that could be the cause of the problem. The build process runs trough your texture collection until it encounters a missing tile, that's how it determines the last tile of any given collection. AT2 might be doing some sort of scaling to compensate for the actual UV setup, which tiles are you missing?

You are correct in using power of two textures, especially with multiple tiles. Since textures need to be resized to the nearest power of two, building a virtual texture with non-pow2 textures is considerably slower; not to mention that Unity might hang due to lack of system RAM. By grid, do you mean the actual tile values in the material?

Thanks!

Re: unexpected downscaling on 712k multi-tile VT

PostPosted: Thu Nov 03, 2016 5:09 pm
by chris
Thanks for your answers !

By grid, do you mean the actual tile values in the material?


By grid I mean the set of textures as detected in Unity material inspector.
As an example of what I meant, this is a 4x4 grid as detected in Unity inspector :
t t t t
t t t ?
t ? ? ?
t ? ? ?
't' are provided tiles (existing on disk)
'?' are missing tiles

I was hoping it would be fine without storing a bunch of black 8k textures just for filling the missing aerial data. Unfortunatelly for me, there is a lot of cases where the geographic area to render is not rectangular or axis aligned. In this case I've a coast line with no textures covering the sea part :
t t t t t t t
t t t t ? ? ?
t t ? ? ? ? ?
t ? ? ? ? ? ?

Anyway, I'll generate those black textures tomorow and come back tell you how it turns out.

By the way (and you may already know it), there is a vertical mirror of the VT on the unity terrain, maybe Unity has flipped its UV mapping in its last version. Setting the Tiling field of the material to -1 on Y solve the pb on the user side.

Again, thanks a lot for your help.

Re: unexpected downscaling on 712k multi-tile VT

PostPosted: Thu Nov 03, 2016 6:14 pm
by Ricardo Teixeira
chris wrote:Thanks for your answers !

By grid, do you mean the actual tile values in the material?


By grid I mean the set of textures as detected in Unity material inspector.
As an example of what I meant, this is a 4x4 grid as detected in Unity inspector :
t t t t
t t t ?
t ? ? ?
t ? ? ?
't' are provided tiles (existing on disk)
'?' are missing tiles

I was hoping it would be fine without storing a bunch of black 8k textures just for filling the missing aerial data. Unfortunatelly for me, there is a lot of cases where the geographic area to render is not rectangular or axis aligned. In this case I've a coast line with no textures covering the sea part :
t t t t t t t
t t t t ? ? ?
t t ? ? ? ? ?
t ? ? ? ? ? ?

Anyway, I'll generate those black textures tomorow and come back tell you how it turns out.

By the way (and you may already know it), there is a vertical mirror of the VT on the unity terrain, maybe Unity has flipped its UV mapping in its last version. Setting the Tiling field of the material to -1 on Y solve the pb on the user side.

Again, thanks a lot for your help.


Hello,

Thank you for the additional information, we really appreciate it. Multi-tile collections are usually sequential, you can always use smaller 64x64 black textures for the empty tiles. It's an interesting use case, it should be possible to add a specific flag for this type of collections but, unfortunately, we are currently fully focused on Mobile and Console support. It's definitely something that we will be revisiting at a later stage. Alternatively, you could always develop your own functionalities, the full version offers all the necessary source code.

Thank you for reporting the Terrain issue, they seemed to have flipped it a few versions ago. We need to update our shaders in order to mitigate the problem. It shouldn't be too long, we have other maintenance related updates planned.

Looking forward to your feedback, thanks!

Re: unexpected downscaling on 712k multi-tile VT

PostPosted: Fri Nov 04, 2016 1:38 pm
by chris
Hello,

Just a quick update : I've created the missing tiles as symlinks targeting one black tile. I've hit the Rebuild button on the VT inspector, and the material seems to have been reset since it's y-flipped again.
=> No noticable change in the VT resolution.

Now I'm going to create real textures files at 64 x 64 as you suggested and let you know if it solves my problem.

Re: unexpected downscaling on 712k multi-tile VT

PostPosted: Fri Nov 04, 2016 2:11 pm
by chris
It turns out that my first tile is a dummy black tile that has not the good resolution (it was not obvious in the Unity Editor which doesn't display the 'real' resolution...), it must be why the downscaling occurs...

I'll scale this guy to the 8192x8192 and try again, leaving all the missing tiles as it was before posting here, just to see what happens.

Re: unexpected downscaling on 712k multi-tile VT

PostPosted: Fri Nov 04, 2016 6:52 pm
by Ricardo Teixeira
chris wrote:It turns out that my first tile is a dummy black tile that has not the good resolution (it was not obvious in the Unity Editor which doesn't display the 'real' resolution...), it must be why the downscaling occurs...

I'll scale this guy to the 8192x8192 and try again, leaving all the missing tiles as it was before posting here, just to see what happens.


That makes sense, the collection tile resolution is defined by the size of the first tile; the first tile should always be set at the desired resolution. From your description, I assumed that it was a 8k tile; my apologies for not mentioning it earlier. Other than the black tiles used for missing textures, we do not recommend using tiles with different sizes in the same collection; they will be automatically resized if necessary.

Looking forward to your feedback, thanks!

Re: unexpected downscaling on 712k multi-tile VT

PostPosted: Tue Nov 08, 2016 11:09 am
by chris
Hello,

Still no success after adding the missing tiles as 8192x8192 black images and setting the first tile to the same resolution, but this time the process ended up with an all black VT, 2 errors, and warnings (I'll paste them at the end of this message)

My hard drive was full at the middle of the process but the computation was still progressing so I let it finish.
Just for information :
- the file size displayed in "statistics" section of the VT inspector is 568.10 GB, the hard drive is a 2TB and contains the unity project only.

What happens when the hard drive goes full during processing ? Should I prevent this to happen or is it allright for AT which seemed to go on without complaining ?


=======================
There are the errors and warnings I encountered :

Code: Select all
InvalidOperationException: Operation is not valid due to the current state of the object
System.Collections.Stack.Peek () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections/Stack.cs:321)
UnityEngine.GUILayoutUtility.EndLayoutGroup () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:289)
UnityEngine.GUILayout.EndHorizontal () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:291)
AmplifyTexture.VirtualTextureEditorBase.OnInspectorGUI ()
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1235)


then

Code: Select all
InvalidOperationException: Operation is not valid due to the current state of the object
System.Collections.Stack.Pop () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections/Stack.cs:329)
UnityEngine.GUILayoutUtility.EndLayoutGroup () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:288)
UnityEngine.GUILayout.EndVertical () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:317)
UnityEditor.EditorGUILayout.EndVertical () (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:7048)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1245)


The following 2 warnings are spawning when I move the camera over the terrain (the first warning appears a lot more than the second one) :

Code: Select all
[AmplifyTexture] System.IO.EndOfStreamException: Failed to read past end of stream.
  at System.IO.BinaryReader.FillBuffer (Int32 numBytes) [0x0005b] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/BinaryReader.cs:119
  at System.IO.BinaryReader.ReadUInt32 () [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/BinaryReader.cs:520
  at AmplifyTexture.PageFile.ReadPage (AmplifyTexture.PageDecoder decoder, Int32 index, System.Byte[]& data, System.Boolean& linear, Int32 offset) [0x00000] in <filename unknown>:0
  at AmplifyTexture.PageStreamer.LoadImmediate (Page page) [0x00000] in <filename unknown>:0
UnityEngine.Debug:LogWarning(Object)
AmplifyTexture.PageStreamer:LoadImmediate(Page)
AmplifyTexture.PageStreamer:Load(Page, Boolean)
AmplifyTexture.PhysicalCache:ProcessRequests(Page[], Int32, Int32, Boolean)
AmplifyTextureCameraBase:OnPreRender()
AmplifyTextureCameraBase:ForegroundUpdateImmediate()
AmplifyTextureManagerBase:UpdateRuntimes()
AmplifyTextureManagerBase:InternalUpdate()
AmplifyTextureManagerBase:Update()


and sometime :

Code: Select all
System.IO.EndOfStreamException: Failed to read past end of stream.
  at System.IO.BinaryReader.FillBuffer (Int32 numBytes) [0x0005b] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/BinaryReader.cs:119
  at System.IO.BinaryReader.ReadUInt32 () [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/BinaryReader.cs:520
  at AmplifyTexture.PageFile.ReadPage (AmplifyTexture.PageDecoder decoder, Int32 index, System.Byte[]& data, System.Boolean& linear, Int32 offset) [0x00000] in <filename unknown>:0
  at AmplifyTexture.PageStreamer.StreamingThreadCallback (System.Object obj) [0x00000] in <filename unknown>:0
UnityEngine.Debug:LogWarning(Object)
AmplifyTexture.PageStreamer:StreamingThreadCallback(Object)

Re: unexpected downscaling on 712k multi-tile VT

PostPosted: Tue Nov 08, 2016 4:59 pm
by Ricardo Teixeira
chris wrote:Hello,

Still no success after adding the missing tiles as 8192x8192 black images and setting the first tile to the same resolution, but this time the process ended up with an all black VT, 2 errors, and warnings (I'll paste them at the end of this message)

My hard drive was full at the middle of the process but the computation was still progressing so I let it finish.
Just for information :
- the file size displayed in "statistics" section of the VT inspector is 568.10 GB, the hard drive is a 2TB and contains the unity project only.

What happens when the hard drive goes full during processing ? Should I prevent this to happen or is it allright for AT which seemed to go on without complaining ?


=======================
There are the errors and warnings I encountered :

Code: Select all
InvalidOperationException: Operation is not valid due to the current state of the object
System.Collections.Stack.Peek () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections/Stack.cs:321)
UnityEngine.GUILayoutUtility.EndLayoutGroup () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:289)
UnityEngine.GUILayout.EndHorizontal () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:291)
AmplifyTexture.VirtualTextureEditorBase.OnInspectorGUI ()
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1235)


then

Code: Select all
InvalidOperationException: Operation is not valid due to the current state of the object
System.Collections.Stack.Pop () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections/Stack.cs:329)
UnityEngine.GUILayoutUtility.EndLayoutGroup () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayoutUtility.cs:288)
UnityEngine.GUILayout.EndVertical () (at C:/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:317)
UnityEditor.EditorGUILayout.EndVertical () (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:7048)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1245)


The following 2 warnings are spawning when I move the camera over the terrain (the first warning appears a lot more than the second one) :

Code: Select all
[AmplifyTexture] System.IO.EndOfStreamException: Failed to read past end of stream.
  at System.IO.BinaryReader.FillBuffer (Int32 numBytes) [0x0005b] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/BinaryReader.cs:119
  at System.IO.BinaryReader.ReadUInt32 () [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/BinaryReader.cs:520
  at AmplifyTexture.PageFile.ReadPage (AmplifyTexture.PageDecoder decoder, Int32 index, System.Byte[]& data, System.Boolean& linear, Int32 offset) [0x00000] in <filename unknown>:0
  at AmplifyTexture.PageStreamer.LoadImmediate (Page page) [0x00000] in <filename unknown>:0
UnityEngine.Debug:LogWarning(Object)
AmplifyTexture.PageStreamer:LoadImmediate(Page)
AmplifyTexture.PageStreamer:Load(Page, Boolean)
AmplifyTexture.PhysicalCache:ProcessRequests(Page[], Int32, Int32, Boolean)
AmplifyTextureCameraBase:OnPreRender()
AmplifyTextureCameraBase:ForegroundUpdateImmediate()
AmplifyTextureManagerBase:UpdateRuntimes()
AmplifyTextureManagerBase:InternalUpdate()
AmplifyTextureManagerBase:Update()


and sometime :

Code: Select all
System.IO.EndOfStreamException: Failed to read past end of stream.
  at System.IO.BinaryReader.FillBuffer (Int32 numBytes) [0x0005b] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/BinaryReader.cs:119
  at System.IO.BinaryReader.ReadUInt32 () [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/BinaryReader.cs:520
  at AmplifyTexture.PageFile.ReadPage (AmplifyTexture.PageDecoder decoder, Int32 index, System.Byte[]& data, System.Boolean& linear, Int32 offset) [0x00000] in <filename unknown>:0
  at AmplifyTexture.PageStreamer.StreamingThreadCallback (System.Object obj) [0x00000] in <filename unknown>:0
UnityEngine.Debug:LogWarning(Object)
AmplifyTexture.PageStreamer:StreamingThreadCallback(Object)



Hello,

Thank you for the additional information, we have not come across this issue before. It seems that you have hit some sort of AT2 Unity limitation or, as you mentioned, a VT build related issue due to insufficient disk space. The build process wont be successfully terminated if you run out of disk space.

How large exactly (tile quantity and storage) is your texture collection before virtualizing it? Is this the same 88x64 collection mentioned earlier? We will have to examine this problem further, I will keep you posted on any new developments.

Thanks!

Re: unexpected downscaling on 712k multi-tile VT

PostPosted: Wed Nov 09, 2016 8:29 am
by chris
Hello,

Yes, this is the 88x64 8k tileset mentionned earlier, it takes 428 GB on disk.
The VT is built with a "Amplify Texture/Legacy Shaders/Nature/Terrain/Diffuse" material and Vt properties are set to the following :
- HW level = Ultra
- Virtual Size = 1024k x 1024k
- Tile size = 512 x 512
- Mip Filter = Box
- UV Coord Set = 0

About layers, I used Albedo only, lossless compression (quality 80), and disabled Alpha.

I need to find a bigger hard drive in order to build a VT without hitting disk space limitation. I'll let you know when I can try again on a bigger disk.