Enabled G-Buffer for space items.

This commit is contained in:
Jonathas Costa
2017-05-31 17:12:44 -04:00
parent 9ea188cb2e
commit e3e1155a0e
7 changed files with 48 additions and 1 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ in vec4 vs_normal;
in vec4 vs_position;
in vec4 vs_posWorld;
in vec4 vs_gPosition;
out vec3 vs_gNormal;
in vec3 vs_gNormal;
#include "PowerScaling/powerScaling_fs.hglsl"
#include "fragment.glsl"
@@ -38,6 +38,8 @@ uniform sampler2D texture1;
in vec2 vs_st;
in vec4 vs_normal;
in vec4 vs_position;
in vec4 vs_gPosition;
in vec3 vs_gNormal;
#include "fragment.glsl"
#include "PowerScaling/powerScaling_fs.hglsl"
@@ -78,5 +80,10 @@ Fragment getFragment() {
frag.color = diffuse;
frag.depth = vs_position.w;
frag.gColor = diffuse;
frag.gPosition = vs_gPosition;
// TODO: get the write reflectance from the texture
frag.gNormalReflectance = vec4(vs_gNormal, 1.0);
return frag;
}
@@ -36,6 +36,8 @@ out vec2 vs_st;
out vec4 vs_normal;
out vec4 vs_position;
out float s;
out vec4 vs_gPosition;
out vec3 vs_gNormal;
#include "PowerScaling/powerScaling_vs.hglsl"
@@ -44,11 +46,18 @@ void main() {
vs_st = in_st;
vec4 tmp = in_position;
// G-Buffer
vs_gNormal = in_normal;
// this is wrong for the normal. The normal transform is the transposed inverse of the model transform
vs_normal = normalize(ModelTransform * vec4(in_normal,0));
// vs_normal = vec4(in_normal, 0.0);
vec4 position = vec4(tmp.xyz * pow(10, tmp.w), 1.0);
// G-Buffer
vs_gPosition = position;
position = modelViewProjectionTransform * position;
vs_position = z_normalization(position);
+7
View File
@@ -50,6 +50,8 @@ in vec2 vs_st;
in vec4 vs_normal;
in vec4 vs_position;
in vec4 vs_posWorld;
in vec4 vs_gPosition;
in vec3 vs_gNormal;
#include "PowerScaling/powerScaling_fs.hglsl"
#include "fragment.glsl"
@@ -124,6 +126,11 @@ Fragment getFragment() {
frag.color = diffuse;
frag.depth = depth;
frag.gColor = frag.color;
frag.gPosition = vs_gPosition;
// TODO: get the write reflectance from the texture
frag.gNormalReflectance = vec4(vs_gNormal, 0.5);
return frag;
}
@@ -52,6 +52,8 @@ in vec2 vs_nightTex;
in vec4 vs_normal;
in vec4 vs_position;
in vec4 vs_posWorld;
in vec4 vs_gPosition;
in vec3 vs_gNormal;
#include "PowerScaling/powerScaling_fs.hglsl"
#include "fragment.glsl"
@@ -126,6 +128,11 @@ Fragment getFragment() {
frag.color = diffuse;
frag.depth = depth;
frag.gColor = diffuse;
frag.gPosition = vs_gPosition;
// TODO: get the write reflectance from the texture
frag.gNormalReflectance = vec4(vs_gNormal, 0.5);
return frag;
}
@@ -38,6 +38,8 @@ out vec4 vs_normal;
out vec4 vs_position;
out vec4 vs_posWorld;
out float s;
out vec4 vs_gPosition;
out vec3 vs_gNormal;
#include "PowerScaling/powerScaling_vs.hglsl"
@@ -51,10 +53,16 @@ void main()
// this is wrong for the normal. The normal transform is the transposed inverse of the model transform
vs_normal = normalize(ModelTransform * vec4(in_normal,0));
// G-Buffer
vs_gNormal = in_normal;
// The things is not in world coordinates, they are in
// regular view/eye coordinates.
vec4 position = pscTransform(tmp, ModelTransform);
// G-Buffer
vs_gPosition = position;
vec3 local_vertex_pos = mat3(ModelTransform) * in_position.xyz;
vec4 vP = psc_addition(vec4(local_vertex_pos,in_position.w),objpos);
vec4 conv = vec4(vP.xyz * pow(10,vP.w), 1.0);
+9
View File
@@ -40,6 +40,9 @@ out vec4 vs_normal;
out vec4 vs_position;
out vec4 vs_posWorld;
out float s;
out vec4 vs_gPosition;
out vec3 vs_gNormal;
#include "PowerScaling/powerScaling_vs.hglsl"
@@ -53,10 +56,16 @@ void main()
// this is wrong for the normal. The normal transform is the transposed inverse of the model transform
vs_normal = normalize(ModelTransform * vec4(in_normal,0));
// We are using the normal in Object (model) space in G-Buffer (because of atm).
vs_gNormal = in_normal;
// The things is not in world coordinates, they are in
// regular view/eye coordinates.
vec4 position = pscTransform(tmp, ModelTransform);
// G-Buffer
vs_gPosition = position;
vec3 local_vertex_pos = mat3(ModelTransform) * in_position.xyz;
vec4 vP = psc_addition(vec4(local_vertex_pos,in_position.w),objpos);
vec4 conv = vec4(vP.xyz * pow(10,vP.w), 1.0);