Skip to content

Commit

Permalink
Revert "Added "glow" to lights and fixed soft shadows so that the low…
Browse files Browse the repository at this point in the history
…est position is the same as hard shadows."

This reverts commit e5bf3dc.
  • Loading branch information
henryseg committed Jan 26, 2019
1 parent e5bf3dc commit c769544
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 16 deletions.
4 changes: 3 additions & 1 deletion js/HyperSpace.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ var loadShaders = function(){ //Since our shader is made up of strings we can co
}

var finishInit = function(fShader){
// console.log(fShader);
g_material = new THREE.ShaderMaterial({
uniforms:{
isStereo:{type: "i", value: 0},
Expand All @@ -287,11 +288,12 @@ var finishInit = function(fShader){
lightIntensities:{type:"v3v", value:lightIntensities},
attnModel:{type:"i", value:attnModel},
renderShadows:{type:"bv", value:[false, false]},
shadSoft:{type:"f", value:10000.0},
shadSoft:{type:"f", value:128.0},
texture:{type:"t", value: new THREE.TextureLoader().load("images/concrete2.png")},
// texture:{type:"t", value: new THREE.TextureLoader().load("images/white.png")},
controllerCount:{type:"i", value: 0},
controllerBoosts:{type:"m4", value:g_controllerBoosts},
//controllerDualPoints:{type:"v4v", value:g_controllerDualPoints},
globalObjectBoosts:{type:"m4v", value:globalObjectBoosts},
invGlobalObjectBoosts:{type:"m4v", value:invGlobalObjectBoosts},
globalObjectRadii:{type:"v3v", value:globalObjectRadii},
Expand Down
2 changes: 1 addition & 1 deletion js/UI.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ var initGui = function(){

softnessController.onChange(function(value){
if(value === 0.0){
g_material.uniforms.shadSoft.value = 10000.0;
g_material.uniforms.shadSoft.value = 128.0;
}
else{
g_material.uniforms.shadSoft.value = 1.0/value;
Expand Down
13 changes: 1 addition & 12 deletions shaders/fragment.glsl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//GLOBAL OBJECTS SCENE ++++++++++++++++++++++++++++++++++++++++++++++++
float globalSceneSDF(vec4 samplePoint, mat4 globalTransMatrix, bool collideWithLights){
float distance = maxDist;
float glowStrength = 4.0;
if(collideWithLights){
//Light Objects
for(int i=0; i<NUM_LIGHTS; i++){
Expand All @@ -15,9 +14,6 @@ float globalSceneSDF(vec4 samplePoint, mat4 globalTransMatrix, bool collideWithL
globalLightColor = lightIntensities[i];
return distance;
}
else{
glow[i] = max(glow[i], 1.0-(glowStrength*distance));
}
}
}
//Controller Objects
Expand Down Expand Up @@ -216,20 +212,13 @@ void main(){
rayDirV *= currentBoost;
//generate direction then transform to hyperboloid ------------------------
vec4 rayDirVPrime = geometryDirection(rayOrigin, rayDirV);

for(int i = 0; i<NUM_LIGHTS+1; i++){
glow[i] = 0.0;
}

//get our raymarched distance back ------------------------
mat4 totalFixMatrix = mat4(1.0);
raymarch(rayOrigin, rayDirVPrime, totalFixMatrix);

//Based on hitWhich decide whether we hit a global object, local object, or nothing
if(hitWhich == 0){ //Didn't hit anything ------------------------
for(int i = 0; i<NUM_LIGHTS; i++){
gl_FragColor = vec4(0.2 * glow[i] * lightIntensities[i].xyz, 1.0);
}
gl_FragColor = vec4(0.0);
return;
}
else if(hitWhich == 1){ // global lights
Expand Down
1 change: 0 additions & 1 deletion shaders/globalsInclude.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ vec4 sampleTangentVector = vec4(1, 1, 1, 1);
vec4 N = ORIGIN; //normal vector
vec4 globalLightColor = ORIGIN;
int hitWhich = 0;
float glow[NUM_LIGHTS+1];
//-------------------------------------------
//Translation & Utility Variables
//--------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion shaders/lighting.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ vec3 phongModel(mat4 invObjectBoost, bool isGlobal, mat4 globalTransMatrix){
if(lightIntensities[i].w != 0.0){
TLP = lightPositions[i]*globalTransMatrix;
color += lightingCalculations(SP, TLP, V, baseColor, lightIntensities[i], globalTransMatrix);
color += 0.2 * glow[i] * lightIntensities[i].xyz;
}
}

Expand Down

0 comments on commit c769544

Please sign in to comment.