Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

Submission: Guan Sun #7

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
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
473 changes: 52 additions & 421 deletions README.md
100644 → 100755

Large diffs are not rendered by default.

154 changes: 154 additions & 0 deletions _gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
.orig

# Created by https://www.gitignore.io/api/vim,emacs,sublimetext,webstorm,eclipse

### Vim ###
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~


### Emacs ###
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*

# Org-mode
.org-id-locations
*_archive

# flymake-mode
*_flymake.*

# eshell files
/eshell/history
/eshell/lastdir

# elpa packages
/elpa/

# reftex files
*.rel

# AUCTeX auto folder
/auto/

# cask packages
.cask/


### SublimeText ###
# cache files for sublime text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache

# workspace files are user-specific
*.sublime-workspace

# project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using SublimeText
# *.sublime-project

# sftp configuration file
sftp-config.json


### WebStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio

*.iml

## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:

# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries

# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml

# Gradle:
# .idea/gradle.xml
# .idea/libraries

# Mongo Explorer plugin:
# .idea/mongoSettings.xml

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties


### Eclipse ###
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath

# Eclipse Core
.project

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# JDT-specific (Eclipse Java Development Tools)
.classpath

# Java annotation processor (APT)
.factorypath

# PDT-specific
.buildpath

# sbteclipse plugin
.target

# TeXlipse plugin
.texlipse
Empty file modified favicon.ico
100644 → 100755
Empty file.
Empty file modified glsl/clear.frag.glsl
100644 → 100755
Empty file.
4 changes: 4 additions & 0 deletions glsl/copy.frag.glsl
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ varying vec2 v_uv;

void main() {
// TODO: copy values into gl_FragData[0], [1], etc.
gl_FragData[0] = vec4( v_position,1.0 );
gl_FragData[1] = vec4( v_normal,1.0);
gl_FragData[2] = texture2D(u_colmap, v_uv);
gl_FragData[3] = texture2D(u_normap,v_uv);
}
Empty file modified glsl/copy.vert.glsl
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion glsl/deferred/ambient.frag.glsl
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ void main() {
vec4 gb3 = texture2D(u_gbufs[3], v_uv);
float depth = texture2D(u_depth, v_uv).x;
// TODO: Extract needed properties from the g-buffers into local variables
vec3 color = gb2.xyz;

if (depth == 1.0) {
gl_FragColor = vec4(0, 0, 0, 0); // set alpha to 0
return;
}

gl_FragColor = vec4(0.1, 0.1, 0.1, 1); // TODO: replace this
gl_FragColor = vec4(0.1*color, 1); // TODO: replace this
}
35 changes: 31 additions & 4 deletions glsl/deferred/blinnphong-pointlight.frag.glsl
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ uniform vec3 u_lightPos;
uniform float u_lightRad;
uniform sampler2D u_gbufs[NUM_GBUFFERS];
uniform sampler2D u_depth;
uniform int u_toon;
uniform vec3 u_cameraPos;

varying vec2 v_uv;

Expand All @@ -26,14 +28,39 @@ void main() {
vec4 gb2 = texture2D(u_gbufs[2], v_uv);
vec4 gb3 = texture2D(u_gbufs[3], v_uv);
float depth = texture2D(u_depth, v_uv).x;
// TODO: Extract needed properties from the g-buffers into local variables

// If nothing was rendered to this pixel, set alpha to 0 so that the

// If nothing was rendered to this pixel, set alpha to 0 so that the
// postprocessing step can render the sky color.
if (depth == 1.0) {
gl_FragColor = vec4(0, 0, 0, 0);
return;
}

// TODO: Extract needed properties from the g-buffers into local variables

vec3 pos = gb0.xyz; // World-space position
vec3 geomnor = gb1.xyz; // Normals of the geometry as defined, without normal mapping
vec3 colmap = gb2.xyz; // The color map - unlit "albedo" (surface color)
vec3 normap = gb3.xyz; // The raw normal map (normals relative to the surface they're on)
vec3 nor = applyNormalMap(geomnor, normap);

vec3 temp = u_lightPos - pos;
float dist = length(temp);
vec3 light = normalize(temp);
vec3 cam = normalize(u_cameraPos - pos);

float att = clamp(1.0 - dist/u_lightRad, 0.0, 1.0);

float diff = max(dot(light, nor), 0.0);
float spec = max(dot(-light + 2.0 * dot(light,nor) * nor, cam), 0.0);
spec = pow(spec, 50.0);

if(u_toon == 1){
diff = float(floor(diff/0.2)) * 0.2;
spec = float(floor(spec/0.2)) * 0.2;
}

gl_FragColor = vec4( clamp((diff+spec)*att*colmap*u_lightCol, 0.0, 1.0), 1.0);

gl_FragColor = vec4(0, 0, 1, 1); // TODO: perform lighting calculations
//gl_FragColor = vec4(0, 0, 1, 1); // TODO: perform lighting calculations
}
10 changes: 5 additions & 5 deletions glsl/deferred/debug.frag.glsl
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ void main() {
float depth = texture2D(u_depth, v_uv).x;
// TODO: Extract needed properties from the g-buffers into local variables
// These definitions are suggested for starting out, but you will probably want to change them.
vec3 pos; // World-space position
vec3 geomnor; // Normals of the geometry as defined, without normal mapping
vec3 colmap; // The color map - unlit "albedo" (surface color)
vec3 normap; // The raw normal map (normals relative to the surface they're on)
vec3 nor; // The true normals as we want to light them - with the normal map applied to the geometry normals (applyNormalMap above)
vec3 pos = gb0.xyz; // World-space position
vec3 geomnor = gb1.xyz; // Normals of the geometry as defined, without normal mapping
vec3 colmap = gb2.xyz; // The color map - unlit "albedo" (surface color)
vec3 normap = gb3.xyz; // The raw normal map (normals relative to the surface they're on)
vec3 nor = applyNormalMap(geomnor, normap); // The true normals as we want to light them - with the normal map applied to the geometry normals (applyNormalMap above)

if (u_debug == 0) {
gl_FragColor = vec4(vec3(depth), 1.0);
Expand Down
38 changes: 38 additions & 0 deletions glsl/post/bloom.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#version 100
precision highp float;
precision highp int;

uniform sampler2D u_color;
varying vec2 v_uv;

const vec4 SKY_COLOR = vec4(0.01, 0.14, 0.42, 1.0);
int samples = 25;

void main() {

vec4 color = texture2D(u_color, v_uv);

if(color.a == 0.0)
{
gl_FragColor = SKY_COLOR;
return;
}

int diff = 2;//(samples-1)/2;
vec2 sizeFactor = vec2(1.0/800.0, 1.0/600.0);

vec4 bloom = vec4(0.0);

for(int i= -2; i<= 2; i++){
for(int j= -2; j<= 2; j++){
vec2 offset = vec2(i,j) * sizeFactor;
bloom += 0.04*texture2D(u_color, v_uv + offset);
}
}

gl_FragColor = clamp((bloom + color), 0.0, 1.0);

//gl_FragColor = vec4(1.0);


}
12 changes: 12 additions & 0 deletions glsl/post/blur.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#version 100
precision highp float;
precision highp int;

uniform float opacity;
uniform sampler2D u_color;
varying vec2 v_uv;

void main() {
vec4 color = texture2D( u_color, v_uv );
gl_FragColor = opacity * color;
}
10 changes: 10 additions & 0 deletions glsl/post/blur.vect.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 100
precision highp float;
precision highp int;

varying vec2 v_uv

void main() {
v_uv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
Empty file modified glsl/post/one.frag.glsl
100644 → 100755
Empty file.
29 changes: 29 additions & 0 deletions glsl/post/toon.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#version 100
precision highp float;
precision highp int;

uniform sampler2D u_color;
varying vec2 v_uv;

const vec4 SKY_COLOR = vec4(0.01, 0.14, 0.42, 1.0);

void main() {
vec4 color = texture2D(u_color, v_uv);

if(color.a == 0.0)
{
gl_FragColor = SKY_COLOR;
//return;
}

vec2 sizeFactor = vec2(1.0/800.0, 1.0/600.0);

vec4 L1 = texture2D(u_color, v_uv + sizeFactor * vec2(-1.0,0.0));
vec4 L2 = texture2D(u_color, v_uv + sizeFactor * vec2(-1.0,-1.0));
vec4 L3 = texture2D(u_color, v_uv + sizeFactor * vec2(-1.0,1.0));
vec4 R1 = texture2D(u_color, v_uv + sizeFactor * vec2(1.0,0.0));
vec4 R2 = texture2D(u_color, v_uv + sizeFactor * vec2(1.0,-1.0));
vec4 R3 = texture2D(u_color, v_uv + sizeFactor * vec2(1.0,1.0));

gl_FragColor = -L1-L2-L3+R1+R2+R3;
}
41 changes: 41 additions & 0 deletions glsl/post/toon2.frag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#version 100
precision highp float;
precision highp int;

uniform sampler2D u_color;
uniform sampler2D u_color_1;
varying vec2 v_uv;

const vec4 SKY_COLOR = vec4(0.01, 0.14, 0.42, 1.0);

void main() {
vec4 color = texture2D(u_color, v_uv);
vec4 color_1 = texture2D(u_color_1, v_uv);

if(color.a == 0.0)
{
gl_FragColor = SKY_COLOR;
//return;
}

vec2 sizeFactor = vec2(1.0/800.0, 1.0/600.0);

vec4 T1 = texture2D(u_color, v_uv + sizeFactor * vec2(0.0,-1.0));
vec4 T2 = texture2D(u_color, v_uv + sizeFactor * vec2(-1.0,-1.0));
vec4 T3 = texture2D(u_color, v_uv + sizeFactor * vec2(1.0,-1.0));
vec4 B1 = texture2D(u_color, v_uv + sizeFactor * vec2(0.0,1.0));
vec4 B2 = texture2D(u_color, v_uv + sizeFactor * vec2(-1.0,1.0));
vec4 B3 = texture2D(u_color, v_uv + sizeFactor * vec2(1.0,1.0));

vec4 blend = -T1-T2-T3+B1+B2+B3;

blend = vec4(vec3(max(max(blend.x, blend.y), blend.z)), 1.0);

if (blend.x <= 0.2){
blend = vec4(vec3(0.0), 1.0);
} else {
blend = vec4(1.0);
}

gl_FragColor = (1.0-blend) * color_1;
}
Empty file modified glsl/quad.vert.glsl
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion glsl/red.frag.glsl
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ precision highp float;
precision highp int;

void main() {
gl_FragColor = vec4(1, 0, 0, 1);
gl_FragColor = vec4(1, 0, 0, 0.1);
}
Binary file added img/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/Workbook1.xlsx
Binary file not shown.
Binary file added img/Workbook2.xlsx
Binary file not shown.
Binary file added img/Workbook3.xlsx
Binary file not shown.
Binary file modified img/thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/video.png
Binary file not shown.
Loading