欢迎光临散文网 会员登陆 & 注册

Fix Box SDF after shear 3D

2022-03-09 12:07 作者:DeadCyber  | 我要投稿

A solution of SDF modeling shear issue.

Story:

e.g. if you are shearing by X in 3D:


Then you wanna do sheared SDF box like i.q. :

It's gonna broken (because when SDF Trace,the distance to box is not correctly calculated ):

By this pdf I found,although it doesn't give an answer,I was inspired.

"《Interactive Modeling with Distance Fields》 Tim-Christopher Reiner"

After I done my calculation,the fixed Sheared SDF Box code is here:

Now the box is fixed:

————————————————————————————————

Addition:

Later I found the code above neglected negative shear and 0 situation.

Here is the code fixed:

Finally it's fixed...

__________________________________________________________

Thumb me if it helps.:)

I wrote this in English beacuse I didn't found a solution at google or shadertoy.I hope this may help someone someday.

Fix Box SDF after shear 3D的评论 (共 条)

分享到微博请遵守国家法律