Skip to content

Commit 7b06121

Browse files
author
Ravbug
committed
Update for irradiance maps
1 parent 147c936 commit 7b06121

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

RavEngine

Samples/Rendering/main.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ struct Level : public RavEngine::World {
205205
Ref<StarMatMaterialInstance> starMaterialInstance;
206206
ComponentHandle<ParticleEmitter> smokeParticle;
207207

208-
Level() {
208+
Level() {
209209

210210
constexpr static float floorSize = 20;
211211
auto floor = Instantiate<GameObject>();
@@ -321,12 +321,19 @@ struct Level : public RavEngine::World {
321321
auto& ambientLight = lightsEntity.EmplaceComponent<AmbientLight>();
322322
ambientLight.SetIntensity(0.2);
323323
ambientLight.SetIlluminationLayers(~bakedLayer);
324-
auto cubemap = RavEngine::New<CubemapTexture>(512, CubemapTexture::Config{
325-
.enableRenderTarget = true,
326-
.format = RGL::TextureFormat::RGBA16_Sfloat,
324+
auto envCubemap = RavEngine::New<CubemapTexture>(512, CubemapTexture::Config{
327325
.debugName = "Environment map",
326+
.format = RGL::TextureFormat::RGBA16_Sfloat,
327+
.numMips = 4,
328+
.enableRenderTarget = true,
328329
});
329-
ambientLight.environment.emplace(skybox, cubemap);
330+
auto irradianceCubemap = RavEngine::New<CubemapTexture>(512, CubemapTexture::Config{
331+
.debugName = "Environment map",
332+
.format = RGL::TextureFormat::RGBA16_Sfloat,
333+
.numMips = 1,
334+
.enableRenderTarget = true,
335+
});
336+
ambientLight.environment.emplace(skybox, envCubemap, irradianceCubemap);
330337

331338

332339
lightsEntity.GetTransform().LocalRotateDelta(vector3{ deg_to_rad(45), deg_to_rad(45),0 });

0 commit comments

Comments
 (0)