mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-25 08:56:37 +00:00 
			
		
		
		
	Move tangent space generation to the vertex shaders Support diffuse parallax when no normal map is present Don't use diffuse parallax if there's no diffuse map Generalize normal-to-view conversion Rewrite parallax
		
			
				
	
	
		
			14 lines
		
	
	
	
		
			418 B
		
	
	
	
		
			GLSL
		
	
	
	
	
	
			
		
		
	
	
			14 lines
		
	
	
	
		
			418 B
		
	
	
	
		
			GLSL
		
	
	
	
	
	
| varying mat3 normalToViewMatrix;
 | |
| 
 | |
| mat3 generateTangentSpace(vec4 tangent, vec3 normal)
 | |
| {
 | |
|     vec3 normalizedNormal = normalize(normal);
 | |
|     vec3 normalizedTangent = normalize(tangent.xyz);
 | |
|     vec3 binormal = cross(normalizedTangent, normalizedNormal) * tangent.w;
 | |
|     return mat3(normalizedTangent, binormal, normalizedNormal);
 | |
| }
 | |
| 
 | |
| vec3 normalToView(vec3 normal)
 | |
| {
 | |
|     return normalize(normalToViewMatrix * normal);
 | |
| }
 |