Trying to create normal from DDX and DDY but i get point and line like artifacts.

Trying to create normal from DDX and DDY but i get point and line like artifacts. The artifacts are almost a grid like pattern and change as i move the camera closer or farther away… in no way smooth or useable…

I have been following youtube videos and trying nodes like PreparePerturbNormalHQ->perturbNormalHQ…

all seem to have the same problems and i dont know why. Im attempting it on relatively low res textures i painted on meshes for in unreals texture paint on mesh tool for nanite meshes.

Any ideas what can be done? I just need a normal map from a heightmap without the extra texture lookups / instructions.

Here are screenshots…

unlikely, but seems a lot like moire effects.
i don’t know the exact solution, but once i saw a video from about tv screens on ue https://www.youtube.com/watch?v=LGkblrCmzlE
maybe you get some inspiration there.

looks like this problem happens from height info generated from left to right.. not top to bottom… see this pasted screenshot thats a cross of vertical and horizontal lines. Same exact node network in the material for each direction. Yet the bug happens in only one direction. Even tried them seperate to prove it ..

Gave it a spin and from what I can tell this technique does not like when the texel density of the texture is too low. When texel density is close enough to the ideal range the artifact disappears.

I don’t think a screen space technique will work with such a low resolution texture as this.
Sufficient texel density (far):


Insufficient texel density (close):

Sufficient texel density (close):

this isnt a texture density issue.. Those lines / bumps… arent even a texture… They are generated in the shader via math. And again.. the horizontal one doesnt have the issue.. yet the vertical one does.. doesnt make any sense. Its the same math. Same exact nodes.

Also the distortion effect im seeing moves based on camera position / rotation. Its not a stationary effect. Ill record something in a moment

After some playing with it i see that the issue happens for the lines when i use add in the math to a large numberl ike a couple of thousand to scroll it. But for whatever reason doesnt happen if its a small number.

Anyone know why?

I was basing that off the statement in your original post that you are generating normals from texture paint, and your first set of screenshots are texture based.

If you are generating details via shader math, then you can generate perfect normals mathematically using the derivative of the function that generated the details in the first place.

Not sure why you’d get moiré in that specific case though.

yea … i forgot my original was texture paint.. but yea its happening in the math version too but again i fixed that math one with my previous post. Its odd that if i add with a large number the bug appears. Add being the method to move my indent lines back and forth.