ValveResourceFormat / ValveResourceFormat

🔬 Valve's Source 2 resource file format parser, decompiler, and exporter.
https://valveresourceformat.github.io
MIT License
1.55k stars 197 forks source link

"Accessor[9] memory: Value[0] is out of bounds 30613. (Parameter 'memory')" during glTF export in HL:A #248

Closed ptunstall closed 4 years ago

ptunstall commented 4 years ago

Describe the bug

When I try to Decompile & export I get the error below on several assets for Half-Life: Alyx:

[00:05:37.104] Export for "building_ornate_01.vmdl_c" started to "gltf"
[00:05:54.081] Warning: Unsupported Texture Type g_tMetalness
[00:05:54.149] Warning: Unsupported Texture Type g_tTintMask
[00:05:54.316] System.AggregateException: One or more errors occurred. (Accessor[9] memory: Value[0] is out of bounds 30613. (Parameter 'memory'))
 ---> SharpGLTF.Validation.DataException: Accessor[9] memory: Value[0] is out of bounds 30613. (Parameter 'memory')
   at SharpGLTF.IO.ReadContext._ReadFromDictionary(String fileName)
   at SharpGLTF.Schema2.ModelRoot.DeepClone()
   at SharpGLTF.IO.WriteContext._PreprocessSchema2(ModelRoot model, Boolean imagesAsBufferViews, Boolean mergeBuffers)
   at SharpGLTF.IO.WriteContext.WriteTextSchema2(String baseName, ModelRoot model)
   at SharpGLTF.Schema2.ModelRoot.SaveGLTF(String filePath, WriteSettings settings)
   at SharpGLTF.Schema2.ModelRoot.Save(String filePath, WriteSettings settings)
   at GUI.Types.Exporter.GltfModelExporter.ExportToFile(String resourceName, String fileName, Model model)
   at GUI.Types.Exporter.ExportFile.<>c__DisplayClass0_0.<Export>b__0(Object _, EventArgs __)
   at GUI.Forms.GenericProgressForm.<OnShown>b__6_0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   --- End of inner exception stack trace ---

Reference file in a Valve game(Half-Life: Alyx)

Files that did not work when tried:

models/creatures/strider/combine_strider.vmdl_c
models/architecture/backdrop/building_ornate_01.vmdl_c
models/architecture/backdrop/building_ornate_02.vmdl_c
models/creatures/combine_helicopter/combine_helicopter.vmdl_c
models/creatures/combine_dropship/dropship.vmdl_c

Expected behavior

Other models in models/architecture/backdrop exported correctly and were successfully loaded into houdini(including textures) for example:

models/architecture/backdrop/backdrop_building_c17_low01a.vmdl_c
models/architecture/backdrop/backdrop_building_c17_low01b.vmdl_c
models/architecture/backdrop/backdrop_building_c17_low02a.vmdl_c

image

Version info

[03:25:27.278] VRF v0.1.3.1215 on Windows 10 on AMD 2990wx CPU( not sure if that matters) Latest build and this build appeared to be the same at the time of testing.

Additional context

Cig0073 commented 4 years ago

models/props_combine/citadel/citadel_static.vmdl_c The Citadel model also gives the same error.

xPaw commented 4 years ago

Should be fixed on master now.

ptunstall commented 4 years ago

Still getting an error when I try to export combine_strider.

One or more errors occurred. (Accessor[27] memory: Value[24458] is out of bounds 49716. (Parameter 'memory'))

I open the gui app, point to the paks, right click on combine_strider.vmdl_c, and choose decompile and export.

Using unstable build from appVeyor downloaded today.

xPaw commented 4 years ago

Can confirm.

 System.AggregateException: One or more errors occurred. (Accessor[27] memory: Value[24458] is out of bounds 49716. (Parameter 'memory'))
 ---> SharpGLTF.Validation.DataException: Accessor[27] memory: Value[24458] is out of bounds 49716. (Parameter 'memory')
   at SharpGLTF.IO.ReadContext._ReadFromDictionary(String fileName)
   at SharpGLTF.Schema2.ModelRoot.DeepClone()
   at SharpGLTF.IO.WriteContext._PreprocessSchema2(ModelRoot model, Boolean imagesAsBufferViews, Boolean mergeBuffers)
   at SharpGLTF.IO.WriteContext.WriteTextSchema2(String baseName, ModelRoot model)
   at SharpGLTF.Schema2.ModelRoot.SaveGLTF(String filePath, WriteSettings settings)
   at SharpGLTF.Schema2.ModelRoot.Save(String filePath, WriteSettings settings)
xPaw commented 4 years ago

Happens in Dota 2 as well:

game/dota/pak01_dir/models/heroes/antimage_female/debut/lm_am_debut_temple_interior.vmdl_c

[14:29:49.759] System.AggregateException: One or more errors occurred. (Accessor[69] memory: Value[4959] is out of bounds 35190. (Parameter 'memory'))
 ---> SharpGLTF.Validation.DataException: Accessor[69] memory: Value[4959] is out of bounds 35190. (Parameter 'memory')
   at SharpGLTF.IO.ReadContext._ReadFromDictionary(String fileName)
   at SharpGLTF.Schema2.ModelRoot.DeepClone()
   at SharpGLTF.IO.WriteContext._PreprocessSchema2(ModelRoot model, Boolean imagesAsBufferViews, Boolean mergeBuffers)
   at SharpGLTF.IO.WriteContext.WriteTextSchema2(String baseName, ModelRoot model)
xPaw commented 4 years ago

Try latest unstable build, it should work now. (minus the dropship model)

ptunstall commented 4 years ago

image

You guys did it!!!