Шейдер размытия SSAO
This commit is contained in:
		
							parent
							
								
									8b5e1e45f3
								
							
						
					
					
						commit
						47d7c6c109
					
				
							
								
								
									
										23
									
								
								shaders/ssaoBlur.frag
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								shaders/ssaoBlur.frag
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | ||||
| #version 330 core | ||||
| 
 | ||||
| in vec2 texCoord; | ||||
| 
 | ||||
| out float occlusion; | ||||
| 
 | ||||
| uniform sampler2D ssao; | ||||
| 
 | ||||
| void main()  | ||||
| { | ||||
|     vec2 texelSize = 1.0 / vec2(textureSize(ssao, 0)); | ||||
|     vec2 offset; | ||||
|     occlusion = 0.0; | ||||
|     for (int x = -2; x < 2; x++)  | ||||
|     { | ||||
|         for (int y = -2; y < 2; y++)  | ||||
|         { | ||||
|             offset = vec2(x, y) * texelSize; | ||||
|             occlusion += texture(ssao, texCoord + offset).r; | ||||
|         } | ||||
|     } | ||||
|     occlusion = occlusion / (4.0 * 4.0); | ||||
| }   | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user