基础能力--高亮组件
<p>[TOC]</p>
<table>
<thead>
<tr>
<th>作者</th>
<th>QFord(350107)</th>
</tr>
</thead>
<tbody>
<tr>
<td>创建日期</td>
<td>2024-10-21</td>
</tr>
<tr>
<td>更新日期</td>
<td>2024-12-11</td>
</tr>
<tr>
<td>版本</td>
<td>V1.2.0</td>
</tr>
</tbody>
</table>
<p>此组件最新文档: [VLabHightlight-高亮(插件使用文档)](<a href="https://www.showdoc.com.cn/virtualLabUnreal/11558449825050157">https://www.showdoc.com.cn/virtualLabUnreal/11558449825050157</a> "VLabHightlight-高亮(插件使用文档)")</p>
<h1>设计师</h1>
<p>沈秋娟(小仙女) 2024/10/24 13:48:15
发光高亮的规则是<strong>林雨婷</strong>在负责设计</p>
<h1>插件介绍</h1>
<p>插件名称:<strong>VLabHighlight</strong>
主要用于器材(<strong>仅限网格体组件的对象</strong>)的高亮表现。
> - 此组件由交互使用并内置高亮业务,详询陈若雯或跟踪拼接业务代码。</p>
<ul>
<li><strong>导线已经更新</strong></li>
</ul>
<h1>实现方案</h1>
<p>A component that allows highlighting of <strong>static</strong> or <strong>skeletal</strong> mesh components.
This component can be used to enable or disable custom depth rendering for meshes,
which is useful for creating outline effects or other visual highlights.
<strong>Note:</strong>This method is used for actors that have a UPrimitiveComponent(inlcude Static|Skeletal Mesh Component).
Not applicable to existing BP_Ropeline.
<strong>高亮材质</strong>:M_Highlight(现已更新为Soft Outlines 提供的新材质)
<strong>PostProcessVolume</strong>的设置(高亮组件初始化时自动完成),如下图所示:
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=96b9bb8cfe38eddecc714d61da90a900&amp;file=file.png" alt="" /></p>
<h1>插件用法</h1>
<h2>插件初始化</h2>
<pre><code class="language-cpp">if (FModuleManager::Get().IsModuleLoaded(&quot;VLabHighlight&quot;))
{
FVLabHighlightModule::Get().Init(World);
}</code></pre>
<h2>蓝图</h2>
<h3>蓝图中高亮配置</h3>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=141a2a7006b7ef4ffcddbe07a640d196&amp;file=file.png" alt="" /></p>
<h3>蓝图中设置器材的网格体高亮</h3>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=504f39c16e6cf93d7a1f5422ceb9b7ad&amp;file=file.png" alt="" /></p>
<h2>C++</h2>
<h1>插件接口</h1>
<pre><code class="language-cpp">//Highlights a static or skeletal mesh component.
void HighlightMesh(UPrimitiveComponent* MeshComponent);
Removes highlight from a static or skeletal mesh component.
void RemoveHighlight(UPrimitiveComponent* MeshComponent);
//Configures highlight nodes based on names.
void ConfigureHighlightNodes(TArray&lt;FString&gt;&amp; InHighlightNodeNames, TArray&lt;FString&gt;&amp; InNonHighlightNodeNames);
//Sets whether the component should be highlighted by default.
void SetHighlight(bool bEnable);
</code></pre>
<h1>插件示例(By AI)</h1>
<pre><code class="language-cpp">// 获取Actor的高亮组件
UVLabHighlightComponent* HighlightComponent = Actor-&gt;FindComponentByClass&lt;UVLabHighlightComponent&gt;();
if (HighlightComponent)
{
// 高亮某个Mesh组件
HighlightComponent-&gt;HighlightMesh(MeshComponent);
// 取消高亮某个Mesh组件
HighlightComponent-&gt;RemoveHighlight(MeshComponent);
// 配置高亮节点
TArray&lt;FString&gt; HighlightNodes = { TEXT(&quot;Node1&quot;), TEXT(&quot;Node2&quot;) };
TArray&lt;FString&gt; NonHighlightNodes = { TEXT(&quot;Node3&quot;), TEXT(&quot;Node4&quot;) };
HighlightComponent-&gt;ConfigureHighlightNodes(HighlightNodes, NonHighlightNodes);
// 设置默认高亮
HighlightComponent-&gt;SetHighlight(true);
}
else
{
UE_LOG(LogTemp, Warning, TEXT(&quot;Highlight component not found!&quot;));
}</code></pre>
<h1>设计师反馈的需求</h1>
<p>林雨婷(Avery) 2024/10/24 18:20:24
1、颜色上可以考虑亮蓝绿色,色值可以参考#71F7FF:
主要是避免黄色,因为像电池里面也有黄色,感觉在这个黑色场景里不太突出
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=ac811c3cc462a2e13fa1df07694b6fd6&amp;file=file.png" alt="" />
2、粗细上可以是现在的1.5倍,现在的相对更细一些;
<strong>开发备注:</strong>发现导线的使用现在粗细就太粗了,所以还是需要开放粗细,可供各个器材配置使用。
临时可以先按照设计师要求调整。
3、闪动频率建议放慢至现在的0.5倍,闪动时最低亮度不用调到0,可以是最高亮度的50%,有一点梯度渐变,不那么突兀</p>
<h1>TODO</h1>
<ol>
<li>非网格体的导线的高亮方案
2024-10-25:开发已有方案,可通过代码实现。</li>
<li>高亮的外描边的颜色</li>
<li>高亮的外描边的粗细</li>
<li>高亮闪烁的开关</li>
<li>高亮闪烁的频率</li>
</ol>
<h1>新需求-实现方案</h1>
<p>上述的需求可以通过调整后处理材质(M_Highlight)来实现</p>
<h2>1. 高亮颜色</h2>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=93c3c6953c4ef0254d82b4b389da2f15&amp;file=file.png" alt="" /></p>
<h2>2. 粗细调整</h2>
<p>可直接通过修改Line Render Width 属性修改,此参数可以通过蓝图或C++动态修改。
<img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=d0a23350ca654fe9862ae7343f088442&amp;file=file.png" alt="" /></p>
<h2>3. 闪烁调整</h2>
<pre><code>### 3.1 频率调整
一般说来,频率是Time节点实现的,辅以正弦函数可以创建一个周期性的变化。
Time -&gt; Multiply (调整频率) -&gt; Sin (生成波动) -&gt; Lerp (插值)</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=675cf76a96175ed0a0025e2c730f456c&amp;file=file.png" alt="" /></p>
<h3>3.2 最低亮度调整</h3>
<pre><code>经过测试,按照设计师的需求,高亮闪烁效果就不明显了,故就不对此进行改造了。</code></pre>
<p><img src="https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=e2222b093a339a18cc8ea3c5eb18b8af&amp;file=file.png" alt="" /></p>
<h1>新需求-延时关闭高亮</h1>
<p>设置 DelayTime 变量即可</p>
<h1>附录</h1>
<p>[VLabHightlight-高亮(插件使用文档)](<a href="https://www.showdoc.com.cn/virtualLabUnreal/11558449825050157">https://www.showdoc.com.cn/virtualLabUnreal/11558449825050157</a> "VLabHightlight-高亮(插件使用文档)")
[How to create an Unreal Engine Plugin: A Step-By-Step Guide with Examples](<a href="https://www.quodsoler.com/blog/how-to-create-an-unreal-engine-plugin-a-step-by-step-guide-with-examples">https://www.quodsoler.com/blog/how-to-create-an-unreal-engine-plugin-a-step-by-step-guide-with-examples</a> "How to create an Unreal Engine Plugin: A Step-By-Step Guide with Examples")</p>