Jump to content
The Dark Mod Forums

Tutorial: Image-Based Lighting Workflows for TDM


Spooks

Recommended Posts

That's a huge help, thanks. AFAIK, irradiance maps were never super popular in games or rendering, it's either HDRI panoramas or cubemap sampling entities that capture the env shots automatically. But this could be useful as a IBL solution, at least in selected places. Btw. does current implementation affect diffuse only? (as in here: https://learnopengl.com/PBR/IBL/Diffuse-irradiance ) Second thing, instead of using external software, wouldn't it be easier to just stitch all cubemap sides to a cross, blur them, and separate them into images again?

Edited by Judith
Link to comment
Share on other sites

If TDM were to gain HDR support, would every existing map have to be adapted to it?

Sorta a tangent but...

 

No, not really.

 

The shader system could be enhanced with more precision without needing to change the material

handling.

 

The big "debate" about this is around "hacked \ hybrid" PBR vs full IBL\PBR workflows.

 

We could add image map support for metal and roughness (PBR) but because our current

texture assets aren't tuned to match that look and we have so many other visual hacks

that are not compatible with the workflow it might be a lot of effort for an end result

that looks "wrong". Of course, it may be a better quality wrong than our current state

of "wrong" akin to going from HL2 to Bioshock Infinite. Both fall short of true PBR

but the latter is a little closer.

 

Most of the shader developers seem to be pessimistic about such a change and are even

more pessimistic about a full asset conversion process.

 

So TLDR;

 

Improving lighting precision to HDR = Possible and plausible, no asset changes required

 

Hybrid "pseudo PBR" support = Possible but "unpopular" and devs are pessimistic about the results

 

Full PBR\IBL workflow and asset support = Very Very Unlikely without a miracle tool or contributor.

  • Like 3

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

What about switching to lightmaps (baked and stored in a file), is that even possible?

We could add lightmap support but it would need to be paired with a "probe system" (the hard part) for dynamic

objects to look right (depending on what you use the lightmap for).

 

You can currently implement lightmaps via decal models with additive blend textures.

 

Another way to add lightmaps would be to use lerped 3D texture lookups

(ala Humus's Volume lightmapping demo http://www.humus.name/index.php?page=3D&ID=47 )

which would not need a "probe system" but may require too much texture data depending on the expected detail level.

 

Well... this is sorta a broken record talking point of mine but we can also (currently)

approximate lightmaps via the native projection image system:

 

http://www.lunaran.com/page.php?id=165

 

but nobody has been able to accomplish this as well as Lunaran in the above linked example.

 

If "someone" created a visualization tool so mappers could "see the contents of the light volumes"

then the 1D+2D projection images could be more easily manipulated to produce results like that.

  • Like 1

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Decal models might be problematic for floor surfaces, as the lightgem probably won't react to them. I've already tried something like Lunaran, although with DR's exporting abilities it's (somewhat) easier to use modeling package lighting/GI system to bake lightmaps, and then put them as projection textures, in either cubemaps or falloff-less spot lights (the lightgem reacts to light change with those). This is fairly easy for interiors and simple rectanglular rooms, not so much with more complex shapes, sloped floors, etc.

Link to comment
Share on other sites

Decal models might be problematic for floor surfaces, as the lightgem probably won't react to them.

I've already tried something like Lunaran, although with DR's exporting abilities it's (somewhat) easier to use modeling package

lighting/GI system to bake lightmaps, and then put them as projection textures, in either cubemaps or falloff-less spot lights

(the lightgem reacts to light change with those). This is fairly easy for interiors and simple rectanglular rooms, not so much with more complex shapes,

sloped floors, etc.

Whoah. Pics please!

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

I haven't recreated this in my current WIP, as it's too early for that, but you can export your level geometry (both brushes and models) to your modeling package to use its static lighting/GI solution. In this case I only used light coming from the sky:

obraz.png

 

Then you can use rectangular planes for walls, floor, and ceiling to capture this and render it to texture. Then you can use these textures either in a cubemap, or in separate spotlights with projection textures to get your fake GI in a given location.

  • Like 2
Link to comment
Share on other sites

Parts 4 and 5 are now up! Boy, that sure was some intense typing. Please let me know if you have any questions I've not covered in these parts.

 

 

That's a huge help, thanks. AFAIK, irradiance maps were never super popular in games or rendering, it's either HDRI panoramas or cubemap sampling entities that capture the env shots automatically. But this could be useful as a IBL solution, at least in selected places. Btw. does current implementation affect diffuse only? (as in here: https://learnopengl.com/PBR/IBL/Diffuse-irradiance ) Second thing, instead of using external software, wouldn't it be easier to just stitch all cubemap sides to a cross, blur them, and separate them into images again?

 

Q1: The ambient cubic lights do not just affect diffuse. See the last screenshot in Part 5 for proof. An irradiance map will give you a diffuse, but a radiance map (or just the straight-up envshot cubemap) will give you the pictured specular mess. I can't tell you what's at fault here, but I hope the functionality of irradiance/radiance either gets decoupled from ambient cubic lights and into a new light type, or our materials somehow get fixed to accept radiance maps. Somewhat offtopic, originally I was going to post some screenshots of me putting radiance/specular cubemaps in the light definition and judging the results, but I cut it for time. It's peculiar but not particularly pertinent.

 

Q2: A gaussian blur is not the correct convolution filter for irradiance map but can certainly do in a pinch. The problem's not that, though. At least in Photoshop, blurring the cross with a colored background will just bleed the color into the cross. Blurring it without a background will just bleed transparent pixels. I don't think it would be different in GIMP, I don't see a way to do it that's not faster than using an external application.

  • Like 2

My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM!

 

 

Link to comment
Share on other sites

 

Q2: A gaussian blur is not the correct convolution filter for irradiance map but can certainly do in a pinch. The problem's not that, though. At least in Photoshop, blurring the cross with a colored background will just bleed the color into the cross. Blurring it without a background will just bleed transparent pixels. I don't think it would be different in GIMP, I don't see a way to do it that's not faster than using an external application.

 

I took a random cubemap example from the internet, duplicated it into another layer, replaced the background in a copy layer with transparency, selected the transparent area, inverted selection, used gaussian blur, and flattened the image.

 

obraz.png

 

Edit: also, Gimp has a Median blur filter now, and it doesn't have border pixel bleeding. So you could try a combination of Median and Gaussian blurs to make it even less detailed, if you need.

Edited by Judith
Link to comment
Share on other sites

That method will still leave the edges sharp and only blur the middle, and you need the image to be way blurrier than that. Recall that any hard gradation step in the image will cause specular to crop up. You'd need each face to be touched by each adjoining face, and a diagonal cut of the adjoining faces' edges to fill out the cross at the diagonals. That's the only way to properly filter to an IEM imo. Here is a screenshot from within Lys with the "Dilate Results" option enabled to better illustrate what I mean.

 

0L9SJjS.png

 

I can see this working for a radiance map (considering the filtering in cmftStudio is borked, too) but not an irradiance one, since they're all smooth gradients. Median filter has a habit of keeping the edges between graphical structures too, so it can only go so far. I suspect the easiest way to make an irradiance map in an image editor is to just use the gradient tool and try fake it as best you can.

  • Like 1

My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM!

 

 

Link to comment
Share on other sites

There really isn't a quick way around it, is it? Not that baking lightmaps is faster, only a bit less complex in terms of steps. At this point it might be easier to use GI to render reference lighting images, and then try to recreate it with ambient world, omni and spot lights.

Edited by Judith
Link to comment
Share on other sites

That method will still leave the edges sharp and only blur the middle, and you need the image to be way blurrier than that. Recall that any hard gradation step in the image will cause specular to crop up. You'd need each face to be touched by each adjoining face, and a diagonal cut of the adjoining faces' edges to fill out the cross at the diagonals. That's the only way to properly filter to an IEM imo. Here is a screenshot from within Lys with the "Dilate Results" option enabled to better illustrate what I mean.

 

0L9SJjS.png

 

I can see this working for a radiance map (considering the filtering in cmftStudio is borked, too) but not an irradiance one, since they're all smooth gradients. Median filter has a habit of keeping the edges between graphical structures too, so it can only go so far. I suspect the easiest way to make an irradiance map in an image editor is to just use the gradient tool and try fake it as best you can.

 

Awesome work on the tutorial man thanks for doing it. :)

 

Btw you can do that dilation effect on Photoshop using the action available on this link

  • Like 1
Link to comment
Share on other sites

Hey, thanks! I tried those actions and while they definitely work with some brush scribbles, I don't think you get results with a rectilinear image like the cross :/ Maybe if you were to rotate it 45° or something with nearest neighbour filtering.

 

@judith I mean, it's certainly an available option. I'm a little hesitant on agreeing that it'd be "easier" but I've not touched GI solutions in Blender so I can't speak to it.

  • Like 1

My FMs: The King of Diamonds (2016) | Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM!

 

 

Link to comment
Share on other sites

True, I forgot it depends so much on your background and experience. Mappers who aren't modelers would have trouble with setting up GI environment in modeling app. IEMs would be more feasible to them.

 

But thinking strictly in terms of use cases, I have the impression that IEMs would work best in well-lit environments, where radiosity and color bleeding occurs naturally. So daylight/sunlight missions, or at least strong moonlight. Or, Victorian/industrial steampunk setting, with larger glowing neon/plasma lamps, etc.

  • Like 1
Link to comment
Share on other sites

I've done a bit of tinkering with cube maps in the past where I've converted the six images that make up a cube map into an equirectangular projection. This allows you to edit a single non-cross image in the same way you would any other seamless texture. The tricky part however is finding software to do the conversion. There is a website I found that may do the trick if you're still curious.

 

https://www.360toolkit.co/convert-cubemap-to-spherical-equirectangular.html

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Are materials (on SVN) still out of sync with what the shader expects?

On 12/7/2018 at 10:16 PM, Spooks said:

While I can't say whether or not the banding VanishedOne shows in the bugtracker is not indicative of a bug, first order of business is fixing our materials to match the purpose of the lights, methinks.

 

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

Now that I think of it, the major issue with our shipped shaders using makeIrradiance is that it wasn't quite compatible

with the ARB shader. In 2.08 all ARB shaders are replaced by GLSL so that issue is gone.

The only other concern is that makeIrradiance falls short in quality of a true irradiance image per the first post in this thread

but mappers are free to create their own materials that don't use the keyword and bake their own irradiance textures per Spooks's

recommendations. (I indicated to Duzenko that mappers would probably prefer that we simply make our shaders match quality to

the external tool output but beggars can't be choosers and makeIrradiance still results in pretty nice ambient lighting.)

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

I've found makeIrradiance() good enough for my purposes so far; I've even found having a quick way to make a blurry version of a cubemap can be handy in regular materials, like these pearls:

darkmod_2020-03-24_20_01_39.jpg.a91667db00ba512517a6d320afd18965.jpg

If there's a strong case for improving it, I think maybe it comes in the context of other things we might want to do to generate cubemaps in a less manual way, i.e. env_cubemap style probe entities.

  • Like 2

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

  • 1 year later...

Not sure if this is the perfect thread for it but: I recently discovered the cubemap sky lights, and love that there's now a system to support detailed global lighting and reflections! There is however an odd problem: All of the default skies (lights/ambientcube/skybox_*) will also produce sharp reflections on surfaces where they shouldn't... if you don't set the intensity lower (_color 0.1 0.1 0.1) you're going to get even people looking like they're made out of glass 😄

QC1yNST.jpg

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...