I have a material in my project that uses a Render Target Asset. This Render Target is written to at runtime, and effects Grass all around the level. This ALL works in the editor, Server or Client.
I have packaged my game in the Debug configuration. I now have the game running on two different machines and am trying to connect them. When the Client connects, the engine hard-crashes at this location in code:
MaterialUniformExpressions.cpp - Line 416. What is infinitely annoying is I have no way to fix this?! The material works just fine, it works as intended in the editor, so why is it crashing in the packaged game, and ONLY on the client?!
The code is wrapped with a big ‘TODO’ block, supposedly Epic knows this is an issue. Any fixes?
Just looking into this briefly, there are already a huge array of inconsistencies with Render Target assets in the engine.
Let’s start with this:
This setting is useless.
The only reason I’m using a Render Target asset, is because I need LOTS of different objects and material in my worlds to respond to this RT all the time (such as foliage). Therefore, it would be stupid to create Dynamic Material Instances for all those different objects and set texture parameters in code.
Here’s where I think the problem lies. Here’s my Material Function that I use all over the project to sample this texture:
Notice the Sampler type is ‘Color’, and if I change it to ANYTHING else, the material gives me a warning and doesn’t compile. So there’s the first problem - You can ONLY use Render Target assets with ‘Color’ samplers in the Material Editor - THIS IS BAD
Here’s the next problem. I initialize this Render Target to a 32-bit non-srgb format in code (a perfectly valid format for the material editor to use!) - but because the Sampler Type is ‘Color’, it won’t sample the texture properly, and I’m willing to bet this is the cause of my crash.
So - what am I going to do to get around this? There’s no way I can warrant creating and managing thousands of material instances just to set a Texture Parameter on them when the level loads.
“There’s no way I can warrant creating and managing thousands of material instances just to set a Texture Parameter on them when the level loads.”
One day, maybe MPCs will be able to use texture params.