Forráskód Böngészése

Add a sky in sponza. Fix a bug in indirect where it doesn't take into account emission

Panagiotis Christopoulos Charitos 7 éve
szülő
commit
5581d6e27b

+ 9 - 0
samples/sponza/assets/scene.lua

@@ -2489,6 +2489,15 @@ trf:setRotation(rot)
 trf:setScale(0.0170465)
 node:getSceneNodeBase():getMoveComponent():setLocalTransform(trf)
 
+node = scene:newModelNode("skysky-materialnone261", "assets/skysky-material.ankimdl")
+trf = Transform.new()
+trf:setOrigin(Vec4.new(0, 10.4512, 0, 0))
+rot = Mat3x4.new()
+rot:setAll(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0)
+trf:setRotation(rot)
+trf:setScale(42.4383)
+node:getSceneNodeBase():getMoveComponent():setLocalTransform(trf)
+
 node = scene:newDirectionalLightNode("Lamp")
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp:setDiffuseColor(Vec4.new(15, 15, 15, 1))

+ 1 - 1
shaders/Pack.glsl

@@ -122,7 +122,7 @@ Vec2 unpackUnorm1ToUnorm2(F32 c)
 #endif
 }
 
-const F32 MAX_EMISSION = 20.0; // Max emission. Keep as low as possible
+const F32 MAX_EMISSION = 30.0; // Max emission. Keep as low as possible
 const F32 MIN_ROUGHNESS = 0.05;
 
 // G-Buffer structure

+ 2 - 1
shaders/TraditionalDeferredShading.glslp

@@ -139,7 +139,8 @@ void main()
 	const F32 factor = shadowFactor * max(gbuffer.m_subsurface, lambert);
 #endif
 
-	out_color = (specC + diffC) * u_unis.m_diffuseColor * factor;
+	out_color = gbuffer.m_diffuse * gbuffer.m_emission;
+	out_color += (specC + diffC) * u_unis.m_diffuseColor * factor;
 }
 
 #pragma anki end