Шейдеры вычисления каскадов теней
This commit is contained in:
		
							parent
							
								
									b8014dfd4d
								
							
						
					
					
						commit
						91c7fc1f38
					
				
							
								
								
									
										6
									
								
								shaders/empty.frag
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								shaders/empty.frag
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | ||||
| #version 330 core | ||||
| 
 | ||||
| void main() | ||||
| { | ||||
|      | ||||
| } | ||||
							
								
								
									
										22
									
								
								shaders/sun_shadow.geom
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								shaders/sun_shadow.geom
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | ||||
| #version 420 core | ||||
| 
 | ||||
| layout(triangles, invocations = 4) in; // здесь invocations должно соответствовать количеству каскадов | ||||
| layout(triangle_strip, max_vertices = 3) out; | ||||
| 
 | ||||
| layout(std140, binding = 3) uniform Sun | ||||
| { | ||||
|     vec3 direction; | ||||
|     vec3 color; | ||||
|     mat4 vp[4]; | ||||
| } sun; | ||||
| 
 | ||||
| void main() | ||||
| {  | ||||
| 	for (int i = 0; i < 3; ++i) | ||||
| 	{ | ||||
| 		gl_Position = sun.vp[gl_InvocationID] * gl_in[i].gl_Position; | ||||
| 		gl_Layer = gl_InvocationID; | ||||
| 		EmitVertex(); | ||||
| 	} | ||||
| 	EndPrimitive(); | ||||
| }   | ||||
| @ -4,14 +4,7 @@ layout (location = 0) in vec3 pos; | ||||
| 
 | ||||
| uniform mat4 model; | ||||
| 
 | ||||
| layout(std140, binding = 3) uniform Sun | ||||
| { | ||||
|     vec3 direction; | ||||
|     vec3 color; | ||||
|     mat4 vp; | ||||
| } sun; | ||||
| 
 | ||||
| void main() | ||||
| { | ||||
|     gl_Position = sun.vp * model * vec4(pos, 1.0); | ||||
|     gl_Position = model * vec4(pos, 1.0); | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user