Are any of you using StaticMeshComponent.SetMaterial()? I use it to turn static meshes translucent when your character steps behind them. This is a bug that has been very difficult for me to troubleshoot. If any of you have seen this happen, can you let me know? I’d love to know how you’re dealing with it. Thanks.
That sounds scary, could you work around it by setting a material parameter instead of changing the whole material?
This bug is a nightmare. Only happens on some computers. And the error message is this:
[0148.61] Log: === Critical error: ===
Fatal error!
Address = 0xe502087d (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe5036379 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe5021f55 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe5023b4d (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe50229b7 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe504b680 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe5a7600b (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe5036379 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe504bcd0 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe50512ee (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe504bcd0 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe50512ee (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe5036379 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe504bcd0 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe50512ee (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe504bcd0 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe50512ee (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe504bcd0 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe5065017 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe54f27b9 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe589bec6 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe57770db (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe7098447 (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe709f5ef (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0xe709f65a (filename not found) [in R:\SteamLibrary\steamapps\common\Himeko Sutori\Binaries\Win64\RPGTacGame.exe]
Address = 0x4fb54dd1 (filename not found)
Thanks for the suggestion but unfortunately I can’t just switch a material parameter because the buildings are mostly opaque, and this material is translucent.
You could make occluded actors visible through walls with this material.
To make it work, set DepthPriorityGroup = SDPG_Foreground in default properties of your mesh component.
Complete setup would require you to have two mesh components per character: first is what you use normally, and the second with depth priority setting and the material above.
I don’t suppose you can debug it on some other PC where it happens right?
btw does it happen on components where you haven’t overridden it yet (i.e. the first time you call SetMaterial) or is it maybe only after calling it a second/third/etc time?
also do you properly unreference the new material?
Just to give you an idea of what I’m doing…
@Avatarus thanks. I remember seeing something like that in one of the development kit gems. Unfortunately I don’t think that’s going to work in my case because all my characters are 2D. They don’t really have any normal information that I would be able to draw. I suppose I could do something like that though. I’ll keep it in mind if I can’t get this working.
@Chosker unfortunately, no. I just have to wait to see who reports the bug and then ask for the log. It happens immediately the first time I call the function. And I keep an array of all of the original materials on the occluding static mesh actor’s static mesh component so that I can put the materials back on when it’s no longer occluding.
There’s nothing all that strange happening in UScript when I do this. I’m afraid this may be a C++ issue. I’m not looking forward to trying to fix that. Right now I’ve started a workaround where I just make the mesh invisible. It’s not as pretty, but hopefully it’ll get us through. I wonder if there’s any other way to get this effect.
Try this method to fake translucency. It will hide all geometry with the same materials behind it. Perhaps, you’ll find a way to make it without changing materials.
Enable bUseLitTranslucencyDepthPass in material settings.
yeah that’s what I imagined you were doing
not sure why you need to keep a list of the original materials. if they are the default ones you can simply SetMaterial to none and it will fall back to what the meshes had. but this is probably irrelevant to the crash since it happens immediately on the first apply
from the gif you show I find it a quite jarring. I believe it’s because you apply the shader to only one object at a time which makes a hard switch as you move
if this is a big part of your game maybe you could consider a different option. a more robust way would be to handle it directly in the material of the solid objects, making a mask in relation to the camera and carve a hole in them. I know that would mean no translucency, but you could try a different effect within the edges of the solid cut (there’s always interesting things you can do with solid cuts. example: https://i.pinimg.com/originals/b4/b7/e3/b4b7e310a3e547563a84ed9880547ac5.gif )
I know you just want to fix the crash, but reworking it to be better could lead you to avoid the crash as well
This is going to be really embarrassing to admit, but the reason for the crash was because I edited an “Engine” file and then didn’t put the updated Engine.u file in my Steam image. Sorry for making such a stupid mistake and wasting your time.
But you were right that the effect was a little jarring. I went back to see if I could do better…
Now I just need to apply that only to meshes in front of the character. I’ve got some other things ahead of that in the backlog, but when I have time to polish up the optional stuff, this one will be ready to go!