Jump to content
The Dark Mod Forums

Projected shadows


Springheel
 Share

Recommended Posts

Anyone have any experience using shadow lights? I'm working on a new light entity and wanted to build a fake shadow into it using a projected shadow light, but I'm obviously not using them properly. When I add a projected light to a map and assign it a light texture from the shadow folder, nothing appears in game.

Link to comment
Share on other sites

If I'm not mistaken, the shadow folder is for blendLights rather than regular lights. The last time I knew of an example was in the old NHAT forest map.

I think I've still got a copy of that somewhere to verify.

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

How do I add a blendlight?

 

edit: The wiki says, "Use the blendLight keyword" but what is the proper syntax? NM, that just goes on the material shader. The existing shadow textures already use that.

 

I found an old thread that says, "create a blendLight light entity", but doesn't say how. I can't find a "blendLight" entity in our entity list in any of the obvious places to look.

 

Found another old set of instructions, but that's what I already tried and it didn't work:

To use a blendlight: just use any light entity (It can be "light" or even "light_torchflame_moving)

By giving it a special light texture, it is officially a blend light! You can use some of mine under lights/shadows/.

Keep the light's color at pure white (yes, you can tweak it if you really want to.)

Link to comment
Share on other sites

"blendLight" is just a global keyword within the material definition. It's a cheap operation because it simplifies the light interactions to not bother with the normalmap et al.

 

Most of the light textures under lights/shadows/ are basically black splotches on a transparent background. The material shader just uses a "blend blend" stage.

The ones in the NHAT forest (lights/shadows/shadow_canopy6) are different -- their stage is "blend gl_dst_color, gl_one", which would actually light up polygons.

 

For some reason, I seem to remember that they don't work as a projected light, only omni. :huh:

yay seuss crease touss dome in ouss nose tair

Link to comment
Share on other sites

Link to comment
Share on other sites

Take a look, It turned out better than I thought. I bound a light to the bottom of the candle holder.

 

I don't suppose you can ask the young you how he accomplished this? :)

Link to comment
Share on other sites

Well that does seem like exactly what I want to do, but I don't really understand how it works. If it's a regular omni light, why isn't the shadow being cast in all directions?

 

Also, I tried copying the light and resizing it, but when I did that the shadow seemed to go away. I also tried simply cloning it and moving it under the torch at map start, and couldn't see any effect. But if I put the candle under the same torch, the shadow shows up fine. :unsure:

 

What's the script do?

Link to comment
Share on other sites

So, currently I can get the effect to work if I use an omni light, but the texture gets cast in all directions, which makes it useless. I want a shadow cast only underneath the lightsource, not to the top or sides (if that would work I could just use a light texture).

 

Trying to turn the light into a projected light seems to keep it from working at all. Trying to use "blend filter" instead of "blend blend" results in a weird black void where the light should be.

Link to comment
Share on other sites

You might be able to tweak the omni by playing with the light_center value.

 

Do you have both a projection and falloffimage in your material definition?

 

This is frustrating because I remember reading a doom3world thread where they used this technique for

a player shadow in a 3rd person mod.

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

Do you have both a projection and falloffimage in your material definition?

 

I've just been using the shaders in lights/shadows. They look like this:

 

lights/shadows/shadow_square_01dark

{

blendLight

qer_editorimage lights/shadows/shadow_square_01dark_ed.jpg

 

{

blend blend

forceHighQuality

map lights/shadows/shadow_square_01dark

clamp

}

}

Link to comment
Share on other sites

I think this is the thread:

 

http://forums.thedarkmod.com/topic/11416-light-baking/page__view__findpost__p__229567

 

 

Here's an example material:

 


lights/bdog_testBlendLight2
{
blendLight
lightFalloffImage makeintensity( textures/blackdog/blendlight_falloff_inverse.tga )
{
blend gl_zero, gl_one_minus_src_color
map textures/blackdog/blackdog_icon_inverse.tga
zeroclamp
//alphazeroclamp
colored
} 
}

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

If I recall correctly, that shader inverts a regular light texture pair. I'll have to look in google cache tomorrow to confirm.

 

A could of things that might also be hindering you:

 

1) the last I heard there is no support for viewing blend lights in light preview mode for dr?

 

2) the last I heard light projections in Dr are inverted?

 

3) just like with regular lights, increasing the radius should change the intensity. Since we want

To minimize this requirement, the falloff image should be pretty close to full bright ...

Or else you'll need rediculously large lights...

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

Here's an example material:

 

That particular falloff texture doesn't exist, so I tried using lights/falloff_exp1.tga. However, putting that texture on a projected light did nothing.

Link to comment
Share on other sites

Tried everything I can think of, and nothing seems to work with projected lights. Really small omni lights can get the job done for now, though I'm having trouble getting them to turn off when the main light is extinguished.

Link to comment
Share on other sites

Don't know about the TDM version of the engine but on vanilla idtech this material i made works fine for shadows.

 

lights/tree01_shadow
{
  blendLight
  lightFalloffImage   makeintensity( textures/colors/falloff_bw.tga )
  {
  blend	blend
  map	  textures/shadows/tree01.tga
  zeroclamp
  alphazeroclamp
  colored
  }  
}

 

Here is it ingame

 

https://www.dropbox.com/s/2m69izzdq28mref/shot00001.jpg

Edited by HMart
Link to comment
Share on other sites

Is a projected light, if it works here and you guys didn't changed something on the engine then it has to work for you, to work like mine you just need two textures, a small horizontal falloff texture going from black to white and a alpha tested shadow texture, the shadow needs to be black so just make a full black texture and use the alpha channel to bring out the detail you want.

Link to comment
Share on other sites

Ok...thanks, I'll try that tomorrow. Maybe the falloff texture I've been using is unsuitable. Does it matter which direction it fades?

Link to comment
Share on other sites

Hey, it works! Looks like the falloff image is the key, although I don't understand why or what it's doing.

 

Thanks HMart!

Link to comment
Share on other sites

So, there's a bit of a problem. I'm not sure what's causing it because I don't understand projected lights.

 

In the image you can see the projected shadow under the candle (top). However, as you move the candle around you can see there is a strip of shadow that moves about...it looks like it is outside the radius of the projected light somehow.

post-9-0-03324700-1401840337_thumb.jpg

Link to comment
Share on other sites

Yes, this is why I've wished for a way to visualize the contents of a light volume, a volumetric representation.

 

To my understanding, the falloff image is really like a line ( 1D image) where the brightness of the line determines

how bright the light is away from the light_center. If I understand correctly, the brighter the falloff image the darker

the shadow in this case... unless it instead just blends the two images then the opposite would be true. (Hence why

I emailed that old Doom 3 modder).

 

The explanations for the artifact that I can come up with:

 

1) Your material is missing zeroclamp keywords and the image is somehow being truncate at the boundaries

2) Your image has some shading at the edges

3) A "certain SVN graphic feature" is enabled and it's treating the light volume as part of the scene geometry ;)

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

Interesting. The falloff image is necessary to make the texture work as a projected light, but it KEEPS it from working as an omni. I guess it can only be one or the other, but not both.

 

Unfortunately, projected shadows will not work for movable objects...I'm getting too much weirdness on the candle, including the shadow being briefly projected forward from the tip of the candle if you drop it a certain way.

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.

 Share

  • Recent Status Updates

    • freyk

      Some years earlier i created some launchers for TDM. uploaded today some new sourcecode and executables on my github repo.
       
      · 0 replies
    • Epifire

      Say, I know it's been a while since the site got overhauled from the crash. But did we ever figure out if/how to get the recent topics & replies list back? It's not a total deal breaker but it was nice for becoming a thread creeper again...


      · 2 replies
    • Epifire

      Some of you who've been on the TDM discord know I was out of work last Winter, just putting in hrs for the developer portfolio. Currently I've been working a seasonal job to pay the bills and now I'm finally in my last week before I get bumped off. Things will be tight but I'm planning a long off period to make as much content as I can. Big plans in Unreal Engine as well as my most ambitious TDM collab yet! Never been so excited to be a stuck at home to pursue my life's work. With a lotta time and maybe some luck, I'm hoping to get enough art work done that I may start applying around to studios.
      · 4 replies
    • STiFU

      I finally got around to play Prey and I truly loved it. It is an incredible homage to System Shock and Deus Ex. While the gameplay is not en par with those two titles, the game makes up for that with its well written lore and story. The whole "world" just feells so authentic and it features a ton of really god environmental story-telling. Recommended for every immersive sim fan, i.e., everyone on this forum.
      · 2 replies
    • jaxa

      Alder Lake has arrived:
      https://forums.thedarkmod.com/index.php?/topic/18055-2016-cpugpu-news/page/15/&tab=comments#comment-466190
       
      · 0 replies
×
×
  • Create New...