Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
0a0c92d
Add static mesh loading
MrChampz Sep 8, 2026
291e058
Add static mesh rendering
MrChampz Sep 9, 2026
65c38f3
Simplify static mesh loading results
MrChampz Sep 9, 2026
ddf4bfc
Pool static mesh geometry
MrChampz Sep 17, 2026
dd666bb
Render static meshes with surface materials
MrChampz Sep 19, 2026
6dd7b86
Remove unused geometry allocation include
MrChampz Sep 19, 2026
bac31cd
Import glTF PBR material maps
MrChampz Sep 22, 2026
63c904c
Simplify FlattenNormal documentation
MrChampz Sep 22, 2026
16becc4
Light static meshes with environments
MrChampz Sep 22, 2026
abaea89
Support material transparency modes
MrChampz Sep 22, 2026
967ee38
Import glTF transparency modes
MrChampz Sep 22, 2026
8c52a93
Add material shading models
MrChampz Sep 23, 2026
441be03
Import glTF clear coat materials
MrChampz Sep 23, 2026
3cfc408
Import glTF specular materials
MrChampz Sep 23, 2026
4eccd7b
Preserve assertions in disabled builds
MrChampz Sep 23, 2026
75b734e
Light clear coat with directional lights
MrChampz Sep 23, 2026
5cc75e4
Support secondary mesh texture coordinates
MrChampz Sep 23, 2026
92ced7b
Support double-sided materials
MrChampz Sep 23, 2026
38a82cb
Import glTF texture transforms
MrChampz Sep 23, 2026
376b4e5
Improve surface PBR specular lighting
MrChampz Sep 23, 2026
3c88180
Blend prefiltered environment levels
MrChampz Sep 23, 2026
26f3213
Reduce specular aliasing
MrChampz Sep 23, 2026
0e3f77f
Fix mesh material rendering
MrChampz Sep 24, 2026
77ca2a0
Add texture mipmap generation
MrChampz Sep 24, 2026
5734d07
Remove redundant mipmap comment tag
MrChampz Sep 24, 2026
0d8e950
Centralize texture mip level calculation
MrChampz Sep 24, 2026
93fdbd6
Refactor image and texture resources
MrChampz Sep 27, 2026
3d887d7
Apply glTF node transforms to static meshes
MrChampz Sep 27, 2026
1dfed2f
Refactor glTF loading and frame material tables
MrChampz Sep 27, 2026
213215e
Add HDR bloom post processing
MrChampz Sep 27, 2026
36b6ed8
Bind material renderer to scene target
MrChampz Sep 27, 2026
a2a09a7
Refine rendering setup
MrChampz Sep 27, 2026
a07791a
Serialize image resize operations on render thread
MrChampz Sep 29, 2026
d99d6cc
Defer resized image destruction by frame lifetime
MrChampz Sep 29, 2026
e747aca
Fix post-process target synchronization
MrChampz Sep 30, 2026
81fa4b8
Fix graphics resource lifetime issues
MrChampz Sep 30, 2026
434bcf8
Fix glTF material and geometry import
MrChampz Sep 30, 2026
2c9c5ce
Release Dissolve resources before context teardown
MrChampz Sep 30, 2026
f0af417
Fix particle material blending
MrChampz Sep 30, 2026
ef94247
Fix Windows material renderer build
MrChampz Sep 30, 2026
4f79eb3
Add variant to precompiled header
MrChampz Sep 30, 2026
8d20e25
Fix Windows texture build
MrChampz Sep 30, 2026
a376916
Fix Windows glTF loader build
MrChampz Sep 30, 2026
6d66eb1
Fix Windows image test build
MrChampz Sep 30, 2026
74e7899
Fix Windows Dissolve and Vulkan test build
MrChampz Sep 30, 2026
bd1fcf6
Keep submitted frames alive after failed present
MrChampz Sep 30, 2026
459ad61
Refresh descriptors after image layout changes
MrChampz Sep 30, 2026
c7cde34
Keep deferred geometry frees alive
MrChampz Oct 1, 2026
07db484
Simplify framebuffer resize handling
MrChampz Oct 1, 2026
ba5ba6b
Use materials for particle appearance
MrChampz Oct 1, 2026
b9640cd
Retry particle allocation after replacement failure
MrChampz Oct 1, 2026
de60a4d
Support Fresnel in particle materials
MrChampz Oct 1, 2026
8329c6b
Unify particle material usage
MrChampz Oct 1, 2026
2e2024d
Tidy Vulkan presentation handling
MrChampz Oct 1, 2026
dcb510c
fix(material): reject cyclic material graphs
MrChampz Oct 1, 2026
8c51232
test(material): cover unconnected unary nodes
MrChampz Oct 1, 2026
adc3b62
fix(material): light particle mesh normals
MrChampz Oct 1, 2026
affe755
fix(material): retire unused texture bindings
MrChampz Oct 1, 2026
de12cf2
Add particle color material support
MrChampz Oct 1, 2026
2c90626
fix(aether): refresh authored effect materials
MrChampz Oct 1, 2026
bd6c7d7
fix(aether): track resolver material ownership
MrChampz Oct 1, 2026
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
2 changes: 1 addition & 1 deletion Assets/VFX/RibbonGarden.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{
"name": "PathRibbon",
"renderMode": "Ribbon",
"material": { "color": "$canopy_color_start", "emissive": [0.10, 0.25, 0.50, 0.0] },
"material": { "color": "$canopy_color_start", "emissive": [10.0, 25.0, 50.0, 0.0] },
"maxParticles": 256,
"spawnRate": "$spawn_rate",
"parameters": {
Expand Down
2 changes: 1 addition & 1 deletion Assets/VFX/RibbonVortex.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{
"name": "PathRibbon",
"renderMode": "Ribbon",
"material": { "color": "$canopy_color_start", "emissive": [0.10, 0.25, 0.50, 0.0] },
"material": { "color": "$canopy_color_start", "emissive": [10.0, 25.0, 50.0, 0.0] },
"maxParticles": 256,
"spawnRate": "$spawn_rate",
"parameters": {
Expand Down
4 changes: 3 additions & 1 deletion Dissolve/Dissolve.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ file(GLOB_RECURSE SOURCES
"${CMAKE_CURRENT_LIST_DIR}/Source/*.h"
"${CMAKE_CURRENT_LIST_DIR}/Source/*.cpp"
)
list(APPEND SOURCES "${CMAKE_SOURCE_DIR}/Elixir/Vendor/stb/stb_image.cpp")
add_executable(${PROJECT_NAME} ${SOURCES})

# Set output name
Expand Down Expand Up @@ -58,6 +59,7 @@ endif()

target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/Elixir/Source
${CMAKE_SOURCE_DIR}/Elixir/Vendor/stb
)

# Linking
Expand All @@ -66,4 +68,4 @@ add_dependencies(${PROJECT_NAME}
Elixir
)

link_target_to_engine(${PROJECT_NAME})
link_target_to_engine(${PROJECT_NAME})
173 changes: 62 additions & 111 deletions Dissolve/Source/Dissolve.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "Dissolve.h"

#include "Engine/Materials/Nodes/Color.h"
#include "Engine/Materials/Nodes/Parameter.h"

#include <Engine/Core/Entrypoint.h>
#include <Engine/Graphics/SamplerBuilder.h>
#include <Engine/Aether/Manager.h>

#include <Engine/Materials/MaterialGraph.h>
Expand All @@ -16,20 +16,21 @@

using namespace Elixir::Materials::Nodes;

Ref<GraphicsPipeline> pipeline;
std::array<Ref<Aether::System>, 2> m_ParticleSystems;
std::array<Ref<Aether::SystemInstance>, 2> m_ParticleSystemInstances;

Ref<Material> graphMaterial;

Ref<StaticMesh> mesh;
SStaticMeshLighting s_LightingSetup;
Comment thread
MrChampz marked this conversation as resolved.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

Dissolve::Dissolve()
{
EE_PROFILE_ZONE_SCOPED()

m_Window->SetTitle("Dissolve");
m_DrawExtent = m_Window->GetFramebufferExtent();

const auto aspectRatio = (float)m_DrawExtent.Width / (float)m_DrawExtent.Height;
const auto drawExtent = m_Window->GetFramebufferExtent();
const auto aspectRatio = (float)drawExtent.Width / (float)drawExtent.Height;
// m_CameraController = CreateScope<SplineCameraController>(aspectRatio);
// m_CameraController->AddKeyframe({ { 0.0f, 0.5f, 5.0f }, { 0.0f, 0.0f, 0.0f }, 60.0f });
// m_CameraController->AddKeyframe({ { 1.0f, 0.3f, 2.5f }, { 0.0f, 0.0f, 0.0f }, 50.0f });
Expand All @@ -38,34 +39,36 @@ Dissolve::Dissolve()
// m_CameraController->SetLooping(true);
// m_CameraController->Play();
m_CameraController = CreateScope<ArcBallCameraController>(60.0f, aspectRatio);
m_FrameData.ViewProj = m_CameraController->GetCamera().GetViewProjectionMatrix();

const auto sampler = SamplerBuilder()
.Build(m_GraphicsContext.get());

const auto tex = TextureLoader::Load("./Assets/Bricks.png");

const auto shader = m_ShaderLoader->LoadShader("./Shaders/", "FixedTriangle");
shader->BindTexture("texture", tex);
shader->BindSampler("sampl", sampler);

PipelineBuilder builder;
builder.SetShader(shader);
builder.SetInputTopology(EPrimitiveTopology::TriangleList);
builder.SetPolygonMode(EPolygonMode::Fill);
builder.DisableBlending();
builder.DisableDepthTest();
builder.SetColorAttachmentFormat(EImageFormat::R8G8B8A8_SRGB);
builder.SetBufferLayout({});
pipeline = builder.Build(m_GraphicsContext.get());

m_FrameConstantBuffer = UniformBuffer::Create(
m_Environment = Environment::Load(
*m_GraphicsContext,
"./Assets/Textures/white_home_studio_2k.hdr"
);
EE_CORE_ASSERT(m_Environment, "Could not load the Environment.")

m_StaticMeshRenderer = CreateScope<StaticMeshRenderer>(
m_GraphicsContext.get(),
sizeof(SFrameData),
&m_FrameData
GetMaterialSystem(),
StaticMeshLoaderRegistry::GetGeometryPool()
);

shader->BindConstantBuffer("cbFrame", m_FrameConstantBuffer);
s_LightingSetup = {
.Environment = {
.Environment = m_Environment->GetEnvironment(),
.Irradiance = m_Environment->GetIrradiance(),
.Prefiltered = m_Environment->GetPrefiltered(),
.Sampler = m_Environment->GetSampler(),
.Intensity = 1.5f,
.MaxLod = Environment::GetMaxLod(),
},
.DirectionalLightDirection = glm::normalize(
glm::vec3{ -0.5f, 0.65f, -0.55f }
),
.DirectionalLightColor = { 1.0f, 0.96f, 0.9f },
.DirectionalLightIntensity = 2.2f,
.DebugView = ESurfaceDebugView::Composite,
};

m_ParticleSystems[0] = GetAetherManager().LoadEffect("./Assets/VFX/FireAndFireworks.json");
EE_CORE_ASSERT(
Expand All @@ -82,10 +85,10 @@ Dissolve::Dissolve()
{
MaterialGraph graph;

graphMaterial = CreateRef<Material>("DissolveGraph");
graphMaterial = CreateRef<Material>("DissolveGraph", EMaterialUsage::Particle);
EE_CORE_ASSERT(
graphMaterial->SetUsage(EMaterialUsage::ParticleSprite, true),
"Dissolve graph material must enable ParticleSprite usage."
graphMaterial->SetBlendMode(EMaterialBlendMode::Translucent),
"Dissolve graph material must enable translucent blending."
)

EE_CORE_ASSERT(graphMaterial->DefineParameter("Tint", {
Expand Down Expand Up @@ -126,76 +129,49 @@ Dissolve::Dissolve()
{
EE_CORE_ERROR("Dissolve particle emitter 'FlameCore' was not found.")
}

if (auto loaded = StaticMeshLoaderRegistry::Load("./Assets/Meshes/McLaren/scene.gltf"))
mesh = std::move(*loaded);
}

{
MaterialGraph graph1;

const auto ribbonMaterial = CreateRef<Material>("RibbonEnergy");
EE_CORE_ASSERT(
ribbonMaterial->SetUsage(EMaterialUsage::ParticleRibbon, true),
"Ribbon material must enable ParticleRibbon usage."
)
const auto ribbonMaterial = CreateRef<Material>("RibbonEnergy", EMaterialUsage::Particle);
EE_CORE_ASSERT(
ribbonMaterial->SetUsage(EMaterialUsage::ParticleMesh, true),
"Ribbon material must enable ParticleRibbon usage."
ribbonMaterial->SetBlendMode(EMaterialBlendMode::Translucent),
"Ribbon material must enable translucent blending."
)

EE_CORE_ASSERT(ribbonMaterial->DefineParameter("Tint", {
.Kind = EMaterialParameterKind::Value,
.ValueType = EMaterialValueType::Float4,
.DefaultValue = SMaterialParameter::MakeVector({ 0.2f, 0.5f, 1.0f, 1.0f }),
}), "")

EE_CORE_ASSERT(ribbonMaterial->DefineParameter("Glow", {
.Kind = EMaterialParameterKind::Value,
.ValueType = EMaterialValueType::Float4,
.DefaultValue = SMaterialParameter::MakeVector({ 0.05f, 0.2f, 1.0f, 1.0f }),
.DefaultValue = SMaterialParameter::MakeVector({ 1.0f, 1.0f, 1.0f, 1.0f }),
}), "")

EE_CORE_ASSERT(ribbonMaterial->DefineParameter("Albedo", {
.Kind = EMaterialParameterKind::Texture,
.DefaultValue = SMaterialParameter::MakeTexture(tex),
}), "")

const auto panner = graph1.AddNode<Panner>(glm::vec2{ 0.08f, -0.35f });

const auto albedo1 = graph1.AddNode<TextureSample>("Albedo");
graph1.Connect(panner, albedo1, 0);

const auto tint1 = graph1.AddNode<Parameter>(
const auto tint = graph1.AddNode<Parameter>(
"Tint",
EMaterialValueType::Float4
);

const auto color = graph1.AddNode<Nodes::Color>();

const auto multiply = graph1.AddNode<Multiply>();
graph1.Connect(albedo1, multiply, 0);
graph1.Connect(tint1, multiply, 1);
graph1.SetChannel(EMaterialChannel::BaseColor, albedo1);
graph1.Connect(tint, multiply, 0);
graph1.Connect(color, multiply, 1);
graph1.SetChannel(EMaterialChannel::BaseColor, multiply);

// const auto glow = graph1.AddNode<Parameter>("Glow", EMaterialValueType::Float4);
//graph1.SetChannel(EMaterialChannel::Emissive, glow);

ribbonMaterial->SetGraph(std::move(graph1));
EE_CORE_ASSERT(GetMaterialRegistry().Register(ribbonMaterial), "RibbonEnergy must be unique.")

const auto instance = ribbonMaterial->CreateInstance();
EE_CORE_ASSERT(
instance->SetVector("Tint", { 0.15f, 0.6f, 1.0f, 1.0f }),
"Ribbon tint override must match the schema."
)

if (auto* emitter = m_ParticleSystems[1]->FindEmitter("PathRibbon"))
{
emitter->SetMaterial(instance);
//emitter->SetMaterial(ribbonMaterial);
EE_CORE_INFO("Published graph material to the PathRibbon particle emitter.")
}

if (auto* emitter = m_ParticleSystems[1]->FindEmitter("CrystalShards"))
{
emitter->SetMaterial(instance);
EE_CORE_INFO("Published graph material to the CrystalShards particle emitter.")
}
}

m_ParticleSystemInstances[0] = m_ParticleSystems[0]->CreateInstance();
Expand All @@ -216,7 +192,12 @@ Dissolve::Dissolve()

Dissolve::~Dissolve()
{
pipeline.reset();
m_StaticMeshRenderer.reset();
mesh.reset();
s_LightingSetup = {};
graphMaterial.reset();
m_ParticleSystemInstances = {};
m_ParticleSystems = {};
}

void Dissolve::OnGUI(const Timestep frameTime)
Expand All @@ -237,19 +218,16 @@ void Dissolve::Render(const Timestep frameTime)
Application::Render(frameTime);

m_CameraController->Update(frameTime);
m_FrameData.ViewProj = m_CameraController->GetCamera().GetViewProjectionMatrix();
m_FrameConstantBuffer->UpdateData(&m_FrameData, sizeof(SFrameData));

auto& aether = GetAetherManager();
aether.BeginFrame(frameTime);

m_GraphicsContext->Clear();

//DrawGeometry();
m_StaticMeshRenderer->BeginFrame(m_CameraController->GetCamera(), s_LightingSetup);
DrawGeometry();
m_StaticMeshRenderer->EndFrame();

aether.Render(m_CameraController->GetCamera());
const auto& simulationMetrics = aether.GetLastSimulationMetrics();
const auto& renderMetrics = aether.GetLastRenderingMetrics();
aether.Render(m_CameraController->GetCamera(), m_SceneTarget);
}

void Dissolve::OnEvent(Event& event)
Expand All @@ -260,37 +238,10 @@ void Dissolve::OnEvent(Event& event)

void Dissolve::DrawGeometry()
{
const auto renderingInfo = SRenderingInfo
{
.ColorAttachment = m_GraphicsContext->GetRenderTarget(),
.RenderArea = m_DrawExtent
};

Viewport viewport = {};
viewport.X = 0;
viewport.Y = 0;
viewport.Width = m_DrawExtent.Width;
viewport.Height = m_DrawExtent.Height;
viewport.MinDepth = 0.0f;
viewport.MaxDepth = 1.0f;

Rect2D scissor = {};
scissor.Offset = { 0, 0 };
scissor.Extent = m_DrawExtent;

m_Executor.Enqueue([this, renderingInfo, viewport, scissor]()
{
const auto cmd = this->m_GraphicsContext->GetSecondaryCommandBuffer();
cmd->BeginRendering(renderingInfo);
cmd->SetViewports({ viewport });
cmd->SetScissors({ scissor });
pipeline->Bind(cmd);
cmd->Draw(3);
cmd->EndRendering();
this->m_GraphicsContext->EnqueueSecondaryCommandBuffer(cmd);
}, &m_WaitGroup);

m_WaitGroup.Wait();
if (m_StaticMeshRenderer)
{
m_StaticMeshRenderer->Render(mesh);
}
}

Application* Elixir::CreateApplication()
Expand Down
13 changes: 4 additions & 9 deletions Dissolve/Source/Dissolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

#include <Engine.h>

struct SFrameData
{
glm::mat4 ViewProj;
};
#include "Environment.h"

class Dissolve final : public Elixir::Application
{
Expand All @@ -22,11 +19,9 @@ class Dissolve final : public Elixir::Application
private:
void DrawGeometry();

WaitGroup m_WaitGroup;
Extent2D m_DrawExtent;
Scope<Environment> m_Environment;

SFrameData m_FrameData;
Ref<UniformBuffer> m_FrameConstantBuffer;
Scope<StaticMeshRenderer> m_StaticMeshRenderer;

Scope<ArcBallCameraController> m_CameraController;
};
};
Loading
Loading