SourceIO
SourceIO copied to clipboard
lights in imported .bsp are way too bright.
I made a test map with a light with 200 brightness, blender made it 5779.8 brightness, manually setting the light to 200watts fixed it but I can't manually change each light if there is more than 1 like the half life 2 maps. sun brightness is perfect tho.
Hm, can you prepare few test maps for me with different light brightness?
I made a simple map with rooms where the lights go from 25 brightness to 200, and a light with 1000 brightness. https://mega.nz/file/arZFHS4T#OAjc3czH61le9OrXquk4N2_t0_8vGFtBVqhEg9j219I the map imported made the 25 brightness light into 97.2122 brightness.
Ye, i can see that lights are abit too bright, I'll see what I can do
Also, light values from BSP doesn not map 1 to 1 in blender I need to do a lot of math to convert them
https://github.com/DeadZoneLuna/uSource? does a great job of properly importing the lights (in unity), maybe you guys could work something out?
I've updated the lights a bit, should be better now
the problem in the latest release is still really bad, lights on portal 1 maps are especially bad, distorting colors in really bad ways
the lights are still broken when I use the default world scale. it only looks correct when I change it to 1. I wonder why it would be difficult to tell the addon when a hl2 light has a brightness of 200 it should change the blender light to 200.
There is more than 1 way to set the brightness in source light, there is no just brightness 200, it can be vec4(RGB, Brighntess), it can be premultiplied (RGB*Brighntess), also, source uses an unknown light value, it's not watts, nor candela, nor flux.
well, to me setting the blender watts number to the one last number after the "rgb" values look the exact same to me in game and blender.
Having the same issue, I have a guess on what's going on here.
When importing a BSP, the addon has a default world scale setting of 0.01905
set. However, I guess, the light power is set based on how it should look with a world scale of 1.
This same issue exists in Blender in general: if you make a scene with a point light, and then scale it down, the light will be too bright, and its value would need to be adjusted in proportion with the scale for the scaled down scene to look the same.
And, indeed, multiplying the light power by 0.01905 makes it look pretty much exactly how it looks in the original map.
I guess this is a bug to adjust in the import process: use the world scale to also scale the power of the lights, except the sun lights lol
Also, for reference, while this isn't fixed, you can just open Blender's text editor, make new script, slam this in, and click "Run script" (little play arrow) to fix all your lights from this
import bpy
lights = bpy.data.lights
for l in lights:
if l.type == 'POINT':
l.energy = l.energy * 0.01905
Map scale is used in light energy calculation, but it does not always work. I'm working on better function to convert power in refactor
branch