sbox-issues icon indicating copy to clipboard operation
sbox-issues copied to clipboard

Cloud Material References Break After Relaunching Project

Open Aleph0x opened this issue 1 month ago • 2 comments

Branch

staging

Describe the bug

When importing models from the S&box Cloud, their materials appear correctly at first but after exiting and relaunching the project, those materials go missing permanently. The models render untextured, and trying to reassign the materials manually doesn’t do anything.

It seems to happen randomly with no clear cause, but I’m guessing it has something to do with how cached Cloud materials are indexed or referenced when the project loads.

I first ran into this around October 12th, but it’s probably been happening for a while. I’ve also noticed it sometimes after swapping out cloud models I imported through Hammer with the same cloud models brought in directly through Scene.

Workaround: Deleting the cached Cloud materials folder forces a refresh, which temporarily fixes the issue:

s&box projects\<yourproject>\.sbox\cloud\materials\

After deleting it and relaunching (sometimes twice), the Cloud redownloads and restores the missing materials.

Potential relevant commit: This might be related to the sbox/cloud-refs-fix commit? I think that change altered how Cloud references are collected. From what I can tell, it made vmaps store only their direct Cloud refs and stopped fetching dependencies recursively. So when reopening a project, indirect material dependencies might not get remounted or resolved properly, which could be why Cloud models lose their materials until the cache is deleted.

October 9th:

Sol Williams: vmaps store it's own cloud refs only, don't fetch deep/recursively (!)
Prefer newest when encountering duplicate refs/version conflicts
Misleading log, it's not "out of date" it's not the version we want
Update the evil twin install func with the same version conflict logic
 
Sol Williams on sbox/cloud-refs-fix

To Reproduce

These steps are unreliable and inconsistent.

Download or import models from the S&box Cloud into a project. Place the models in your scene, materials appear normal. Exit the project and relaunch it. Materials are now missing or replaced with the default gray material. Attempting to reassign materials has no effect.

Expected behavior

Cloud-imported models/materials should retain their material assignments between sessions without manual cleanup.

Media/Files

Image Image Image Image Image Image

Additional context

No response

Aleph0x avatar Nov 07 '25 15:11 Aleph0x

This also happens to models/props as well. I noticed it happen very often with this house. Initially it works fine, but after an editor restart, its gone. After another restart, its there again.

MenschlichTv avatar Nov 08 '25 15:11 MenschlichTv

Just adding a note from my end: I haven’t ran into this recently on the staging branch.

Not sure if a recent cloud-related fix quietly resolved it or if I just haven’t hit the right conditions again.

Aleph0x avatar Nov 13 '25 04:11 Aleph0x

Now this bug is on main branch

gabrielgilvan avatar Nov 28 '25 16:11 gabrielgilvan

Image

I can confirm this bug is still a thing, the screenshot I've just sent above is me shooting and bullets decals not working properly in the editor (These are the default bullet impacts prefab made by Facepunch). They work fine in game however, but in the editor the references to the bullet impacts textures doesn't seems to be "found" which is even weirder bcs in the bullet decal preview, the texture doesn't appear in "Error" or anything like that. And even weirder is that this bug triggered only after the latest weekly update !

K3rhos avatar Dec 05 '25 14:12 K3rhos

Yeah, I’m seeing something similar on my side, this happened to me today as well. The Cloud assets I am using are impact particle prefabs made by Facepunch (impact.generic and shotgun_muzzleflash). The materials on mine are missing both in-game and in the scene view.

https://github.com/user-attachments/assets/23385c8f-99ce-4aed-a21e-249dbad67205

On first launch I get a burst of ERROR_FILEOPEN for generated textures like textures/generated/imagefile/<hash>.vtex_c, followed by errors for core particle textures and finally my Cloud particle materials (Facepunch impact prefabs like impact.generic and shotgun_muzzleflash):

2025/12/05 06:43:07.6229  [Generic] Compiling base projects
2025/12/05 06:43:23.3789  [engine/ResourceSystem] Error loading resource file "textures/generated/imagefile/52a7b0142394cde0.vtex_c" (Error: ERROR_FILEOPEN: File not found)
...
2025/12/05 06:43:26.0786  [engine/ResourceSystem] Error loading resource file "textures/particles/smoke/smoke1.vtex_c" (Error: ERROR_FILEOPEN: File not found)
2025/12/05 06:43:26.2651  [engine/ResourceSystem] Error loading resource file "particles/smoke/smoke001.vtex_c" (Error: ERROR_FILEOPEN: File not found)
2025/12/05 06:43:26.2768  [engine/ResourceSystem] Error loading resource file "particles/explosion/explosion001.vtex_c" (Error: ERROR_FILEOPEN: File not found)
2025/12/05 06:43:26.2970  [engine/ResourceSystem] Error loading resource file "particles/fire/flame001_side.vtex_c" (Error: ERROR_FILEOPEN: File not found)
2025/12/05 06:43:26.4048  [engine/ResourceSystem] Error loading resource file "textures/generated/imagefile/d9d8010f1702a675.vtex_c" (Error: ERROR_FILEOPEN: File not found)

Later, when I actually fire the weapon, the engine falls back to the error texture for those same particle materials:

2025/12/05 06:43:44.9475  [BikeWeapon] Spawned muzzle flash at -12184.32,0.6438,233.1773
2025/12/05 06:43:44.9475  [engine/Engine] ResourceHandleToData( materials/particles/particle_glow_05.vtex ) failed! Falling back to error texture!
2025/12/05 06:43:44.9475  [engine/Engine] ResourceHandleToData( materials/particles/smoke/render/smokeloop_g_1.vtex ) failed! Falling back to error texture!
2025/12/05 06:43:44.9475  [engine/Engine] ResourceHandleToData( materials/particles/light_flare/light_glow_01.vtex ) failed! Falling back to error texture!
2025/12/05 06:43:44.9475  [engine/Engine] ResourceHandleToData( materials/particles/smoke/render/smokeloop_i_1.vtex ) failed! Falling back to error texture!

When I do check my material resources I notice I have an in-progress texture down/write where the compiled texture should be, so it fails back.

.sbox\cloud\materials\particles\smoke\render\smokeloop_g_1.vtex_c.48222.tmp

Aleph0x avatar Dec 05 '25 16:12 Aleph0x

bump

Kaikenny avatar Dec 06 '25 18:12 Kaikenny

I wonder if this is related?

https://github.com/Facepunch/sbox-issues/issues/9731

Aleph0x avatar Dec 13 '25 10:12 Aleph0x