无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(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的評論 (共 條)

分享到微博請遵守國家法律
柘城县| 彭泽县| 丹凤县| 景洪市| 闻喜县| 南宫市| 元氏县| 建平县| 宣武区| 新巴尔虎左旗| 乌苏市| 桐柏县| 南漳县| 德安县| 陇西县| 治多县| 伽师县| 无为县| 怀宁县| 葵青区| 澎湖县| 辽源市| 博兴县| 新河县| 云阳县| 兰溪市| 柳江县| 军事| 彰武县| 和田县| 汤原县| 龙海市| 简阳市| 库车县| 白城市| 平遥县| 敦煌市| 琼结县| 巧家县| 宝兴县| 靖西县|