Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lights in imported .bsp are way too bright. #125

Open
whynotll83 opened this issue Feb 17, 2022 · 13 comments
Open

lights in imported .bsp are way too bright. #125

whynotll83 opened this issue Feb 17, 2022 · 13 comments

Comments

@whynotll83
Copy link

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.

@REDxEYE
Copy link
Owner

REDxEYE commented Feb 24, 2022

Hm, can you prepare few test maps for me with different light brightness?

@whynotll83
Copy link
Author

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.

@REDxEYE
Copy link
Owner

REDxEYE commented Mar 8, 2022

Ye, i can see that lights are abit too bright, I'll see what I can do

@REDxEYE
Copy link
Owner

REDxEYE commented Mar 8, 2022

Also, light values from BSP doesn not map 1 to 1 in blender
I need to do a lot of math to convert them

@TheMaskedMan00
Copy link

https://github.com/DeadZoneLuna/uSource? does a great job of properly importing the lights (in unity), maybe you guys could work something out?

@REDxEYE
Copy link
Owner

REDxEYE commented Jul 21, 2022

I've updated the lights a bit, should be better now

@danielah05
Copy link

the problem in the latest release is still really bad, lights on portal 1 maps are especially bad, distorting colors in really bad ways

@whynotll83
Copy link
Author

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.

@REDxEYE
Copy link
Owner

REDxEYE commented Jan 20, 2023

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.

@whynotll83
Copy link
Author

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.

@Architector4
Copy link

Architector4 commented Feb 6, 2023

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

@Architector4
Copy link

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

@REDxEYE
Copy link
Owner

REDxEYE commented Feb 6, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants