28 lines
		
	
	
		
			629 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
		
		
			
		
	
	
			28 lines
		
	
	
		
			629 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| 
								 | 
							
								---
							 | 
						|||
| 
								 | 
							
								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);
							 | 
						|||
| 
								 | 
							
								```
							 |