I am procedurally generating grayscale bump/height data (so I’m NOT sampling a texture here – thus cannot use NormalFromHeightMap
, I don’t think) that I need to convert to a Normal map.
ChatGPT suggested I do the following, using DDX
and DDY
and DeriveNormalZ
to create the Normal Map, but (1) I don’t trust ChatGPT and (2) the results are stlil a bit odd/flashy-looking:
I feel like I’m on the right path here but can anyone offer input to improve this? Especially a few things I wonder:
- Do I need to scale the values to
-1
to1
before theDDX
/DDY
? Or is it okay to use0
-1
? - Would I
Normalize
to a unit vector before or afterDeriveNormalZ
? - Any general input is greatly appreciated. I understand basically what
DDX
andDDY
are doing but obviously applying them for this purpose I’m kind of lost.