Idea For Static dynamic Lighting In Maps

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
Steve5563
Posts: 82
Joined: Sun Jan 27, 2019 11:18 pm
Operating System Version (Optional): windows 10
Graphics Processor: nVidia with Vulkan support
Location: Australia

Idea For Static dynamic Lighting In Maps

Post by Steve5563 »

something i thought of a little while ago and i want to share it from a mappers perspective on how visuals can improve dramatically and also having good performance at the same time when making a new map with gzdoom builder.

with my experience in mapping the only thing that doesn't hurt the frame rate in doom is the textures. the resolution of the textures also doesn't matter once they have been loaded.
as we all know textures are just pre rendered images which can give us good visuals and still retain good fps ---- pre rendering as much as we can is key to get decent visuals and good fps.

a new way is needed when it comes to lighting custom maps in doom to improve visuals drastically when it comes to lighting and shadows which can really take doom to the next dimension,

so the current problem with dynamic lights and the gzdoom engine from my experience is that it absolutely hates dynamic lights ( real time rendering ) especially when using lots of them in a map just to create static lighting in the areas of a map which can lead the fps to tank very quickly if you get carried away with them.

pre baking the static dynamic lighting effects on the textures is what we need to create the next leap forward with lighting in doom maps.
the problem with pre baked lighting is this wont visually wont work when your eyes are expecting to see the player/monster sprites interacting with the baked lighting, it will look fake and unrealistic when a player moves throughout the baked lighting area.
especially when you have a dark map with lots of brightly baked lighting everywhere and the player/monster/decoration sprites wont look correct as they move through the area transitioning from bright baked lighting to pitch black areas. they will just appear at the sectors brightness level.

what i think is needed to get the best of both worlds is to bake dynamic lighting on the maps geometry / textures,
and to also to create a new type of dynamic light that only interacts with "actors " such as the player/monster/decoration sprites etc. and not with the maps textures/geometry.

so when we build a new level in gzdoom builder and we are at the stage where we are ready to start lighting the map up with the new static dynamic "baking" lights, which we can use for observing the lighting that we are placing in the map ( like we do now in gzdoom builder ) to get the colour/scale/brightness to our liking.
once we are happy with the lighting we can then use this new baking light to bake the lighting to the maps textures / geometry.
after the baking process is finish we can then select all of the baking lights that we placed in the map and change them over to this new type of dynamic light. " dynamic actor interacting light "
this new " dynamic actor interacting light" has 2 cool and very important features.

no.1---interacting area----this light does not render its light source on the maps textures/geometry as this is already taken care of during the baking process (pre rendered),
this new light only interacts with actors such as player sprites/monsters/decoration etc this is used only to adjust the color and brightness of the sprites and has its own interacting radius displayed in gzdoom builder,


no.2 --- trigger radius---- because this light only interacts with actors, you now have the option to also create a trigger radius which is a little bigger then the lights " interacting radius ".
this trigger radius is to activate the light just before a "actor" enters the interacting area which is the dynamic lights radius circle you see in gzdoom builder,
the trigger radius keeps the light activated when an actor is inside this radius and when the actor walks outside of the trigger radius area the light turns off and the pc does not have to calculate anything with this light anymore until it is triggered again.
( this trigger radius may not even be needed as the light only interacts with actors im just giving ideas if it is needed)

maybe shadows could also be generated in the baking process as well with the baking lights.
and maybe the shadow maps feature that's in gzdoom currently has, can also be modified to suit this new "actor interacting light ",
this light uses the shadow maps calculations to interact and adjust the sprites brightness/colour which corresponds to the baked lighting / shadows on the textures with out adding shadows to the textures/map geometry,
as the baking process takes care of this visual effect.

by doing lighting this way you now have visually created the illusion that there is a real static dynamic light source and shadows in the area with out the performance hit we currently have from a real static dynamic light placed in the map being rendered in real time, and with the possibility to be turned on and off when needed with out visually altering the textures lighting is really cool in my opinion.

with baked lighting you could also go as far as adding PBR maps to the textures and bake those effects in to the map aswell. the light wont look realistic as the light wont interact with player movement and angle to the light source but it can create a good visual boost to a textures depth and roughness.

this was a little project i done awhile ago just using Gimp which is a image editor program like Photoshop that has a dynamic light baking effect in it. i got some textures online and also made some of my own and creating some normal maps for the textures using the baking effect in gimp i then scaled the textures in gzdoom builder to suit the maps layout and fake light sources.
this gives you a good idea visually what pbr/normal maps turn out like when baked to a texture in doom with out using a single dynamic light and no shadows.

DOOM 2 Pre Rendered Lighting Demo ---- https://www.moddb.com/games/doom-ii/add ... hting-demo











Last edited by Steve5563 on Tue Jan 29, 2019 7:54 am, edited 2 times in total.
User avatar
Caligari87
Admin
Posts: 6190
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him

Re: Idea For Static dynamic Lighting In Maps

Post by Caligari87 »

This is actually being worked on already. dpJudas has been slowly pushing updates to a feature branch to enable pre-rendered lightmaps. They'll also interact with dynamic lights properly, since they use a shader instead of hard-baking the lighting information to a texture.
Spoiler: screenshots
Not quite ready for prime-time yet, but pretty close last I heard.

The in-development branch is here, as well as dpJudas's light-baking program ZDRay, if you want to test it. You will need to be familiar with compiling the software yourself and using the command line, among other things.

8-)
User avatar
Steve5563
Posts: 82
Joined: Sun Jan 27, 2019 11:18 pm
Operating System Version (Optional): windows 10
Graphics Processor: nVidia with Vulkan support
Location: Australia

Re: Idea For Static dynamic Lighting In Maps

Post by Steve5563 »

sounds and looks good, yea i have no idea how to do the compiling i just make maps, curious does the player / monster sprites adjust their brightness and colour according to the new lighting and shadows in the screenshots or does the sprites brightness and color still rely on sector lighting in the baked lighting area?
User avatar
HAL9000
Posts: 266
Joined: Fri Mar 16, 2018 7:44 am

Re: Idea For Static dynamic Lighting In Maps

Post by HAL9000 »

Just posting reply to bookmark this,
ZDray looks awesome!
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed

Re: Idea For Static dynamic Lighting In Maps

Post by wildweasel »

HAL9000 wrote:Just posting reply to bookmark this,
ZDray looks awesome!
You can find a "bookmark topic" button at the bottom of every thread view, so posting in the thread is not necessary in order to do so.
User avatar
HAL9000
Posts: 266
Joined: Fri Mar 16, 2018 7:44 am

Re: Idea For Static dynamic Lighting In Maps

Post by HAL9000 »

wildweasel wrote: You can find a "bookmark topic" button at the bottom of every thread view, so posting in the thread is not necessary in order to do so.
Thank you! I did not notice that button :D
>Insert the more you know meme here<
XLightningStormL
Posts: 389
Joined: Mon May 09, 2016 1:38 am
Location: Anywhere but here

Re: Idea For Static dynamic Lighting In Maps

Post by XLightningStormL »

Shouldn't ZDray just have a compiled version made for people anyway? It'd be easier for people to test, unless the ZDoom team is just trying to floodgate for test purposes.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49130
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Idea For Static dynamic Lighting In Maps

Post by Graf Zahl »

It makes no sense to release an unfinished tool for an unfinished work branch of the engine.
User avatar
Steve5563
Posts: 82
Joined: Sun Jan 27, 2019 11:18 pm
Operating System Version (Optional): windows 10
Graphics Processor: nVidia with Vulkan support
Location: Australia

Re: Idea For Static dynamic Lighting In Maps

Post by Steve5563 »

few years later....
i would like to show what i have currently and what i need in gzdoom for the effect to work.
currently i have worked out how to bake lighting in blender and export the baked lighting as low resolution textures,
i have worked out how to modify the material shader to add more textures to use in the shader to manipulate the colors / size / effects etc of the original diffuse textures to get the desired effect i am after.
" side note - currently gzdoom seems to be limited to around 8 textures in total per shader if i use any more gzdoom wont boot. " i personally have no idea why, as i am no game / shader programmer so i have gotten lucky to get this far.

what i need for this illusion to work to a reasonable effect is to place dynamic lights in the level to only light the actors in the map and not the map geometry textures.
this is what the effect looks like with no dynamic light placed in the map
Spoiler:
and this is what it looks like with a dynamic light placed in the map. as you can see the monster and player sprites are lit nicely,
but the problem is the light is also effecting the map's geometry textures brightness and specular reflection and it destroys the illusion i am going for.
Spoiler:
if a new flag could be added to the dynamic lights to allow me to disable certain lights from rendering on the maps textures / geometry that would be perfect!!! and would solve this feature request.
the flag could be something like
DYNAMICLIGHT.DONTLIGHTMAP which could be found in this section of the wiki https://zdoom.org/wiki/Controlling_dynamic_lights
even better if it could be a feature that can be toggled in gzdoom builder when placing dynamic light.
this effect i am showing you here is for a doom 1, doom 2 remaster/remap project i would like to do i just need this dynamic light issue resolved somehow so i can start.
cheers.
User avatar
Redneckerz
Spotlight Team
Posts: 1084
Joined: Mon Nov 25, 2019 8:54 am
Graphics Processor: Intel (Modern GZDoom)

Re: Idea For Static dynamic Lighting In Maps

Post by Redneckerz »

Steve5563 wrote:few years later....
i would like to show what i have currently and what i need in gzdoom for the effect to work.
currently i have worked out how to bake lighting in blender and export the baked lighting as low resolution textures,
i have worked out how to modify the material shader to add more textures to use in the shader to manipulate the colors / size / effects etc of the original diffuse textures to get the desired effect i am after.
" side note - currently gzdoom seems to be limited to around 8 textures in total per shader if i use any more gzdoom wont boot. " i personally have no idea why, as i am no game / shader programmer so i have gotten lucky to get this far.

what i need for this illusion to work to a reasonable effect is to place dynamic lights in the level to only light the actors in the map and not the map geometry textures.
this is what the effect looks like with no dynamic light placed in the map
Spoiler:
and this is what it looks like with a dynamic light placed in the map. as you can see the monster and player sprites are lit nicely,
but the problem is the light is also effecting the map's geometry textures brightness and specular reflection and it destroys the illusion i am going for.
Spoiler:
if a new flag could be added to the dynamic lights to allow me to disable certain lights from rendering on the maps textures / geometry that would be perfect!!! and would solve this feature request.
the flag could be something like
DYNAMICLIGHT.DONTLIGHTMAP which could be found in this section of the wiki https://zdoom.org/wiki/Controlling_dynamic_lights
even better if it could be a feature that can be toggled in gzdoom builder when placing dynamic light.
this effect i am showing you here is for a doom 1, doom 2 remaster/remap project i would like to do i just need this dynamic light issue resolved somehow so i can start.
cheers.
I doubt that, as impressive as it is that you are doing the baking stage in Blender, you get much reform. Currently ZDRay activity has been on the rise again for Nash's projects ElderJam/Darkadia, gaining new features and (hopefully) making it compatible enough that it becomes native to GZDoom, so that the port gains lightmaps support.

They also make use of Ultimate Doom Builder to support inclusion of ZDRay properties. ZDRay itself is evolving into been an alternative to ZD-BSP - Being ZD-BSP with light bakes. In UDB, it appears as just another option to use to build your nodes (and bake lights at the same time).

In short, far more features than current ZDRay does. Its just a matter of time and resources.
User avatar
Steve5563
Posts: 82
Joined: Sun Jan 27, 2019 11:18 pm
Operating System Version (Optional): windows 10
Graphics Processor: nVidia with Vulkan support
Location: Australia

Re: Idea For Static dynamic Lighting In Maps

Post by Steve5563 »

Redneckerz wrote: I doubt that, as impressive as it is that you are doing the baking stage in Blender, you get much reform. Currently ZDRay activity has been on the rise again for Nash's projects ElderJam/Darkadia, gaining new features and (hopefully) making it compatible enough that it becomes native to GZDoom, so that the port gains lightmaps support.

They also make use of Ultimate Doom Builder to support inclusion of ZDRay properties. ZDRay itself is evolving into been an alternative to ZD-BSP - Being ZD-BSP with light bakes. In UDB, it appears as just another option to use to build your nodes (and bake lights at the same time).

In short, far more features than current ZDRay does. Its just a matter of time and resources.
ok thanks for the update i will have to hold off and see what happens, is their a way to follow the work that is being done with ZDRay? be good watch the progress being done with the project.
cheers
dpJudas
 
 
Posts: 3109
Joined: Sat May 28, 2016 1:01 pm

Re: Idea For Static dynamic Lighting In Maps

Post by dpJudas »

Current status of this is that the GZDoom branch is feature complete. Nash is evaluating it for his Darkadia project.

I am working on ZDRay where I'm trying to see if I can improve baking performance by using the vulkan ray tracing API. While the tool is fully functional right now, I want to see this through first before deciding on what ray tracer I'll use in the end. That's because the original dlight ray tracer uses a slightly different method than what I'm now experimenting with. Especially when it comes to the light bounce and surface lights they use different strategies and that might change the visuals slightly. I'd prefer this thing to be concluded before a 1.0 release as mappers would probably not be too happy if an update changed how much light a room receives.
dpJudas
 
 
Posts: 3109
Joined: Sat May 28, 2016 1:01 pm

Re: Idea For Static dynamic Lighting In Maps

Post by dpJudas »

Just to clarify how it works:

The way it works is that you use a doom editor that can do UDMF (Ultimate Doom Builder is recommended) to create the map.

You can mark things as static lights by filling in some UDMF properties. UDB will probably get native support for this at some point. Right now you have to enter them manually a custom properties (the list of properties you can see in the zdray readme).

You can also mark lines or sectors as emissive. Currently neither static light sources or emissive surfaces support textures. The entire surface is either emissive or not at all. Texture support would certainly be cool but I don't have any plans for adding this. Perhaps some other people will contribute a PR.

Finally, you can also add your own light probes to locations in case the auto-generated probes aren't good enough for a specific place in the map.

Once the map has the UDMF properties set up it is time to run the zdray tool - it replaces the usual step where you'd generate bsp nodes for the map. ZDRay ray traces the light map textures and stores them in the wad file as a new LIGHTMAP lump. The intention is that for something like UDB it will just be a different bsp node generator that you set it up to use.
User avatar
Steve5563
Posts: 82
Joined: Sun Jan 27, 2019 11:18 pm
Operating System Version (Optional): windows 10
Graphics Processor: nVidia with Vulkan support
Location: Australia

Re: Idea For Static dynamic Lighting In Maps

Post by Steve5563 »

thanks for clarifying all of that.
sounds like this is going to be a dream to use.
question. what sector to texture ratio did you end going with?

with my shader concept i decided to use a 64x64 texture to fill a 512x512 map sector. so its like a 64:1 ratio
this seemed to create a good clean looking visual lightmap effect while still being nice and cheap on vram usage to make decent size levels.

question. how many light bounces will this being using?
cheers.
Last edited by Steve5563 on Sun Oct 31, 2021 6:13 pm, edited 1 time in total.
dpJudas
 
 
Posts: 3109
Joined: Sat May 28, 2016 1:01 pm

Re: Idea For Static dynamic Lighting In Maps

Post by dpJudas »

It is configurable using the --samples argument. It defaults to 8, which is the same as you mention there (64x64 texels used to cover 512x512 units). As for bounces, it is configurable with --bounces, but the default will depend on how fast the GPU accelerated ray tracer turns out to be. Baking for a long time could become quite annoying. :)

Return to “Feature Suggestions [GZDoom]”