Skip to content

Commit

Permalink
Editor improvements (#51)
Browse files Browse the repository at this point in the history
* Support for ray casting against scene

* Added text component

* Added material edit panel

* Fixed a bunch of issues

* Many adjustments and bug fixes

* Forgot to save files

* Improved content browser

* New icons

* Some fixes

* Added "light" mode

* Make content browser fully functioning

* Light component panel can be used to change the shadow now

* Saved scene window settings

* Fix build issues

* Fix code smell
  • Loading branch information
tippesi committed Mar 24, 2024
1 parent 01adadd commit 1d5f9eb
Show file tree
Hide file tree
Showing 139 changed files with 3,389 additions and 1,393 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
!**/CMakeFiles
linux-build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
name: Build on Linux
# Run both builds in parallel and don't cancel if one fails
strategy:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
!**/CMakeFiles
linux-build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
name: Build on Linux
# Run both builds in parallel and don't cancel if one fails
strategy:
Expand Down
Binary file added data/editor/icons/arrowLeft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions data/editor/icons/arrowLeft.svg
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 data/editor/icons/arrowLeft_light.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 data/editor/icons/arrowRight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions data/editor/icons/arrowRight.svg
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 data/editor/icons/arrowRight_light.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 data/editor/icons/arrowUp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions data/editor/icons/arrowUp.svg
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 data/editor/icons/arrowUp_light.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 data/editor/icons/audio_light.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 data/editor/icons/camera_light.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 data/editor/icons/document_light.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 data/editor/icons/folder_light.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 data/editor/icons/font.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions data/editor/icons/font.svg
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 data/editor/icons/font_light.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 data/editor/icons/image_light.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 data/editor/icons/mesh_light.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 data/editor/icons/play_light.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 data/editor/icons/scene_light.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 data/editor/icons/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions data/editor/icons/settings.svg
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 data/editor/icons/settings_light.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 data/editor/icons/stop_light.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 data/editor/icons/terrain_light.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 data/scenes/sponza.aescene

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion data/shader/deferred/direct.csh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define SHADOWS
#define SHADOW_FILTER_7x7
#define SHADOW_CASCADE_BLENDING

Expand Down
8 changes: 3 additions & 5 deletions data/shader/postprocessing.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ layout(location=0) out vec2 positionVS;
void main() {

//const array of positions for the triangle
const vec3 positions[6] = vec3[6](
const vec3 positions[4] = vec3[4](
vec3(1.f,1.f, 0.0f),
vec3(-1.f,-1.f, 0.0f),
vec3(-1.f,1.f, 0.0f),
vec3(1.f,-1.f, 0.0f),
vec3(-1.f,-1.f, 0.0f),
vec3(1.f,1.f, 0.0f)
vec3(-1.f,1.f, 0.0f),
vec3(-1.f,-1.f, 0.0f)
);

positionVS = positions[gl_VertexIndex].xy;
Expand Down
6 changes: 1 addition & 5 deletions data/shader/ssgi/temporal.csh
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ void main() {
// In case of clipping we might also reject the sample. TODO: Investigate
currentValue.rgb = clamp(currentValue.rgb, currentNeighbourhoodMin.rgb, currentNeighbourhoodMax.rgb);
// Only clamp AO for now, since this leaves visible streaks
// historyValue.a = clamp(historyValue.a, historyNeighbourhoodMin.a, historyNeighbourhoodMax.a);
historyValue.a = clamp(historyValue.a, historyNeighbourhoodMin.a, historyNeighbourhoodMax.a);

float factor = 0.95;
factor = (uv.x < 0.0 || uv.y < 0.0 || uv.x > 1.0
Expand All @@ -295,10 +295,6 @@ void main() {

vec4 resolve = mix(currentValue, historyValue, factor);

if (isnan(resolve.r) || isnan(resolve.b)) {
//resolve = vec4(1.0, 0.0, 0.0, 0.0);
}

imageStore(resolveImage, pixel, vec4(resolve));
imageStore(historyLengthImage, pixel, vec4(historyLength + 1.0, 0.0, 0.0, 0.0));

Expand Down
72 changes: 56 additions & 16 deletions data/shader/text.fsh
Original file line number Diff line number Diff line change
@@ -1,44 +1,84 @@
layout (location = 0) out vec4 colorFS;
#include <globals.hsh>

layout (location=0) out vec4 colorFS;

#ifdef TEXT_3D
layout (location=1) out vec2 velocityFS;
#endif

layout(location=0) in vec3 texCoordVS;
layout(location=1) in vec2 screenPositionVS;
#ifdef TEXT_3D
layout(location=2) in vec3 ndcCurrentVS;
layout(location=3) in vec3 ndcLastVS;
#endif

layout(set = 3, binding = 0) uniform sampler2DArray glyphsTexture;

layout(set = 3, binding = 3, std140) uniform UniformBuffer {
mat4 pMatrix;
#ifdef TEXT_3D
layout(push_constant) uniform constants {
vec4 position;
vec4 right;
vec4 down;
vec4 characterColor;
vec4 outlineColor;
vec2 renderHalfSize;
float textScale;
float outlineScale;
float edgeValue;
float smoothness;
} pushConstants;
#else
layout(push_constant) uniform constants {
vec4 clipArea;
vec4 blendArea;
vec4 textColor;
vec4 characterColor;
vec4 outlineColor;
vec2 textOffset;
vec2 renderArea;
float textScale;
float outlineScale;
float edgeValue;
float smoothness;
} uniforms;
} pushConstants;
#endif

void main() {

colorFS = vec4(0.0);

if (screenPositionVS.x < uniforms.clipArea.x ||
screenPositionVS.y < uniforms.clipArea.y ||
screenPositionVS.x > uniforms.clipArea.x + uniforms.clipArea.z ||
screenPositionVS.y > uniforms.clipArea.y + uniforms.clipArea.w)
#ifndef TEXT_3D
if (screenPositionVS.x < pushConstants.clipArea.x ||
screenPositionVS.y < pushConstants.clipArea.y ||
screenPositionVS.x > pushConstants.clipArea.x + pushConstants.clipArea.z ||
screenPositionVS.y > pushConstants.clipArea.y + pushConstants.clipArea.w)
discard;
#endif

float intensity = textureLod(glyphsTexture, texCoordVS, 0).r;
float smoothing = uniforms.smoothness * fwidth(intensity);
float smoothing = pushConstants.smoothness * fwidth(intensity);

float outlineFactor = smoothstep(uniforms.edgeValue - smoothing,
uniforms.edgeValue + smoothing, intensity);
colorFS = mix(uniforms.outlineColor, uniforms.textColor, outlineFactor);
float outlineFactor = smoothstep(pushConstants.edgeValue - smoothing,
pushConstants.edgeValue + smoothing, intensity);
colorFS = mix(pushConstants.outlineColor, pushConstants.characterColor, outlineFactor);

float mixDistance = mix(uniforms.edgeValue, 0.0, uniforms.outlineScale);
float mixDistance = mix(pushConstants.edgeValue, 0.0, pushConstants.outlineScale);
float alpha = smoothstep(mixDistance - smoothing, mixDistance + smoothing, intensity);

colorFS = uniforms.outlineScale > 0.0 ? vec4(colorFS.rgb, colorFS.a * alpha) :
vec4(uniforms.textColor.rgb, uniforms.textColor.a * alpha);
colorFS = pushConstants.outlineScale > 0.0 ? vec4(colorFS.rgb, colorFS.a * alpha) :
vec4(pushConstants.characterColor.rgb, pushConstants.characterColor.a * alpha);

#ifdef TEXT_3D
if (colorFS.a < 0.5)
discard;

vec2 ndcL = ndcLastVS.xy / ndcLastVS.z;
vec2 ndcC = ndcCurrentVS.xy / ndcCurrentVS.z;

ndcL -= globalData.jitterLast;
ndcC -= globalData.jitterCurrent;

velocityFS = (ndcL - ndcC) * 0.5;
#endif

}
65 changes: 58 additions & 7 deletions data/shader/text.vsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
layout(location=0) in vec2 vPosition;
#include <globals.hsh>

layout(location=0) out vec3 texCoordVS;
layout(location=1) out vec2 screenPositionVS;
#ifdef TEXT_3D
layout(location=2) out vec3 ndcCurrentVS;
layout(location=3) out vec3 ndcLastVS;
#endif

struct GlyphInfo {
vec2 scale;
Expand All @@ -16,31 +20,78 @@ layout (set = 3, binding = 2, std430) buffer InstancesBuffer {
vec4 instances[];
};

layout(set = 3, binding = 3, std140) uniform UniformBuffer {
mat4 pMatrix;
#ifdef TEXT_3D
layout(push_constant) uniform constants {
vec4 position;
vec4 right;
vec4 down;
vec4 characterColor;
vec4 outlineColor;
vec2 renderHalfSize;
float textScale;
float outlineScale;
float edgeValue;
float smoothness;
} pushConstants;
#else
layout(push_constant) uniform constants {
vec4 clipArea;
vec4 blendArea;
vec4 characterColor;
vec4 outlineColor;
vec2 textOffset;
vec2 renderArea;
float textScale;
float outlineScale;
float edgeValue;
float smoothness;
} uniforms;
} pushConstants;
#endif

void main() {

const vec3 positions[4] = vec3[4](
vec3(1.f,1.f, 0.0f),
vec3(1.f,-1.f, 0.0f),
vec3(-1.f,1.f, 0.0f),
vec3(-1.f,-1.f, 0.0f)
);

vec3 characterInfo = instances[gl_InstanceIndex].xyz;

uint glyphIndex = uint(characterInfo.z);

GlyphInfo glyph = glyphs[glyphIndex];

vec2 vPosition = positions[gl_VertexIndex].xy;

vec2 position = (vPosition + 1.0) / 2.0;
screenPositionVS = position * glyph.size * uniforms.textScale +
characterInfo.xy * uniforms.textScale + uniforms.textOffset;
gl_Position = uniforms.pMatrix * vec4(screenPositionVS, 0.0, 1.0);
#ifdef TEXT_3D
screenPositionVS = (position * glyph.size * pushConstants.textScale + characterInfo.xy);
#else
screenPositionVS = position * glyph.size * pushConstants.textScale +
characterInfo.xy * pushConstants.textScale + pushConstants.textOffset;
#endif

texCoordVS = vec3(position * glyph.scale, characterInfo.z);

#ifdef TEXT_3D
vec3 right = normalize(pushConstants.right.xyz);
vec3 down = normalize(pushConstants.down.xyz);

vec2 halfSize = pushConstants.renderHalfSize;
vec3 worldPosition = right * screenPositionVS.x + down * screenPositionVS.y;
worldPosition = worldPosition + pushConstants.position.xyz - right * halfSize.x - down * halfSize.y;

gl_Position = globalData.pMatrix * globalData.vMatrix * vec4(worldPosition, 1.0);

ndcCurrentVS = vec3(gl_Position.xy, gl_Position.w);
// For moving objects we need the last frames matrix
vec4 last = globalData.pvMatrixLast * vec4(worldPosition, 1.0);
ndcLastVS = vec3(last.xy, last.w);
#else
vec2 clipPosition = 2.0 * (screenPositionVS / pushConstants.renderArea) - 1.0;
gl_Position = vec4(clipPosition, 0.0, 1.0);
#endif

}
7 changes: 5 additions & 2 deletions data/shader/volumetric/volumetric.csh
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,16 @@ vec4 ComputeVolumetric(vec3 fragPos, float startDepth, vec2 texCoords) {

cascadeSpace.xy = cascadeSpace.xy * 0.5 + 0.5;

float shadowValue = 1.0;
#ifdef SHADOWS
#ifdef AE_TEXTURE_SHADOW_LOD
// This fixes issues that can occur at cascade borders
float shadowValue = textureLod(cascadeMaps,
shadowValue = textureLod(cascadeMaps,
vec4(cascadeSpace.xy, cascadeIndex, cascadeSpace.z), 0);
#else
float shadowValue = texture(cascadeMaps,
shadowValue = texture(cascadeMaps,
vec4(cascadeSpace.xy, cascadeIndex, cascadeSpace.z));
#endif
#endif

//shadowValue = distance > uniforms.light.shadow.distance ? 1.0 : shadowValue;
Expand Down
3 changes: 3 additions & 0 deletions libs/ImguiExtension/Panels.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
#include "panels/FogPanel.h"
#include "panels/PostProcessingPanel.h"
#include "panels/ReflectionPanel.h"
#include "panels/SSGIPanel.h"
#include "panels/SSSPanel.h"
#include "panels/VolumetricCloudsPanel.h"
#include "panels/IrradianceVolumePanel.h"
#include "panels/MaterialPanel.h"
#include "panels/MaterialsPanel.h"
#include "panels/GPUProfilerPanel.h"
18 changes: 18 additions & 0 deletions libs/ImguiExtension/UiElements.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "UiElements.h"

namespace Atlas::ImguiExtension {

void UIElements::TexturePreview(Ref<ImguiWrapper>& wrapper, const Texture::Texture2D& texture) {

auto lineHeight = ImGui::GetTextLineHeightWithSpacing();
auto set = wrapper->GetTextureDescriptorSet(texture);
ImGui::Image(set, ImVec2(lineHeight, lineHeight));

if (ImGui::IsItemHovered() && ImGui::BeginItemTooltip()) {
ImGui::Image(set, ImVec2(lineHeight * 8.0f, lineHeight * 8.0f));
ImGui::EndTooltip();
}

}

}
19 changes: 19 additions & 0 deletions libs/ImguiExtension/UiElements.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include <string>
#include <imgui.h>

#include "System.h"
#include "ImguiWrapper.h"
#include "texture/Texture2D.h"

namespace Atlas::ImguiExtension {

class UIElements {

public:
static void TexturePreview(Ref<ImguiWrapper>& wrapper, const Texture::Texture2D& texture);

};

}
Loading

0 comments on commit 1d5f9eb

Please sign in to comment.