fc513e163b
* Add new sample * Add FSR shaders * Add example template * Add Antialiasing * Add multi resolution rendering * Implement magnifier * Implement FSR EASU pass * Implement FSR RCAS pass * Improve wording of comments and UI * Remove use of ffx_a.h in cpp * Remove example external files * Perform bilinear upsampling by compute shader * Add FSR 16 Bit support * Improve magnifier picking * Fix magnifier picking * Render magnifier widget * Renaming of stuff * Separate magnifier functionality * Move FSR into separate class * Reduce scope of FSR resources * Fix FSR for Vulkan * Fix OpenGL support * Update sample screenshot
35 lines
966 B
Python
35 lines
966 B
Python
$input a_position, a_normal
|
|
$output v_normal, v_texcoord0, v_texcoord1, v_texcoord2
|
|
|
|
/*
|
|
* Copyright 2021 elven cache. All rights reserved.
|
|
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
|
|
*/
|
|
|
|
#include "../common/common.sh"
|
|
|
|
void main()
|
|
{
|
|
// Calculate vertex position
|
|
vec3 pos = a_position.xyz;
|
|
gl_Position = mul(u_modelViewProj, vec4(pos, 1.0));
|
|
|
|
vec3 wsPos = mul(u_model[0], vec4(pos, 1.0)).xyz;
|
|
|
|
// Calculate normal, unpack
|
|
vec3 osNormal = a_normal.xyz * 2.0 - 1.0;
|
|
|
|
// Transform normal into world space
|
|
vec3 wsNormal = mul(u_model[0], vec4(osNormal, 0.0)).xyz;
|
|
|
|
v_normal.xyz = normalize(wsNormal);
|
|
v_texcoord0 = a_position.xy * vec2_splat(0.5); // the used mesh does not provide texture coordinates
|
|
|
|
// Store world space view vector in extra texCoord attribute
|
|
vec3 wsCamPos = mul(u_invView, vec4(0.0, 0.0, 0.0, 1.0)).xyz;
|
|
vec3 view = normalize(wsCamPos - wsPos);
|
|
|
|
v_texcoord1 = vec4(wsPos, 1.0);
|
|
v_texcoord2 = vec4(view, 1.0);
|
|
}
|