BlueRoseNote/03-UnrealEngine/Rendering/Shader/给Pass传入SceneColor.md

28 lines
629 B
Markdown
Raw Permalink Normal View History

2023-06-29 11:55:02 +08:00
---
title: 给Pass传入SceneColor
date: 2022-10-10 15:11:46
excerpt:
tags: Rendering
rating: ⭐
---
## 添加变量
```c++
SHADER_PARAMETER_RDG_TEXTURE(Texture2D, SceneColorTexture)
SHADER_PARAMETER_SAMPLER(SamplerState, SceneColorTextureSampler)
```
传入变量
```c++
PassParameters->SceneColorTexture = SceneColorTexture.Target;
PassParameters->SceneColorTextureSampler = TStaticSamplerState<>::GetRHI();
```
## Shader
```c++
Texture2D       SceneColorTexture;
SamplerState    SceneColorTextureSampler;
```
```c++
float4 SceneColor = SceneColorTexture.SampleLevel(SceneColorTextureSampler, SceneBufferUV, 0);
```