Better lighting
This commit is contained in:
parent
8d219d2a35
commit
eb01ec4877
26 changed files with 73 additions and 38 deletions
|
|
@ -5,7 +5,7 @@
|
|||
// also Vulkan Book https://github.com/lwjglgamedev/vulkanbook/blob/master/bookcontents/chapter-15/chapter-15.md
|
||||
|
||||
|
||||
const int MAX_LIGHTS = 10;
|
||||
const int MAX_LIGHTS = 1000;
|
||||
const float PI = 3.14159265359;
|
||||
|
||||
struct Light {
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
layout(constant_id = 0) const int USE_AA = 0;
|
||||
|
||||
const float GAMMA_CONST = 0.4545;
|
||||
const float GAMMA_CONST = 0.8545;
|
||||
const float SPAN_MAX = 8.0;
|
||||
const float REDUCE_MIN = 1.0/128.0;
|
||||
const float REDUCE_MUL = 1.0/32.0;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
layout(constant_id = 0) const int USE_AA = 0;
|
||||
|
||||
const float GAMMA_CONST = 0.4545;
|
||||
const float GAMMA_CONST = 0.8545;
|
||||
const float SPAN_MAX = 8.0;
|
||||
const float REDUCE_MIN = 1.0/128.0;
|
||||
const float REDUCE_MUL = 1.0/32.0;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 64;
|
||||
const int MAX_TEXTURES = 512;
|
||||
|
||||
layout(location = 0) in vec4 inPos;
|
||||
layout(location = 1) in vec3 inNormal;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 128;
|
||||
const int MAX_TEXTURES = 512;
|
||||
|
||||
layout(location = 0) in vec4 inPos;
|
||||
layout(location = 1) in vec3 inNormal;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 64;
|
||||
const int MAX_TEXTURES = 512;
|
||||
|
||||
layout(location = 0) in vec4 inPos;
|
||||
layout(location = 1) in vec3 inNormal;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 128;
|
||||
const int MAX_TEXTURES = 512;
|
||||
|
||||
layout(location = 0) in vec4 inPos;
|
||||
layout(location = 1) in vec3 inNormal;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 64;
|
||||
const int MAX_TEXTURES = 512;
|
||||
|
||||
layout(location = 0) in vec4 inPos;
|
||||
layout(location = 1) in vec3 inNormal;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 128;
|
||||
const int MAX_TEXTURES = 512;
|
||||
|
||||
layout(location = 0) in vec4 inPos;
|
||||
layout(location = 1) in vec3 inNormal;
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -38,7 +38,7 @@ import static org.lwjgl.glfw.GLFW.*;
|
|||
public class GameCore implements GameLogic {
|
||||
|
||||
private static final float MOUSE_SENSITIVITY = 0.1f;
|
||||
private static final float MOVEMENT_SPEED = 0.025f;
|
||||
private static final float MOVEMENT_SPEED = 0.525f;
|
||||
|
||||
private static final String SOUND_BUFFER_MUSIC = "music-sound-buffer";
|
||||
private static final String SOUND_BUFFER_PLAYER = "player-sound-buffer";
|
||||
|
|
@ -80,15 +80,16 @@ public class GameCore implements GameLogic {
|
|||
List<ModelData> models = new ArrayList<>();
|
||||
MusicParticle = ModelLoader.LoadModel("resources/models/MusicParticle/MusicParticle.json");
|
||||
List<MaterialData> MusicParticleMat = ModelLoader.LoadMaterials("resources/models/MusicParticle/MusicParticle_mat.json");
|
||||
ModelData SponzaData = ModelLoader.LoadModel("resources/models/Forest/forest.json");
|
||||
List<MaterialData> SponzaMaterial = ModelLoader.LoadMaterials("resources/models/Forest/forest_mat.json");
|
||||
// ModelData SponzaData = ModelLoader.LoadModel("resources/models/room/living_room.json");
|
||||
// List<MaterialData> SponzaMaterial = ModelLoader.LoadMaterials("resources/models/room/living_room_mat.json");
|
||||
radio = ModelLoader.LoadModel("resources/models/radio/radio.json");
|
||||
List<MaterialData> SponzaMaterial1 = ModelLoader.LoadMaterials("resources/models/radio/radio_mat.json");
|
||||
//ModelData SponzaData = ModelLoader.LoadModel("resources/models/Cafe/exterior.json");
|
||||
//List<MaterialData> SponzaMaterial = ModelLoader.LoadMaterials("resources/models/Cafe/exterior_mat.json");
|
||||
//ModelData SponzaData1 = ModelLoader.LoadModel("resources/models/Cafe/interior.json");
|
||||
//List<MaterialData> SponzaMaterial1= ModelLoader.LoadMaterials("resources/models/Cafe/interior_mat.json");
|
||||
List<MaterialData> SponzaMaterial2 = ModelLoader.LoadMaterials("resources/models/radio/radio_mat.json");
|
||||
ModelData SponzaData = ModelLoader.LoadModel("resources/models/Cafe/exterior.json");
|
||||
List<MaterialData> SponzaMaterial = ModelLoader.LoadMaterials("resources/models/Cafe/exterior_mat.json");
|
||||
ModelData SponzaData1 = ModelLoader.LoadModel("resources/models/Cafe/interior.json");
|
||||
List<MaterialData> SponzaMaterial1= ModelLoader.LoadMaterials("resources/models/Cafe/interior_mat.json");
|
||||
scene.AddActor(new Actor("Sponza1", SponzaData.ID(), new Vector3f(0,0f,-5f)));
|
||||
scene.AddActor(new Actor("Sponza2", SponzaData1.ID(), new Vector3f(0,0f,-5f)));
|
||||
|
||||
CubeActors.forEach(scene::AddActor);
|
||||
|
||||
|
|
@ -96,6 +97,8 @@ public class GameCore implements GameLogic {
|
|||
materials.addAll(SponzaMaterial);
|
||||
materials.addAll(MusicParticleMat);
|
||||
materials.addAll(SponzaMaterial1);
|
||||
materials.addAll(SponzaMaterial2);
|
||||
models.add(SponzaData1);
|
||||
models.add(SponzaData);
|
||||
models.add(MusicParticle);
|
||||
models.add(radio);
|
||||
|
|
@ -107,24 +110,59 @@ public class GameCore implements GameLogic {
|
|||
scene.AddCameraFrame("Fifth", new CameraFrame(new Vector3f(64.92f,158.06f,-35.25f),new Vector3f(-11.20f,156.5f,0.0f),scene.GetCamera().GetFOV(),"Sixth"));
|
||||
scene.AddCameraFrame("Sixth", new CameraFrame(new Vector3f(94.52f,172.54f,47.57f),new Vector3f(4.3f,329.27f,0.0f),scene.GetCamera().GetFOV(),"NO_FRAME"));
|
||||
camera.SetPosition(40.0f, 155.0f, -42.0f);
|
||||
//camera.SetPosition(0,0,0);
|
||||
camera.SetPosition(0,0,0);
|
||||
camera.SetRotation((float) Math.toRadians(10.0f), (float) Math.toRadians(-90.0f),0);
|
||||
//camera.SetRotation(0,0,0);
|
||||
camera.SetRotation(0,0,0);
|
||||
|
||||
guiTexture = new GuiTexture("resources/EngineResources/Texture/DefaultTexture.png");
|
||||
Logger.debug("GUI TEXTURE CREATED, ID->[{}], PATH->[{}]",guiTexture.ID(),guiTexture.TexturePath());
|
||||
List<GuiTexture> guiTextures = new ArrayList<>();
|
||||
guiTextures.add(guiTexture);
|
||||
|
||||
scene.GetLightingManager().GetAmbientLightColour().set(0.9f, 0.9f, 1.0f);
|
||||
scene.GetLightingManager().SetAmbientLightIntensity(0.1f);
|
||||
scene.GetLightingManager().GetAmbientLightColour().set(0.5f, 0.5f, 0.5f);
|
||||
scene.GetLightingManager().SetAmbientLightIntensity(0.01f);
|
||||
|
||||
SkyLight = new Light(new Vector3f(0.4f, 0.7f, 1.5f),new Vector3f(0.0f, -1.0f, 0.0f), true, 1.0f);
|
||||
SkyLight = new Light(new Vector3f(0.25f, 1.0f, 1.5f),new Vector3f(0.0f, -1.0f, 0.0f), true, 0.70f);
|
||||
|
||||
|
||||
List<ILight> lights = new ArrayList<>();
|
||||
lights.add(new Light(new Vector3f(3.0f,2.75f,0.0f),new Vector3f(35.0f, 150.0f, -42.0f),false,100.0f));
|
||||
lights.add(new Light(new Vector3f(0.0f,3.0f,0.0f),new Vector3f(40.0f, 155.0f, -35.0f),false,20.0f));
|
||||
//lights.add(new Light(new Vector3f(2.9f,2.75f,1.5f),new Vector3f(0.35f,2.69f,-2.11f),false,3.0f));
|
||||
//lights.add(new Light(new Vector3f(3.0f,2.5f,0.75f),new Vector3f(2.65f,1.57f,-3.31f),false,0.5f));
|
||||
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(-433, 445f, -424f),false,300000.0f+ (float)(Math.random() * 10000.0)));
|
||||
lights.add(new Light(new Vector3f(1.9f+ (float)Math.random(),1.5f,1.0f),new Vector3f(-210, 445f, 460f),false,70000.0f + (float)(Math.random() * 15000.0f)));
|
||||
lights.add(new Light(new Vector3f(1.9f+ (float)Math.random(),1.5f,1.0f),new Vector3f(-966, 445f, 204f),false,70000.0f + (float)(Math.random() * 15000.0f)));
|
||||
lights.add(new Light(new Vector3f(1.9f+ (float)Math.random(),1.5f,1.0f),new Vector3f(-176, 445f, 1000f),false,70000.0f + (float)(Math.random() * 15000.0f)));
|
||||
lights.add(new Light(new Vector3f(1.9f+ (float)Math.random(),1.5f,1.0f),new Vector3f(777, 445f, 858),false,70000.0f + (float)(Math.random() * 15000.0f)));
|
||||
lights.add(new Light(new Vector3f(1.9f+ (float)Math.random(),1.5f,1.0f),new Vector3f(376, 445f, -2136),false,70000.0f + (float)(Math.random() * 15000.0f)));
|
||||
lights.add(new Light(new Vector3f(1.9f+ (float)Math.random(),1.5f,2.0f),new Vector3f(2163, 445f, 1880),false,70000.0f + (float)(Math.random() * 15000.0f)));
|
||||
lights.add(new Light(new Vector3f(1.9f+ (float)Math.random(),1.5f,1.0f),new Vector3f(3334, 445f, 2405),false,70000.0f + (float)(Math.random() * 15000.0f)));
|
||||
lights.add(new Light(new Vector3f(1.9f+ (float)Math.random(),1.5f,1.0f),new Vector3f(3509, 445f, 1825),false,70000.0f + (float)(Math.random() * 15000.0f)));
|
||||
lights.add(new Light(new Vector3f(1.9f+ (float)Math.random(),1.5f,1.0f),new Vector3f(3877, 445f, 3378),false,70000.0f + (float)(Math.random() * 15000.0f)));
|
||||
lights.add(new Light(new Vector3f(1.9f+ (float)Math.random(),1.5f,1.0f),new Vector3f(4925, 445f, 3430),false,70000.0f + (float)(Math.random() * 15000.0f)));
|
||||
lights.add(new Light(new Vector3f(1.9f+ (float)Math.random(),1.5f,1.0f),new Vector3f(-2083, 445f, -1826),false,70000.0f + (float)(Math.random() * 15000.0f)));
|
||||
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(2076, 410, 1272),false,10000.0f));
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(2446, 465, 2303),false,10000.0f));
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(-842, 410, -1141),false,10000.0f));
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(-207, 410, -1830),false,10000.0f));
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(899, 460, -2015),false,10000.0f));
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(1775, 460, -3448),false,10000.0f));
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(1800, 460, -4154),false,10000.0f));
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(-1727, 410, -387),false,10000.0f));
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(-1198, 410, -964),false,10000.0f));
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(-1778, 410, -1502),false,10000.0f));
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(-2692, 333, -2109),false,10000.0f));
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(-2849, 333, -1724),false,10000.0f));
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(-2019, 410, -729),false,10000.0f));
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(-1727, 410, -389),false,10000.0f));
|
||||
lights.add(new Light(new Vector3f(1.9f + (float)Math.random(),1.5f,1.0f),new Vector3f(-1337, 410, 122),false,10000.0f));
|
||||
|
||||
|
||||
lights.add(new Light(new Vector3f(0.75f,2.0f,0.75f),new Vector3f(1086, 425, -3375),false,50000.0f));
|
||||
|
||||
//lights.add(new Light(new Vector3f(3.0f,2.75f,0.0f),new Vector3f(35.0f, 150.0f, -42.0f),false,100.0f));
|
||||
//lights.add(new Light(new Vector3f(0.0f,3.0f,0.0f),new Vector3f(40.0f, 155.0f, -35.0f),false,20.0f));
|
||||
lights.add(SkyLight);
|
||||
|
||||
ILight[] lightArr = new ILight[lights.size()];
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class Scene implements IScene {
|
|||
public Map<String, GUIOverlay> GUIReg = new HashMap<>();
|
||||
|
||||
public Scene(Window window) {
|
||||
lightingManager = new SceneLightingManager(10,new Vector3f(1f,1f,1f), 0.5f);
|
||||
lightingManager = new SceneLightingManager(1000,new Vector3f(1f,1f,1f), 0.5f);
|
||||
Actors = new ArrayList<>();
|
||||
CameraFrames = new HashMap<>();
|
||||
var EngConfig = EngineConfig.getInstance();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package net.halbear.Terrain4J.EngineCore.Vulkan.GUI;
|
||||
|
||||
import imgui.ImDrawData;
|
||||
import imgui.ImGui;
|
||||
import imgui.ImGuiIO;
|
||||
import imgui.ImVec4;
|
||||
import imgui.*;
|
||||
import imgui.glfw.ImGuiImplGlfw;
|
||||
import imgui.type.ImInt;
|
||||
import net.halbear.Terrain4J.EngineCore.Input.KeyboardInput;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import java.util.UUID;
|
|||
import static org.lwjgl.vulkan.VK10.VK_FORMAT_R8G8B8A8_SRGB;
|
||||
|
||||
public class TextureCache {
|
||||
public static final int MAX_TEXTURES = 128;
|
||||
public static final int MAX_TEXTURES = 512;
|
||||
private final IndexedLinkedHashMap<String, Texture> TextureMap;
|
||||
private final List<String> ActualTextures;
|
||||
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ public class DeferredSceneRender implements SceneRenderer {//dynamic rendering
|
|||
private Pipeline VkPipeline;
|
||||
private Pipeline VkPipelineOpaque;
|
||||
private Pipeline VkPipelineTranslucent;
|
||||
private float R = 0.01f;
|
||||
private float G = 0.015f;
|
||||
private float B = 0.0175f;
|
||||
private float R = 0.00f;
|
||||
private float G = 0.05f;
|
||||
private float B = 0.15f;
|
||||
private Matrix4f ProjectionMatrix;
|
||||
private MultiRenderTargetAttachments MRTAttachments;
|
||||
|
||||
|
|
|
|||
|
|
@ -69,9 +69,9 @@ public class ForwardSceneRender implements SceneRenderer {//dynamic rendering
|
|||
private VkClearValue ClearValueColour;
|
||||
private VkRenderingAttachmentInfo.Buffer AttachmentInfoColour;
|
||||
private VkRenderingInfo RenderInfo;
|
||||
private float R = 0.5f;
|
||||
private float G = 0.75f;
|
||||
private float B = 1.0f;
|
||||
private float R = 0.005f;
|
||||
private float G = 0.0075f;
|
||||
private float B = 0.0175f;
|
||||
private boolean Rb = false;
|
||||
private boolean Gb = true;
|
||||
private boolean Bb = false;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ DualPassRendering=false
|
|||
#3=MSAAx4
|
||||
#4=MSAAx8
|
||||
anti_alias_mode=0
|
||||
Debug_Shaders = true
|
||||
Debug_Shaders = false
|
||||
ShaderRecompiling = true
|
||||
#Vulkan Debugging toggle
|
||||
vkValidated=true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue