Browse Source

Fix the emission and light radius

Panagiotis Christopoulos Charitos 6 năm trước cách đây
mục cha
commit
373be9b915

+ 4 - 4
samples/sponza/assets/scene.lua

@@ -172,7 +172,7 @@ node = scene:newPointLightNode("Point.003_Orientation")
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp:setDiffuseColor(Vec4.new(20.007532, 8.208058, 5.410148, 1))
 lcomp:setShadowEnabled(1)
-lcomp:setRadius(44.729782)
+lcomp:setRadius(3.000000)
 trf = Transform.new()
 trf:setOrigin(Vec4.new(-10.783357, 2.494228, -3.841534, 0))
 rot = Mat3x4.new()
@@ -185,7 +185,7 @@ node = scene:newPointLightNode("Point.002_Orientation")
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp:setDiffuseColor(Vec4.new(20.007532, 8.208058, 5.410148, 1))
 lcomp:setShadowEnabled(1)
-lcomp:setRadius(44.729782)
+lcomp:setRadius(3.000000)
 trf = Transform.new()
 trf:setOrigin(Vec4.new(-10.783357, 2.494228, 2.518101, 0))
 rot = Mat3x4.new()
@@ -198,7 +198,7 @@ node = scene:newPointLightNode("Point.001_Orientation")
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp:setDiffuseColor(Vec4.new(20.007532, 8.208058, 5.410148, 1))
 lcomp:setShadowEnabled(1)
-lcomp:setRadius(44.729782)
+lcomp:setRadius(3.000000)
 trf = Transform.new()
 trf:setOrigin(Vec4.new(8.546165, 2.494228, 2.518101, 0))
 rot = Mat3x4.new()
@@ -211,7 +211,7 @@ node = scene:newPointLightNode("Point_Orientation")
 lcomp = node:getSceneNodeBase():getLightComponent()
 lcomp:setDiffuseColor(Vec4.new(20.007532, 8.208058, 5.410148, 1))
 lcomp:setShadowEnabled(1)
-lcomp:setRadius(44.729782)
+lcomp:setRadius(3.000000)
 trf = Transform.new()
 trf:setOrigin(Vec4.new(8.546165, 2.494228, -3.830497, 0))
 rot = Mat3x4.new()

+ 4 - 4
samples/sponza/assets/sky.ankimtl

@@ -18,12 +18,12 @@
 		<input shaderInput="globalSampler" builtin="GLOBAL_SAMPLER"/>
 		
 
-		<input shaderInput="diffColor" value="1.000000 1.000000 1.000000"/>
+		<input shaderInput="diffColor" value="0.352369 0.517735 0.800000"/>
 		<input shaderInput="specColor" value="0.040000 0.040000 0.040000"/>
-		<input shaderInput="roughness" value="1.000000" />
-		<input shaderInput="metallic" value="1.000000" />
+		<input shaderInput="roughness" value="0.500000" />
+		<input shaderInput="metallic" value="0.000000" />
 		
-		<input shaderInput="emission" value="0.000000 0.000000 0.000000"/>
+		<input shaderInput="emission" value="10.000000 10.000000 10.000000"/>
 		<input shaderInput="subsurface" value="0.000000"/>
 		
 	</inputs>

+ 4 - 2
tools/gltf_importer/Importer.cpp

@@ -968,11 +968,13 @@ Error Importer::writeLight(const cgltf_node& node, const HashMapAuto<CString, St
 
 	if(light.type == cgltf_light_type_point)
 	{
-		ANKI_CHECK(m_sceneFile.writeText("lcomp:setRadius(%f)\n", computeLightRadius(color)));
+		ANKI_CHECK(m_sceneFile.writeText(
+			"lcomp:setRadius(%f)\n", (light.range > 0.0f) ? light.range : computeLightRadius(color)));
 	}
 	else if(light.type == cgltf_light_type_spot)
 	{
-		ANKI_CHECK(m_sceneFile.writeText("lcomp:setDistance(%f)\n", computeLightRadius(color)));
+		ANKI_CHECK(m_sceneFile.writeText(
+			"lcomp:setDistance(%f)\n", (light.range > 0.0f) ? light.range : computeLightRadius(color)));
 		ANKI_CHECK(m_sceneFile.writeText("lcomp:setOuterAngle(%f)\n", light.spot_outer_cone_angle));
 		ANKI_CHECK(m_sceneFile.writeText("lcomp:setInnerAngle(%f)\n", light.spot_inner_cone_angle));
 	}