Named material paramaters not being found (help with CanvasRenderTarget2D)
Huge UE4 noob here, coming from various other engines.
I'm trying to make a game where you paint on the world, so I'm looking to leverage CanvasRenderTarget2D to have some code paint the textures in my game.
So far I've found this guy looking for a tutorial, the same guy reported a crash TTP #349656, and most helpfully this guy had a back and forth discussion with the user solid-snake who I believe was the origonal author of this feature.
I've attempted to implement what was roughly outlined in this discussion and am having an issue. Before I describe the issue too much, here's what I've tried:
And in unreal I've created this material, TestPaintMat I'm using WorldAlignedTexture because I couldn't find a way to actually sample the ParamTexObject I created...
I created this blueprint, TestPaintBP which is setup to reference PaintParam and is parented to TestPaintActor.h it also has a static mesh referencing the material above. This 'mMesh' is what I'm using in the construction script too, for what that's worth. :)
Of course I have an instance of TestPaintBP in the scene. My C++ class is being hit just fine and when I update my material I see the changes in the scene. So as far as I can tell everything is linked properly...
The issue is when I call SetTextureParameterValue on my material instance. It gets to UMaterialInstanceDynamic::SetTextureParameterValue and then into SetTextureParameterValueInternal and finally to GameThread_FindParameterByName which finds zero parameters, returning null.
I'm not sure if this is the root of my issue, but this is as far as I've gotten and it seems problematic that no named parameters are found at all. Of course since I mentioned above that I'm a bit derpy in the material editor, I'm guessing I just setup my material wrong.
Any help is appreciated! Thanks.
asked Nov 18 '14 at 06:17 PM in C++ Programming
Simple enough, I just had to assign the material to the mesh once the dynamic material was created.
I was also getting issues where I was unable to save my scene with this blueprint code in the constructor script. To fix this I moved the entire blueprint code executing out of the purple construction script wire and moved it into its own new function "Assign Test Paint Material". Then in my level blueprint I hooked the function up to the "Event Begin Play" as seen below. This seemed to solve my issue of being unable to save.
answered Nov 24 '14 at 04:59 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here