Sign in to follow this  
Pingpong

Underground Lighting

Recommended Posts

Since we are relooking at traveling in wurm I'd like to see underground lighting revamped, currently there's a strange mechanic that stops lamps from showing up underground even if you are standing next to them. I've heard that this is due to total "light sources" in local. Could there be a light source counter that will then tell you if the lamp will give off light when you plant it or light it? I realize that with the current change to off deed lighting this isn't near as big a deal but it would still be nice to have all the lamps that are lit give off light underground. Post ideas on what could be changed to make this work.

Pingpong

Share this post


Link to post
Share on other sites

It seems someone did a pretty shoddy job of programming the graphics engine.

Afaik there is a limit to how many light sources can be calculated at once. It is around 8 I think. I don't know what is actually limiting that number or if it can be increased.

Anyway the client needs to tell the graphics card which lights to use and it seems to choose pretty poorly.

Even if the choice gets improved there is still the limit, in either case you best bet is to use as little light as possible.

Share this post


Link to post
Share on other sites

I have two candelabra in my mine that are loaded with candles, one burns constantly no matter where I am, and the other refuses to burn unless I am within 2 tiles of it.

Share this post


Link to post
Share on other sites

Indeed I have similar problems with lighting in my mine. One cavern refuses to light regardless of where I place a lamp in it. I'm not sure how the codes chooses which lamps should be used for lighting, but it certainly seems that 'line of sight' is not a factor. Only the forge or a campfire results in illuminating that part of the mine.

Share this post


Link to post
Share on other sites

The problem is Java/OpenGL. OpenGL can't handle more than 8 light sources.

Outside mines it's not that big of a problem because of the sun as a global light source but inside mines you only have stationary ones.

The only idea I can think of to handle this problem would be some kind of a workaround.

For example to program one invisible global light source that is an average of the surrounding lights.

If we would like to have more lights correctly displayed then Wurm would have to be programmed completely new on a better engine.

And I doubt that's going to happen or is even possible without recruting an army of programmers :)

Share this post


Link to post
Share on other sites

Ok it's been a few years since my OpenGL lessons so I did some reading, I still couldn't write the code, but I understand the issue now:

OpenGL is not limited to 8 light sources per scene, it is limited to 8 light sources per draw, which is actually more than plenty. (a single frame can consist of thousands of draws)

The problem only arises when you try to draw everything at once.

So instead of calculating the entire visible landscape with the 8 best lights, you can draw each single tile with the two or three lights that are relevant for that tile.

That way you can not only draw hundreds of lights, you even increase performance by doing so.

There are other more complex ways to do it as well, like using buffers and multipass rendering.

And when you use proper shaders (like on the rare items) instead of the default lights it's a completely different matter all together.

So It's definitely possible, they just need to sit someone on the client that knows his way around OpenGL. It could be something as simple as swapping the order in which things are done around.

Share this post


Link to post
Share on other sites

So instead of calculating the entire visible landscape with the 8 best lights, you can draw each single tile with the two or three lights that are relevant for that tile.

That way you can not only draw hundreds of lights, you even increase performance by doing so.

We do this already. Caves are just screwy.

And when you use proper shaders (like on the rare items) instead of the default lights it's a completely different matter all together.

This is the next step, which will be gotten around to when I have enough time.

Basically caves are just bonkers, I've looked into the current lighting for them before, and just couldn't figure out their wonky-ness, so recoding lighting all together is the best option.

There is also the fact that in order to use shaders properly, we need to properly emulate all lighting on shaders (this is why the lighting on rare items are funky - there is only basic lighting on them currently).

TL;DR: Soon

  • Like 4

Share this post


Link to post
Share on other sites

We do this already. Caves are just screwy.

[Redacted]

TL;DR: Soonâ„¢

Thank you for the detail, I know I was always confused by this, and this helped clear it up. On a different note, love the use of the TL;DR Soonâ„¢, my co-workers now think I'm losing my mind since it made me laugh!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this