最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Everything SDF:'Trace Step Disturb' and its solution

2022-08-17 18:44 作者:DeadCyber  | 我要投稿

In my last article,I gave a taste of Image-based SDF(Signed Distance Function) Slice: That is pre-calculating the SDF of a 2D object to an .exr texture,then rendering it as a 3D slice object in the scene:

That was an successful experiment! And I decided to use the tech in-project!

I've managed to change my SDF font code of Quadratic-Bezier-Spline :

to the texture based 'slice'

Original User Paint
Baked SDF .exr
Slice with a SDF offset,make it thicker

??? So in my mind,the frame rate would drop tremendously when I change the font code to slice code,as I analysed at the head of my last article.

??? However ,F(xiàn)PS got worse with only 1 slice in the scene!

And I complete didn't know what was happening.

????

After I scaled down the slice,fps got up to maybe 70, that was expected:

?? So there must be some rays aroud 'B' that is too costly.It has something to do with the size of 'B'.It has little thing to do with tech we sdf the 'B' or the cost of 9000000 triangle grass we rendered in the scene...

??? ?!Wait a second...

????It's definitely about the 9000000 grass!

????I was quite confident about the 'grass thing' before, because I created such thing called 'SDF Bound':

??? It's an optimize bounding box,every ray point out side bound will calculate the 'B' SDF =? box sdf+0.1,when the ray hit the box surface, due to the '0.1',it traces inside the box,that's when B's actual SDF is calculated.The idea is simillar to mesh LOD.

?? Let's straighten things out:

????Grass :OK

????'B' :OK

????Grass+'B': Bad

????Grass+'B' out side SDF Bound: OK

????That leaves us one conclusion:something's very nasty inside SDF Bound of 'B'.

????When I look through 'B''s up eye,the FPS drop from 70 to 20 as expected:

So what's really going on here?How do I solve it?

Trace Step Disturb

????It's a name I just made up.

????The idea is , for a certain trace ray, it traces 'A' good; it traces 'B' good;but when you put 'A' near 'B', it's trace step gets nasty, hence bad.Let me show you.

????Let our ray fixed,then I put 'B' in front of camera,so our ray hit 'B' very quickly in an SDF Trace Process:

(Every dot in the line means a step,when we calculate all the SDF in the scene and take the 'min', so we get correct 'scene SDF')

????When I put 'A' near the ray,'A' is like a bad girl,attracting you,but not giving you the hit in the end:

??? ????????

????Now those extra steps calculating the hole scene SDF too! Normally ,when we use SDF Bound,the extra cost is not so heavy,because we are using box-sdf instead of A's acctual SDF:

????cost1. We have to calculate A's actual SDF in extra steps

????cost2. We have to calcualte B's SDF(or its SDF-Bound) in extra steps.

??? What's more, I don't have a SDF-Bound for grass,because it's infinite and on a curved terrain that can't be bounded in a simple box!

??? So,from 2 problems above,we have 2 ways to optimize it:

??????? option1. prebake the missing rays around an object.

??????? option2. avoid calulating 'B''s SDF inside A's bound.

??? In this article,I will not talk about option1.

??? For option2, we can offer an 'InnerBound', when should not contain the SDF-Objects' intersection parts,since we'll only calculate the owner's acutal SDF inside the InnerBound,and it doesn't affect the rays don't hit the owner, who are attracted by the 'bad girl',but whey'll eventually escape from her,poor boys.

Result and drawbacks

???

Woo,20 to 200 FPS! Nice work,InnerBound!

However,the InnerBound should be little smaller ,only containing the single part, and not containing the intersection parts,? otherwise the lack of other objects' SDF infomation will lead to an invalid SDF Trace:

Error:InnerBound has intersection part
Error:Innerbound too big,leads a too long escape,that traces through ground

That'll be all,thank you.Goodbye untill next time.


Everything SDF:'Trace Step Disturb' and its solution的評論 (共 條)

分享到微博請遵守國家法律
曲周县| 洛宁县| 伊通| 车险| 略阳县| 宜宾市| 金溪县| 玉林市| 肃宁县| 眉山市| 姚安县| 泌阳县| 阜城县| 波密县| 额济纳旗| 金堂县| 延寿县| 莎车县| 青浦区| 拉萨市| 中阳县| 友谊县| 根河市| 青州市| 东阳市| 丹棱县| 丹江口市| 阳东县| 潮安县| 黑水县| 桂林市| 太和县| 景洪市| 榆林市| 福清市| 大方县| 屯留县| 宣城市| 太仓市| 肥西县| 南通市|