Jump to content
The Dark Mod Forums

Light baking


Bikerdude

Recommended Posts

  • Replies 148
  • Created
  • Last Reply

Top Posters In This Topic

oooOOOooooh. It does properly affect the light gem. :)

 

Just draw the light texture yourself, complete with blurry, blurry shadows, and shove it into a single light. The only downside is that the shadows reach entirely from ceiling to floor (so no soft-shadowed crates and such). Besides, I don't think doom 3 supports 3D textures. (e.g. 512 count of different 512x512 textures)

yay seuss crease touss dome in ouss nose tair

Link to comment
Share on other sites

Thats why you design the ambient texture to match how it would look as it falls on the geometry. But some scenarios might require multiple ambient lights.

 

Strombine uses two z-axis falloffImage maps from what I've seen. I will have to look at Rich's example to see if he has followed suit.

Edited by nbohr1more

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

OK.

 

After extracting the PK4, I now see that the dark areas in the light texture should fade as they approaches the light source (at center height) center of the falloffImage?

 

 

Edit:

 

Nope. :laugh:

 

But the bright spots in the light texture become brighter, thus creating the illusion of a light source.

 

(only one falloffImage BTW)

Edited by nbohr1more

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

PC ban @home is over.

 

This works well with all light and ambient modes and HDR.

Looks great!!!!!! :wub:

 

Thanks again Rich.

 

Do you have any screen-shots from the production phase?

 

I still plan on playing with the Training Mission but your example is so perfectly illustrative. For example, I could see in your Light Texture exactly where to draw an arrow to illustrate a light bounce.

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

This works well with all light and ambient modes and HDR.

You have TDM's HDR?

 

Question (I guess one of photoshop) on technique:

How do you gradually increase the blur as it moves away from the wall corner? A gradient of a gaussian blur maybe (assuming that's possible; I haven't tried it)?

 

Another:

How to get the exact dimensions of the shadows for the room? My guess is one could take a screenshot of the ortho view and work from there.

 

Stream of consciousness:

As to the z direction, hm... I think I get how the z direction is handled, but yes it's obviously problematic. Using two was mentioned, and if I understand correctly, I assume that's talking about splitting the room vertically in half and lighting it twice, once for each half? Probably useful but hopefully in most cases fading before ceiling is applicable.

 

And of course, this is doing an entire room at once. There is also the option to use several lights, e.g. around lamps, to light portions of a room, like around a nightstand and a shadow from a bed, making achieving the effect much easier.

 

Couple this with project soft shadows onto walls and such... zowie!

 

I see it's an ambient (and looks so realistic that an unlit model looks out of place, wow), but I assume that's not necessary. If it were a regular light, it could cast the same shadows plus dynamic (sharp) ones?

Link to comment
Share on other sites

Yes you could use a real light rather than ambient but if an AI crossed in front of a baked shadow in the light texture it might look wrong depending on orientation... (if setup correctly it should look fantastic... but planning is the key here). I believe that Lunaran made sure to minimize this problem by having some of the lights rotated in different directions depending on geometry. I think Luraran has a computer in his brain as most of us would have trouble estimating light volume shapes from multiple 3d orientations. :laugh:

Edited by nbohr1more

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

Also, if the real shadow (hard edge from a wall) conflicted with the hand-painted shadow, it would defeat the effect. You could of course make such edges into func_static and non shadow casting.

 

But I think for the most part, mixing real time (sharp) shadows with faked (soft) shouldn't look bad.

 

Of course, beating all of it is a sourcecode release. ^_^

Link to comment
Share on other sites

Yep.

 

Either way this is a useful method.

 

As Rich has shown, he has eliminated having to calculate the cumulative effect of three light sources by making his light texture simulate them with one light. The performance savings of that method could even (possibly) be used to offset the performance impact of the Soft Shadow mods that already exist for Doom 3.

 

Then, if the impact of Shadow calculation and Pixel shading can be reduced in the GPL version, this method could be used in conjunction with even more dynamic lights.

 

The best of all is that this method was designed to try to easily fake the look of light mapping but just coincidentally is compatible with TDM's light-gem method. It's as if it were destined to be :)

Edited by nbohr1more

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

performance impact of the Soft Shadow mods that already exist for Doom 3.

For discussion completeness, do you have links to such mods? I believe I've heard of one in progress in the past but I thought it wasn't released or complete.

 

More stream of consciousness: (@OrbWeaver, @rich_is_bored, @rebb, @anyone_who_might_know) I think I recall this being done around here somewhere, but aside from creating a light texture with shadows (especially if used as ambient which is limited for realism (no other objects will cast shadows)), shouldn't it be possible with one of the blend methods to make a pure shadow texture? That is, a light that is darkened only in a painted spot (through one of those gl_minus_one or whatever crazy magicks) and has no effect anywhere else in the texture? Not like the existing shadow lights, which cast light and skip some spots for shadow, but rather that casts only a darkened spot (reducing/negating any light it strikes)?

 

With that, mappers could have a regular light work normally, turn off shadows on specific objects, and then use a custom shadow only texture (above) to paint a shadow behind it, while not affecting anything else in the scene? (Maybe it's already being done and I fell asleep.)

Link to comment
Share on other sites

Soft Shadows Mod:

 

http://www.doom3worl...pic.php?t=23131

 

Other painted shadow method:

 

I believe that is what is in

 

tdm_textures_base01

 

tdm_light_shadows

 

 

??

 

(will add to the wiki when I've played with it... unless it's already wiki-ed)

 

(not wiki-ed AFAIK)

Edited by nbohr1more

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

Okay so I guess it does work*. :) And has definite potential (though it currently doesn't show in DR unfortunately):

 

 

Something tells me we'll be needing a lot more shapes of these. And for them to cast in DR if possible.

 

 

*worked as omni, but not projected. This limits use pretty badly. :-/

 

 

Edit: Ugh, don't want to read that whole D3W thread, especially after the first page says he can't get it to work with D3. Does it work?

Link to comment
Share on other sites

I'm pretty sure there are other examples but I think Sikkpin's version now works:

 

Update 9-18-09:

Just a small progress update. I'm using a slightly different method for obtaining the shadow mask. The downside is it'll probably be a bit more of a performance hit than the other method and possibly less accurate (this isn't really noticeable, though, unless you know what to look for). The plus side is the translucent problem is fixed and also it should be compatible with D3/Q4. Now the only obstacle to overcome is the brush shadow suppression thing.

 

I know that the Thievious mod has a soft-shadow method... So they are out there... Probably packed into a multi-enhance style mod (so frustrating that when you only want to enhance one aspect you have to wade through mods that have changed everything )

 

Previous discussion:

 

http://modetwo.net/d...ure-possiblity/

 

Edit:

 

Yep.

 

That is the EXACT same method used in Thievious

 

Download and test at your own peril (or at least peril to FPS :laugh: )

 

As an editorial aside: I don't really have a big desire for dynamic soft shadows. I am more interested in the performance saving aspect of this because it means more triangles. I like my polygons :)

Edited by nbohr1more

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

Question (I guess one of photoshop) on technique:

How do you gradually increase the blur as it moves away from the wall corner? A gradient of a gaussian blur maybe (assuming that's possible; I haven't tried it)?

 

I did some manual painting using the blur tool. The trick is to apply more strokes the further away you are from the shadow source.

 

How to get the exact dimensions of the shadows for the room? My guess is one could take a screenshot of the ortho view and work from there.

 

Your guess is pretty much dead on. Assuming you aren't going to rotate the light you take a screenshot of the room from the top orthographic viewport in Dark Radiant. The light projection is Z up so you have to flip the screenshot vertically as if you were looking up into the room.

 

I used a vector editing program called Inkscape to draw out shapes to the correct dimensions while using the screenshot from Dark Radiant as a backdrop. It helps to add a grid to the document and either scale the backdrop image or change the grid settings so that the lines nearly match up.

 

Once that's done you can reproduce the walls with a few rectangles, simulate lights using a few circles with radial gradients, and draw a few polygon shapes to act as shadow volumes with the pen tool.

 

To fake light bounces I simply duplicated a few circles, resized them, turned down their opacity, and repositioned them.

 

Accuracy isn't terribly important. If you think it looks right, it's right.

 

As to the z direction, hm... I think I get how the z direction is handled, but yes it's obviously problematic. Using two was mentioned, and if I understand correctly, I assume that's talking about splitting the room vertically in half and lighting it twice, once for each half? Probably useful but hopefully in most cases fading before ceiling is applicable.

 

I haven't tried using multiple lights yet. But yes splitting the room vertically and using one light for each half sounds like the best bet. The question of the day is do the lights need to overlap or is it enough to butt the light volumes up against each other?

 

I'll get back to you on that.

 

I see it's an ambient (and looks so realistic that an unlit model looks out of place, wow), but I assume that's not necessary. If it were a regular light, it could cast the same shadows plus dynamic (sharp) ones?

 

Yes you could set the light to cast shadows. It's only an issue when simulating multiple light sources using a single light. The shadows are cast using the center point of the light entity and if it looks like there are three lights in the room, the shadow will only match the light source closest to that center point.

 

I think if someone were going to make heavy use of this technique in a map, they would be best off using it in the place of TDM's ambient_world light. This way they are afforded one additional light pass across the entire map and can therefore place some regular lights in the scene when they want to make use of dynamic shadows.

 

You can also use lights with specular enabled to make things look a bit less flat in dark spaces. I don't know how much of a performance difference they have over regular lights but it stands to reason that they are less costly than regular lights since no diffuse illumination is done.

 

I think I recall this being done around here somewhere, but aside from creating a light texture with shadows (especially if used as ambient which is limited for realism (no other objects will cast shadows)), shouldn't it be possible with one of the blend methods to make a pure shadow texture? That is, a light that is darkened only in a painted spot (through one of those gl_minus_one or whatever crazy magicks) and has no effect anywhere else in the texture? Not like the existing shadow lights, which cast light and skip some spots for shadow, but rather that casts only a darkened spot (reducing/negating any light it strikes)?

 

There is a special light shader keyword called blendlight that allows you to project non additive texture stages into a scene. It's covered here...

 

http://www.doom3world.org/phpbb2/viewtopic.php?f=1&t=12256&start=0&st=0&sk=t&sd=a

 

It should work well for projecting shadows but I don't know how well it will work with the light gem.

Link to comment
Share on other sites

This looks amazing! It does work with HDR but doesn't work with the new ambient nor with the texture brightness method.

 

I haven't gone through all the posts made here. So I don't have any grasp over this. I'd appreciate if someone points me to few informative posts or even wiki that explains how this works.

 

Doom 3 amazes me all the time with the stuff like this. Judging from the old materials similar to the one used in the map above, there seems to be some tests id made back when they were working on D3.

 

It'd be cool if it can be combined with some image space lighting, so that the static geometry and characters can have environment's reflection, similar to the new ambient lighting (see this image for example).

Link to comment
Share on other sites

Question (I guess one of photoshop) on technique:

How do you gradually increase the blur as it moves away from the wall corner? A gradient of a gaussian blur maybe (assuming that's possible; I haven't tried it)?

In Photoshop: Marquee the area of interest, then Filter -> Blur -> Radial Blur, drag the blur center to the desired corner and setup blur method to "Spin".

Link to comment
Share on other sites

The only thing special about the light is the textures used.

 

Does this help convey what is going on?

 

Projectedlight.png

 

A light shader is constructed with two images. A projection image and a falloff image. The projection image is what is projected. The falloff image specifies the intensity of the projection as it passes through the light volume.

 

The reason this works is because an ambient light is not directional and bleeds through walls illuminating all faces equally.

 

The trick, and it's not employed in the example I posted but it is used in the custom Quake 4 level Strombine, is that you can rotate the light and change the direction of projection.

 

So in cases where the geometry in a space runs in a common direction you can paint a custom light image to fake radiosity, soft shadows, or even consolidate lights into a single entity.

 

In theory it's also possible to break a room into several light volumes to accommodate geometry that doesn't run the length of a room. I haven't tried this yet and I imagine it gets complicated.

Edited by rich_is_bored
Link to comment
Share on other sites

That is the EXACT same method used in Thievious

Download and test at your own peril (or at least peril to FPS :laugh: )

Cool. Well at least we know that's there (and apparently has source release) if we can never get it working in D3 source. Come to think of it... [downloading...]

 

It should work well for projecting shadows but I don't know how well it will work with the light gem.

It actually seems to work perfectly.

 

Remaining problems (known so far) include:

1. I can't seem to get a projected form working, only omni (which is a semi-significant problem, though I guess something stuck on a wall could be shadowed with clever limited size omni light placement *-see below).

2. I'm not sure how to control the darkness of the shadow. Light color doesn't do it. Perhaps there's a shaderparm? Ominously, there are two versions in the TDM folder: shadow_circle_01 and shadow_circle_01dark. Uh oh...

Edit: 3. Forgot also, that it doesn't show these negative lights in DR, unfortunately. Makes editing them tricky.

 

From that article on D3W "Negative Light -- Projecting Shadows", I confirm that blendLight is what's being used in these few shadow tex's in TDM.

 

In Photoshop: Marquee the area of interest, then Filter -> Blur -> Radial Blur, drag the blur center to the desired corner and setup blur method to "Spin".

Nice! Thx.

 

@Biker: A couple things (at least) being discussed here. One is using a custom hand painted light texture (same as you'd select for any light) to fake radiosity and soft shadows. Rich's map shows this. The other is using 'negative light' to simply paint soft shadows into a scene. My pic above shows this. I'm wrapping my head around making a simple demo of the second method (even though it's already been used in some maps I believe, it's clear not everyone (including myself) gave it much thought).

 

 

*Edit: Looks like maybe this (projected v omni) isn't that big of a problem afterall. Apparently lights can be rotated to have Z-fixedness no longer be fixed to Z. ;) IOW, a circular texture can be rotated 90 degrees Y in order to project the circle onto a wall. Didn't know that.

Link to comment
Share on other sites

I've successfully made a custom shadow texture. :) Hopefully will have a simple demo shortly.

 

You mean just like the projected shadows from the candles, which were rejected?

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

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

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 0 replies
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • 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
×
×
  • Create New...