Optimal Normal calculations #434
Closed
TokisanGames
started this conversation in
Extras
Replies: 1 comment 3 replies
-
@Xtarsia has this been implemented? Is texelfetch better than Gather for us, or is Gather still on the table for the future? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
From @Xtarsia
This is a new method for calculating normals in fragment()
the n1 - n4 values can be returned to use for correct blending when doing projection too. completley avoiding any need for a normal map 😄 #400, the original artifact #185 , and this new method (no vertex normals calculated at all)
the normals are more correctly centered too
with a single gather_texel_normal() we get the 1st image normals, handy for low-poly. 2nd is the smooth normals.
4x gathers is roughly equal to 1 full texture lookup (a wee bit more expensive)
I think this is a novel approach, i never found anything using gather to generate normals from heightmap on the fly in all my googling efforts.
This method means that the normal values don't exactly line up [with the vertices], im essentially magicking up a 1025th pixel
This method calculates normals at the center of a region vs at the edge:
![image](https://private-user-images.githubusercontent.com/632766/352729631-5c160cf9-0549-49f8-8d7e-764443036275.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NTkxMTMsIm5iZiI6MTczOTQ1ODgxMywicGF0aCI6Ii82MzI3NjYvMzUyNzI5NjMxLTVjMTYwY2Y5LTA1NDktNDlmOC04ZDdlLTc2NDQ0MzAzNjI3NS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxM1QxNTAwMTNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zY2RkNDg2NWNjNjk2NDVmZTE1MTE3ZDY0YTM1MmU2Mjk2ZTQwY2RkMTkxM2I1YjE0NjM1NTliZDYyOTYzMWZmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.SSw-wYUVcCwVkaHcSUReq318uOSjHIobKfMipHSz4rQ)
Beta Was this translation helpful? Give feedback.
All reactions