Can I get SceneTexture as TextureObject?
I've been trying to use the custom node for my material but I've been getting errors. I'm testing the sample in the ue4 documentation:
But it doesn't work. I get the error: tex2d: intrinsic function does not take 2 parameters. I wanted to test it with my post processing material where I have custom depth subtracted by scene depth and then clamped to I have custom depth object separated with black and white. I tried solutions I found don't make it any better and there's barely any information on custom nodes. I really want to know what is up with this.
EDIT: So far I'm a bit closer to getting it to work. But since SceneTexture returns as a float4, I'm still having problems. I don't know HLSL that much but from what I can see I need to use a TextureObject(Texture2d). There re two ways I think I can solve it, but I'm not sure if it's possible at the moment. First one being turning the float4 that SceneTexture gives me into a TextureObject or find a way to sample float4 in HLSL. I can't find anything to see if any of these things are possible, so I wonder if anyone knows if I can do this.
EDIT2: Updated title
Hi, about the first part of the question, since 4.6, CustomTexture is no longer needed and you need to use a TextureObject node instead. Connecting a TextureObject now provides two input parameters to your custom node function, the texture and the sampler. You need to sample it using something like this:
The implementation of that function is in Common.usf. See the reply in this thread for more details: https://answers.unrealengine.com/questions/103571/custom-texture-interpreted-as-texture2d-when-tryin.html
I'll ask the docs team to update that example.
Regarding the second part, you should be able to call the existing HLSL SceneTextureLookup function from your custom node code. You can find the implementation of that in MaterialTemplate.usf.
Thanks, adding an additional input node did the trick. I've been working at this for the past couple of days, it was frustrating since I couldn't find any answer despite being so close to getting the result I wanted. You were of great help.
answered Dec 22 '14 at 04:42 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here