Trouble with an Oil Painted Post Effect
Hello folks. I'm trying to implement an algorithm I found for creating an oil panted effect over a given image:
but I can't seem to get the lil bugger to work. I'm using a custom node in a post process material to handle the nested FOR loops needed to compare the pixels surrounding the pixel being rendered, and everything seems to compile fine, but when I apply the effect in my scene, all I get is some weird noise.
So, obviously something is failing. I'm assuming it's the SceneTextureLookup call I am making within the custom node, but I can't find any decent docs or examples of how to use this function to be sure if that's the cause or not. If anyone is able/willing, could you please take a look at my material & code and point out what idiot thing I am doing, I would be very grateful.
Here's the material:
And here's the code in the OilPaint node:
As you can see, I've done my best to duplicate the algorithm from the link at the top, but it's just not working. Hopefully it's some simple thing I'm over looking and not some intrinsic limitation to the post process material that is preventing this from working as I'd think it would look pretty cool...
Thanks in advance for any help.
Hey this is a few months late, I'm just posting this for the next guy. If you get the above error in a For or If statement, change the way you're grabbing texture pixels. For example:
I got the texture sample code by going to >Material Editor top pane menus >Window >HLSL Code >Copy. And I got it to sample 1 MIP level by setting a Texture Sample Parameter node to MIP level 0, then finding it near the bottom of the output code.
I don't fully understand why you can't MIP texture samplers inside flow control (like IF or FOR statements), but apparently it's a fundamental feature of HLSL. You can find more info here http://stackoverflow.com/questions/15437413/directx-texture-sampling-function-samplecmplevelzero-returns-blank-intermittentl
Apologies if this doesn't apply to your post, but you're the one and only hit on google for >"ue4" HLSL for "cannot have gradient operations"
answered Oct 27 '16 at 01:10 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here