Jump to content
The Dark Mod Forums
Sign in to follow this  
Spooks

Tutorial: Image-Based Lighting Workflows for TDM

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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!

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
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.

Loading...
Sign in to follow this  

×
×
  • Create New...