stone voxel type, lighting fixes, anim fix
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-09-24 21:11:37 -04:00
parent dd415681bb
commit 95695188e3
15 changed files with 127 additions and 55 deletions

View File

@ -123,7 +123,7 @@
] ]
}, },
{ {
"voxelTypeIds" : [4], "voxelTypeIds" : [4,6],
"footstepRegularBareAudioPaths" : [ "footstepRegularBareAudioPaths" : [
"Audio/movement/surface/stone/Bare Step Stone Medium A.wav", "Audio/movement/surface/stone/Bare Step Stone Medium A.wav",
"Audio/movement/surface/stone/Bare Step Stone Medium B.wav", "Audio/movement/surface/stone/Bare Step Stone Medium B.wav",

View File

@ -552,7 +552,7 @@
"idleData": { "idleData": {
"animation": { "animation": {
"nameFirstPerson" : "BindPose", "nameFirstPerson" : "BindPose",
"nameThirdPerson" : "Idle", "nameThirdPerson" : "Idle1",
"priorityCategory" : "IDLE" "priorityCategory" : "IDLE"
} }
}, },

View File

@ -436,7 +436,7 @@
"idleData": { "idleData": {
"animation": { "animation": {
"nameFirstPerson" : "Idle", "nameFirstPerson" : "Idle",
"nameThirdPerson" : "Idle", "nameThirdPerson" : "Idle1",
"priorityCategory" : "IDLE" "priorityCategory" : "IDLE"
} }
}, },

View File

@ -31,6 +31,11 @@
"id" : 5, "id" : 5,
"name" : "snow", "name" : "snow",
"texture" : "/Textures/Ground/snow1_256.jpg" "texture" : "/Textures/Ground/snow1_256.jpg"
},
{
"id" : 6,
"name" : "stone",
"texture" : "/Textures/Ground/cliff1_256.png"
} }
] ]
} }

View File

@ -1,50 +1,39 @@
#version 330 core #version 450 core
/**
Bind points for different SSBOs
*/
#define DIRECT_LIGHT_SSBO_BIND_POINT 3
/**
transparency
*/
#define SMALL_EPSILON 0.001
/**
The direct global light
*/
struct DirectLight {
vec3 direction;
vec3 color;
};
out vec4 FragColor; out vec4 FragColor;
layout(std430, binding = DIRECT_LIGHT_SSBO_BIND_POINT) restrict buffer dirLightSSBO {
DirectLight directLight;
};
struct Material { struct Material {
sampler2D diffuse; sampler2D diffuse;
sampler2D specular; sampler2D specular;
float shininess; float shininess;
}; };
struct DirLight {
vec3 direction;
vec3 ambient;
vec3 diffuse;
vec3 specular;
};
struct PointLight {
vec3 position;
float constant;
float linear;
float quadratic;
vec3 ambient;
vec3 diffuse;
vec3 specular;
};
struct SpotLight {
vec3 position;
vec3 direction;
float cutOff;
float outerCutOff;
float constant;
float linear;
float quadratic;
vec3 ambient;
vec3 diffuse;
vec3 specular;
};
#define NR_POINT_LIGHTS 10
in vec3 FragPos; in vec3 FragPos;
in vec3 Normal; in vec3 Normal;
@ -52,9 +41,6 @@ in vec2 TexCoord;
in vec4 FragPosLightSpace; in vec4 FragPosLightSpace;
uniform vec3 viewPos; uniform vec3 viewPos;
uniform DirLight dirLight;
uniform PointLight pointLights[NR_POINT_LIGHTS];
uniform SpotLight spotLight;
uniform Material material; uniform Material material;
//texture stuff //texture stuff
@ -65,6 +51,9 @@ uniform int hasTransparency;
//light depth map //light depth map
uniform sampler2D shadowMap; uniform sampler2D shadowMap;
// function prototypes
float calcLightIntensityTotal(vec3 normal);
void main(){ void main(){
if(hasTransparency == 1){ if(hasTransparency == 1){
@ -72,5 +61,29 @@ void main(){
discard; discard;
} }
} }
FragColor = texture(material.diffuse, TexCoord); vec4 textureColor = texture(material.diffuse, TexCoord);
//grab light intensity
vec3 norm = normalize(Normal);
vec3 lightIntensity = vec3(calcLightIntensityTotal(norm));
//calculate final color
vec3 finalColor = textureColor.rgb * lightIntensity;
FragColor = vec4(finalColor, textureColor.a);
}
float calcLightIntensityAmbient(){
//calculate average of ambient light
float avg = (directLight.color.x + directLight.color.y + directLight.color.z)/3.0;
return avg;
}
//
float calcLightIntensityTotal(vec3 normal){
//ambient intensity
float ambientLightIntensity = calcLightIntensityAmbient();
//sum
float total = ambientLightIntensity;
return total;
} }

View File

@ -21,6 +21,7 @@ uniform mat4 lightSpaceMatrix;
//output buffers //output buffers
out vec3 Normal; out vec3 Normal;
out vec3 FragPos; out vec3 FragPos;
out vec3 ViewFragPos;
out vec2 TexCoord; out vec2 TexCoord;
out vec4 FragPosLightSpace; out vec4 FragPosLightSpace;
@ -35,6 +36,7 @@ void main() {
//push frag, normal, and texture positions to fragment shader //push frag, normal, and texture positions to fragment shader
FragPos = vec3(model * FinalVertex); FragPos = vec3(model * FinalVertex);
ViewFragPos = vec3(view * model * FinalVertex);
Normal = mat3(transpose(inverse(model))) * aNormal; Normal = mat3(transpose(inverse(model))) * aNormal;
TexCoord = aTex; TexCoord = aTex;

View File

@ -85,15 +85,10 @@ in vec3 colorShiftValue;
uniform vec3 viewPos; uniform vec3 viewPos;
// uniform DirLight dirLight;
// uniform PointLight pointLights[NR_POINT_LIGHTS];
// uniform SpotLight spotLight;
uniform Material material; uniform Material material;
//texture stuff //texture stuff
// uniform sampler2D ourTexture;
uniform int hasTransparency; uniform int hasTransparency;
// uniform sampler2D specularTexture;
//light depth map //light depth map
uniform sampler2D shadowMap; uniform sampler2D shadowMap;

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -16,14 +16,24 @@
+ feedback driven requirements + feedback driven requirements
Item/Equip overhaul (again) Item/Equip overhaul (again)
- Add punching/unarmed combat - Add punching/unarmed combat
- Implement gadgets
- Trap
- Bear
- Freeze
- Flame
- Bomb (to be thrown)
- Regular (Deals damage, ignites)
- Air (high push coeff)
- Flash (dazes)
- Sleep (puts enemies to sleep)
- Smoke (creates LOS blockers)
- Decoy (creates a decoy)
- Torch
- Throwable potions
Fix ui scaling on abnormal monitors Fix ui scaling on abnormal monitors
Better skybox
- Fix transparency calculations for far-out objects
Crouching Crouching
Model clothing, hair for the human Model clothing, hair for the human
particles, light on sword collision particles, light on sword collision
Looking angle leverages rotators to swing sword at angle (ie if you look up you swing your sword into the sky)
Come up with a title for the game and create a title menu for it (ideally with some animation and music)
Objectives Objectives
- PVP arena mode initially? - PVP arena mode initially?
- Spawn player at start of a dungeon - Spawn player at start of a dungeon

View File

@ -841,6 +841,9 @@ Tree model debug menu
(09/24/2024) (09/24/2024)
Make voxel selection panel have better spacing Make voxel selection panel have better spacing
Partially fix idle animations for human + skeleton
Directional lighting color control
Skysphere affected by directional lighting
# TODO # TODO
@ -1012,6 +1015,12 @@ Weather tracking
- Keeps track at macro level of temperature - Keeps track at macro level of temperature
- Keeps track at macro level of precipitation - Keeps track at macro level of precipitation
Environmental Audio Service
- Tracks characteristics about surroundings to determine looping audio to play
- Voxels nearby
- Major entity types nearby
- Biomes
Color Palette Generator Color Palette Generator

View File

@ -425,6 +425,45 @@ public class MenuGeneratorsLevelEditor {
directionalLight.setDirection(direction); directionalLight.setDirection(direction);
})); }));
scrollable.addChild(zDiv); scrollable.addChild(zDiv);
Div rDiv = Div.createDiv();
rDiv.setMaxHeight(50);
rDiv.setFlexDirection(YogaFlexDirection.Row);
rDiv.addChild(Label.createLabel("R: "));
rDiv.addChild(Slider.createSlider((ValueChangeEvent event) -> {
LightManager lightManager = Globals.renderingEngine.getLightManager();
DirectionalLight directionalLight = lightManager.getDirectionalLight();
Vector3f color = directionalLight.getColor();
color.x = event.getAsFloat() * 2 - 1;
directionalLight.setColor(color);
}));
scrollable.addChild(rDiv);
Div gDiv = Div.createDiv();
gDiv.setMaxHeight(50);
gDiv.setFlexDirection(YogaFlexDirection.Row);
gDiv.addChild(Label.createLabel("G: "));
gDiv.addChild(Slider.createSlider((ValueChangeEvent event) -> {
LightManager lightManager = Globals.renderingEngine.getLightManager();
DirectionalLight directionalLight = lightManager.getDirectionalLight();
Vector3f color = directionalLight.getColor();
color.y = event.getAsFloat() * 2 - 1;
directionalLight.setColor(color);
}));
scrollable.addChild(gDiv);
Div bDiv = Div.createDiv();
bDiv.setMaxHeight(50);
bDiv.setFlexDirection(YogaFlexDirection.Row);
bDiv.addChild(Label.createLabel("B: "));
bDiv.addChild(Slider.createSlider((ValueChangeEvent event) -> {
LightManager lightManager = Globals.renderingEngine.getLightManager();
DirectionalLight directionalLight = lightManager.getDirectionalLight();
Vector3f color = directionalLight.getColor();
color.z = event.getAsFloat() * 2 - 1;
directionalLight.setColor(color);
}));
scrollable.addChild(bDiv);
Globals.signalSystem.post(SignalType.YOGA_APPLY,mainSidePanel); Globals.signalSystem.post(SignalType.YOGA_APPLY,mainSidePanel);

View File

@ -23,7 +23,6 @@ public class Animation {
//common animations //common animations
public static final String ANIMATION_MOVEMENT_STARTUP = "WalkStart"; public static final String ANIMATION_MOVEMENT_STARTUP = "WalkStart";
public static final String ANIMATION_MOVEMENT_MOVE = "Walk"; public static final String ANIMATION_MOVEMENT_MOVE = "Walk";
public static final String ANIMATION_IDLE_1 = "Idle1";
public static final String ANIMATION_SWING_PRIMARY = "SwingWeapon"; public static final String ANIMATION_SWING_PRIMARY = "SwingWeapon";
public static final String ANIMATION_SPRINT_STARTUP = "RunStart"; public static final String ANIMATION_SPRINT_STARTUP = "RunStart";
public static final String ANIMATION_SPRINT = "Run"; public static final String ANIMATION_SPRINT = "Run";

View File

@ -1,4 +1,4 @@
package electrosphere.menu; package electrosphere.client.ui.menu;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;