五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

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

Styled SDF for Bezier curve 2

2022-04-22 03:20 作者:DeadCyber  | 我要投稿

Part2?following previous article

?

Final Result
Bezier Spline key points

????In last article,we use 'raw' code to do sdf box style quadratic bezier spline.I want to wrap things up,pack code into a function,so the user-side code would be clean.

????However, HLSL?is not a quite "High Level" Shader Language to me, because it doesn't?support dynamic length array?as function parameter(Because we want an arbitrary number of keys points in the spline).Although one can use 'StructuredBuffer' as a dynamic length array, but use?StructuredBuffer means unnecessary transfer of data from CPU to GPU if our spline data is static.

????In the end, I broke down the function logic to 'atom' function, and use a for loop to do it from head to tail, finally wrap them all in a 'MACRO Function'.It feels like a little 'functional programming'? in there to me.Here is the MACRO Function code:

(I like the VS Code theme here,remind me of 《Nier Automata》)

You can see from the following image, how I defined the projection info, and updated the info to get the min dis along the whole body.

The idea of 'Projection Info' is designed to?

  1. hold extra information.

  2. allow the latency?of calculating SDF.(like I do with the spline head and tail)

e.g.,the head and tail of spline's SDF is not calculated here:

With the design of 'Projection Info' and the structure of SDFSpline function below, we can easliy change the style of the body,head,tail:

And you can see it's not?coupling with quadBezier,you can easliy provide any type of spline's head/body/tail info in this function, and the the boxed style 3D SDF of it.

End

????Finally,the user-code is very clean and can be changed easily:


Acutally, since the user-end code is very neat, I can do some 'Automatic Generation Of?SDF HLSL Code' work, to transform an editor scene to a full SDF-Rendered scene, which is? very exciting to me.

Styled SDF for Bezier curve 2的評論 (共 條)

分享到微博請遵守國家法律
福建省| 池州市| 余江县| 修水县| 炎陵县| 岐山县| 三都| 沙河市| 巴马| 盐池县| 镇安县| 安塞县| 赤水市| 白玉县| 田林县| 乌拉特中旗| 惠来县| 钦州市| 夏津县| 昌乐县| 望城县| 太保市| 石泉县| 博乐市| 太谷县| 东乡族自治县| 炉霍县| 百色市| 石城县| 西乌| 金川县| 涡阳县| 贵溪市| 利川市| 泉州市| 盐城市| 桐庐县| 信宜市| 洪洞县| 丹寨县| 汾阳市|