Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
wallabra

Automatic Lighting Generator?

Recommended Posts

I wonder if there is a automatic way of adding lighting based on the actors placed and the textures used, where interpolation and 2.5D/sector-based raytracing is used to automatically add lighting to a level.

I could code a GZDoom Builder plugin to do that... if only I knew how...

Share this post


Link to post
Gustavo6046 said:

I wonder if there is a automatic way of adding lighting based on the actors placed and the textures used, where interpolation and 2.5D/sector-based raytracing is used to automatically add lighting to a level.

No.

Gustavo6046 said:

I could code a GZDoom Builder plugin to do that... if only I knew how...

I think you couldn't even if you knew how.

Share this post


Link to post

^ I have doubts it would ever become practical to use beyond one-room-sized gimmicks, even if it became a lot more reliable and customizable, but it looks pretty awesome anyways!

Share this post


Link to post
Gustavo6046 said:

GZDoom Builder plugins are much different?

Not really different at all: I think you have the same chance to make and finish a GZDoom Builder plugin as you have chance to make and finish any other of your projects.

Share this post


Link to post

That is overwhelming for someone of my age.

Any other recommendable plugins that aren't already inbuilt in Gzdoom Builder (other than Statistics which I just downloaded)?

Share this post


Link to post

Just for the fun of it I improved the plugin a bit. The method the plugin used to determine which sector should have its brightness increased was pretty unreliable. It now uses the incenter of the triangles provided by sector triangulation for the line of sight checks. Seems to work fine.

With that change doing fake smooth lighting actually works:




(lamp just added to make it look better)

scifista42 said:

^ I have doubts it would ever become practical to use beyond one-room-sized gimmicks, even if it became a lot more reliable and customizable, but it looks pretty awesome anyways!

It's definitely nothing to do full lighting of a level, just to add accents.

Share this post


Link to post

I wish you had released it, Boris. I am tired of SPAMMING 1x1 sectors just for the sake of lighting and end up breaking every single single-sector shit!

Share this post


Link to post
boris said:

It's definitely nothing to do full lighting of a level, just to add accents.

Sounds like a challenge to me...

Share this post


Link to post
boris said:

Just for the fun of it I improved the plugin a bit. The method the plugin used to determine which sector should have its brightness increased was pretty unreliable. It now uses the incenter of the triangles provided by sector triangulation for the line of sight checks. Seems to work fine.

With that change doing fake smooth lighting actually works:

[pics not quoted for sanity's sake]

It's definitely nothing to do full lighting of a level, just to add accents.


I compiled this today* and it's neat. How did you make it do the gradient effect? I can see faking it from one direction with different-strength lights at different distances, but I don't understand how you did it in the centre of those pillars unless there's a function I missed.

NOTES:

  • I don't mind posting the build I made if Boris is ok with it. I couldn't find a license on any of his repositories.
  • It only "sees" one-sided lines right now.
  • To use it you have to bind the "do lighting" action in GZDB's controls. I don't think the old video indicates that in any way.
*Compiling other people's unfamiliar .NET projects when you have the wrong versions of tools installed often involves a lot of swearing and twiddling settings. I don't guarantee I didn't break it somehow.

Share this post


Link to post
scifista42 said:

^ I have doubts it would ever become practical to use beyond one-room-sized gimmicks

Hmmhmmhmm... you're one to talk, friend!

Share this post


Link to post
Gustavo6046 said:

Any other recommendable plugins that aren't already inbuilt in Gzdoom Builder


We do not know which plugins you already have.
This is my plugin folder

Gustavo6046 said:

(other than Statistics which I just downloaded)?


Why you do not see the Statistics plugin in my folder:

http://forum.zdoom.org/viewtopic.php?f=3&t=32392&p=832028#p832028
and

    [r1949] by m-x-d   2014-05-08 12:34:24 
    	Removed Statistics plugin.
    	Statistics are now shown in info panel when nothing is highlighted.
    

Share this post


Link to post
Aliotroph? said:

I compiled this today* and it's neat. How did you make it do the gradient effect? I can see faking it from one direction with different-strength lights at different distances, but I don't understand how you did it in the centre of those pillars unless there's a function I missed.

I simply placed 4 same strength (16) lights in a square in the center of the room. Ideally that would be built into the light object, where it automatically generates the light from several points around the center of the object.


Aliotroph? said:

  • I don't mind posting the build I made if Boris is ok with it. I couldn't find a license on any of his repositories.

It's derived from DB2 source files, so it's GPLv2. Feel free to put up a compiled binary.

Aliotroph? said:

  • It only "sees" one-sided lines right now.

That's one reason why it's not ready for production: it doesn't care about hight differences at all.

Share this post


Link to post

The gradient technique makes sense now I think about it. Putting lights in a row does a decent job of simulating light coming from a wall too.

I zipped the binaries for those who want to play. Here's a Google Drive link.

Thanks for adding some fun to my day! This has some uses even if it never changes from its current state.

A couple things worth mentioning for people who play with it before Boris posts again (because it really is just a prototype:

  • Lights ignore vertices farther than 1024 units away. The number is hardcoded for now. Can make for some weird effects in large spaces.
  • The "light type" dropdown box has no function yet.
  • The light things themselves aren't subject to undo/redo right now.
  • You can undo the changes the lights make to the map.
  • Changing modes reverts the settings on the lights. (eg. You set a light's brightness to 32, light the map and look at it in 3D mode. When you right-click the light again it will be set to 16.)
  • You can select multiple lights to move them, but editing the brightness will only work on one of the selected lights.

Share this post


Link to post

On a sort of related note:

I wish GZDooM had a cone shaped spot light source. It would be a great for a lot of lighting effects, It would be great to attach one to the player to give him a DooM 3 style flashlight.

Share this post


Link to post
scifista42 said:

^ I have doubts it would ever become practical to use beyond one-room-sized gimmicks, even if it became a lot more reliable and customizable, but it looks pretty awesome anyways!


And that's coming from the guy who proposed a node format that'd pretty much fits the exact same issues... :P

(Sorry, I couldn't resist to bring this up.)

For the record, I'd give such a lighting plugin a 10x higher change of being successful.

I guess the only real problem with it is texturing precision. Even in ZDoom with UDMF format, texel length of a linedef is always a full integer, regardless of actual coordinates.

Share this post


Link to post

Omigosh! Thank you soooo much for it! I can finally lighten up stuff! :D

As for some suggestions, you could have the light things lighten up stuff instead of casting shadows. That would make it more realistic! And it could have a function that automatically places these in light textures and things.

Also, sorry for the dumb question, but one thing i didn't find out is... why when I place lightes it doesn't make effect?

Share this post


Link to post
Gustavo6046 said:

Also, sorry for the dumb question, but one thing i didn't find out is... why when I place lightes it doesn't make effect?

What lights and what effect? Dynamic lights? Decorative lamps? Not being displayed ingame? Not automatically casting shadows or whatever you want?

Graf Zahl said:

I guess the only real problem with it is texturing precision. Even in ZDoom with UDMF format, texel length of a linedef is always a full integer, regardless of actual coordinates.

Maybe the algorithm would (optionally or not) round the coordinates of intersection points with linedefs to points which are as close as possible to a full-integer offset from the linedef's left edge. In case of orthogonal walls, this would always be precise, and in case of non-orthogonal walls, it would still be rather precise thanks to UDMFs arbitrary precision of coordinates.

Share this post


Link to post

I have to say, the plugin could certainly have its uses! It produces quite an impressive effect. Lighting levels like this by hand becomes very time consuming. I've not yet put the plugin to use as I'm not at a computer with GZDB at the moment.

How possible is it to light a whole map with this plugin, are there any implications?

Also, could it be possible to add a toggle so you either 'cast light' or 'cast shadows'? I imagine this would have more use if it acted like a light source than a shadowcaster, but could see use in both (Shadowcaster for outdoors areas, lightcaster for dark interiors etc.)

Share this post


Link to post
Dragonfly said:

Also, could it be possible to add a toggle so you either 'cast light' or 'cast shadows'?

Even if there wasn't such an option, you would simply manually change the brightness of the generated sectors.

I'm more concerned about the plugin's ability to affect only certain sectors (for example those currently selected by the mapper) as opposed to all sectors within its visible reach to generate the light/shadow sectors in.

Share this post


Link to post

I remember that Strife: Veteran Edition had some sort of baked-lighting solution that didn't look too bad. I also remember that Graf soon after declared the method it used to be totally incompatible with GZDoom, which is a shame, if understandable. Sort of wondering if any other source port bothered backporting it to Doom, though, or what the drawbacks to the system were.

I do know it handled moving sectors sort of curiously - where it'd stretch or squish the lightmap vertically from its starting height as the floor or ceiling moved. Worked for the most part, but looked kinda silly at points (like taking a lift that starts way up high with a rather short height, then lowering it to a really low point, causing that short lightmap texture to get stretched allllll the way down).

Share this post


Link to post
Aliotroph? said:

I zipped the binaries for those who want to play.

Thank you for doing this.
Despite the limitations of being a WIP it is still pretty useful,

Share this post


Link to post

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
×