Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
Binary file modified resources/images/particle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/shaders/particles.frag
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ uniform float alpha;
void main()
{
vec4 c = texture(particle_texture, TexCoords);
fragColor = c*vec4(1,1,1,alpha)*1.6;
fragColor = c*vec4(1,1,1,alpha);
}
4 changes: 3 additions & 1 deletion resources/shaders/particles.vert
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ uniform float alpha;
void main()
{
float scale = 1.f;//2000.0f;
TexCoords = vec2(pos.x, pos.w);
TexCoords = vec2(pos.z, pos.w);
//ParticleColor = color;
// gl_Position = projection *view* vec4((pos * scale) + vec2(offset), 0.0, 1.0);
gl_Position = (vec4(pos.x*alpha, pos.y*alpha, 0, 1) + projection*view*vec4(vec3(offset), 1))*scale;
//gl_Position = vec4(pos.x, pos.y, 0, 1);


}
6 changes: 6 additions & 0 deletions resources/shaders/shader.frag
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ in vec3 refrPos;
in float refrProb;
in vec2 uv;
in float matIor;
in float visibility;

uniform sampler2D texture_img;

Expand All @@ -27,6 +28,8 @@ uniform vec2 widthBounds;
uniform vec2 lengthBounds;
//uniform float test = 0;

uniform vec4 skyColor = vec4(1);

// Random methods from https://gist.github.com/patriciogonzalezvivo/670c22f3966e662d2f83

float rand(vec2 n) {
Expand Down Expand Up @@ -120,4 +123,7 @@ void main() {
// fragColor = texture(groundSampler, vec2(refrUV));
// fragColor = vec4(normal_worldSpace[0], 0, normal_worldSpace[1], 1.f);
// fragColor = diffuse;

//fragColor = vec4(vec3(visibility), 1);
// fragColor = mix(vec4(skyColor, 1.f), fragColor, 1.f);
}
14 changes: 12 additions & 2 deletions resources/shaders/shader.vert
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ out vec3 refrPos;
out float refrProb;
out vec2 uv;
out float matIor;
out float visibility;

const float density = .001f;
const float gradient = 4.f;

vec4 getRefrPos() {
// float depth = -1500.f; // TODO: Pass as uniform
Expand Down Expand Up @@ -69,8 +73,8 @@ vec3 getReflPos() {
void main() {
// float depth = -4.f;
// float dist = position.y - depth;
float width = 81.f * 2.f;
float length = 81.f * 2.f;
// float width = 81.f * 2.f;
// float length = 81.f * 2.f;
matIor = 1.33f;

normal_cameraSpace = normalize(inverse(transpose(mat3(view))) * inverseTransposeModel * normal);
Expand All @@ -91,4 +95,10 @@ void main() {
reflPos = getReflPos();

gl_Position = proj * view * model * vec4(position, 1);

// vec4 positionRelationToCam = view * vec4(pos, 1.f);
// float distance = length(positionRelationToCam.xyz);
// visibility = exp(-pow((distance*density), gradient));
// //visibility = distance * .0009f;
// visibility = clamp(visibility, 0.f, 1.f);
}