Jump to content
The Dark Mod Forums

Hidden items that become visible when illuminated by UV lamps


MirceaKitsune

Recommended Posts

Was playing the first FM that makes use of X-ray glasses... seeing them in action inspired me to write about an addition to their idea. This is likely a feature suggestion, I've played most FM's and never saw it done nor found any script / material features that would allow this result, but presume it's possible with a tweak in materials or the renderer.

I'm thinking of ultraviolet lamps that can uncover hidden decals or items: The object is invisible if not lit by a specific lamp, only when the light of an UV source touches them they start to show up. A blue-light can be offered to the player as an inventory item or replacement to the standard lantern, a lantern you can pick up and move only in the world, even come in the form of a candle since why not? The player or the environment must move specific objects and / or light sources to the correct positions to uncover secrets such as codes.

Some examples: Next to an UV lantern you find a note hinting there's a secret code in a particular room... you must pick up the lantern carry it to that room then place it on a support, illuminating the number-wheel combination or hint on the secret entrance you must go to. We can even reverse the process and have a static UV lamp on a wall, the player picks up an inventory item and must drop it under the lamp to see what's written on it... we can even have a hidden symbol on an AI which will shine when they walk under that one streetlight. They could also reveal frobable objects which can't be touched unless illuminated... maybe a hidden lock to open a door which becomes available when lit, or a readable note which normally appears blank but can be read or contains additional text if there's an UV lantern next to it. So many fun ideas we could do with this given our usual theme and ideas for secrets!

At a technical level, the logical way seems like separating the lightmap of light sources marked with the UV spawnarg, then multiplying with its intensity the alpha channels of all material components marked with the UV material flag. This might mean UV lights have to be rendered to a separate pass which could break some performance optimizations? Would be great if an index was possible instead of one flag, that way different secrets can be revealed by different lamps... even an universal UV lamp / material set would do though.

Edited by MirceaKitsune
Link to comment
Share on other sites

2 hours ago, nbohr1more said:

The spectrum material flag and entity args already exist. No need for x-ray or anything new to achieve a UV light effect.

Interesting, thanks! Didn't think it might since I haven't seen it done before nor any material flags that stood out, despite how appealing the idea is which is why I was surprised not seeing it in any FM. We could probably use some default lamps and decals to encourage mappers... can make any defs myself if anyone ever wishes or needs them.

The material flag is listed on id.sdk so it's even part of core idTech4. But in DarkRadiant I don't see a spectrum spawnarg for light entities: Is it simply not documented, or does the light also need a texture who's material has that spectrum?

Edited by MirceaKitsune
Link to comment
Share on other sites

The id tech 4 design required the material def and the light material def to have the same spectrum number.

The Dark Mod adds the ability to add a spectrum entity flag for both the light and entity.

  • Thanks 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

The roadblock with using spectrum lights to reveal stuff is that unlit spectrum materials will be opaque black, so still very much visible. It seems to have been designed more as a performance optimisation, by reducing the number of interactions between lights and surfaces. I don't think there's currently any way to make a material that goes between invisible and fully opaque depending on lighting.

Link to comment
Share on other sites

Yep, you can make things that are invisible when unlit but you must use a complex material that uses the diffuse stage as an input for a transparent stage. Original discussion here:

 

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

So that's not exactly it and a few changes are still needed. I know it needs to work such that light doesn't affect (only) the brightness but the alpha channel in the same way. The material can otherwise be fully bright or still responsive to standard lighting, ideally the filter would only affect transparency without changing how light is otherwise received.

I've subscribed to the thread you mentioned though it hasn't been active since 2019, glad everything's documented there. I don't fully understand the issue though: When the surface is fully invisible (0% alpha) it becomes black, but once it has any value above zero (1% alpha) it works well? Is it difficult to solve whatever is happening the right way?

Link to comment
Share on other sites

  • 2 weeks later...

I'm presently working on a new FM which I actually created with this concept in mind. Making a visually fit UV lantern with atdm:moveable_lantern_oil_hand_colorme_lit was super simple. I then set both the lamp and func_static patch to "spectrum 1" but unfortunately nothing happens.

42990850_olam(2022-12-0417-20-05)(-823.39-725.69116.25).thumb.jpg.e47ade916de48eb8feb6ffdbe69c9ff3.jpg

I'd like to ask if anyone could please offer an up to date example on how an entity / material lit by a spectrum light must be defined exactly. I understand it should technically be possible already, just that material definition is a little complicated until an optimization were to be added. How exactly would this material need to look like?

Link to comment
Share on other sites

2 hours ago, Dragofer said:

You can find a test map here. Note that I remember not being too happy with it.

https://forums.thedarkmod.com/index.php?/topic/19825-negative-spectrum/&do=findComment&comment=432949

Wonderful, thank you! I had success in getting the base setup to work with one of the symbol textures, couldn't ask for better functionality :) I use the following material setup adapted from that example, might simplify it further if specular doesn't need to be defined separately like that:

lights/biground1_spectrum
{
	spectrum 1
	description "Round point light."
	{
		forceHighQuality
		map	lights/biground1.tga
		colored
		zeroClamp
	}
}

textures/darkmod/decals/symbols/magic_symbol_circle01_spectrum
{
	qer_editorimage   textures/darkmod/decals/symbols/magic_symbol_circle01_ed
	translucent
	noshadows
	twosided
	nonsolid
	spectrum 1
	sort 5
	bumpmap			heightmap (textures/darkmod/decals/symbols/magic_symbol_circle01, 2)
	diffusemap		textures/darkmod/decals/symbols/magic_symbol_circle01
	{
		blend		specularmap
		map			textures/darkmod/decals/symbols/magic_symbol_circle01
		red			.25
		green		.25
		blue		.2
	}

	// TDM Ambient Method Related
	{
		if (global5 == 1)
		blend add
		map				textures/darkmod/decals/webs/web4
		scale			1, 1
		red				global2
		green			global3
		blue			global4
	}
}

There are three secondary problems I'll need to address now, let me know the solutions you propose.

  1. When given "texture lights/biground1_spectrum", the light will illuminate the hidden symbol as desired, but no longer shine on anything else. I presume there's no way to tell it you want "spectrum 1" but also for it to shine on everything else like a normal light? If not I'll just have to give my lantern two light sources.
  2. How to make the lantern entity work with this? I'd prefer the player being able to press the use key while holding it to turn the light on and off. I'm using atdm:moveable_lantern_oil_hand_colorme_lit: Apparently the lantern ent doesn't inherit a light type itself but attaches one similarly to the torch... I'm seeing "def_attach light_lantern_oil_omni" so I can probably just inherit and override that. Anything special I must do to ensure the still light toggles when the lantern is used? Especially if I'll have to attach the UV light separately to get both UV and standard lighting, will operating the lantern toggle both the normal light and my additional "def_attach_0 light_lantern_oil_omni_spectrum"?
  3. This works fine with a decal texture, but I was wondering if there's an easy way to make it work with an in-world GUI for text written as a spawnarg? That's when you make your patch func_static, texture it with "textures/darkmod/decals/signs/decal_gui", give it the spawnarg "gui guis/readables/sign_text_decals/sign_text_camberic.gui", then use "gui_parm1 my_text" to make it say something. Is it as simple as creating a "textures/darkmod/decals/signs/decal_gui_spectrum" with the "spectrum 1" keyword in the material and it just works? I believe GUI text wasn't rendered like a conventional material per say, as the fonts themselves don't inherit the properties of that material nor receive light to my knowledge.
Link to comment
Share on other sites

Figured out questions #1 and #2, got it working just as desired :D I have to use two light sources which is better anyway as I get control over each one, this way I made the visible light half intensity which also prevents raising your lightgem excessively if a guard sees you while carrying it, whereas the spectrum component is less saturated so it doesn't completely colorize the symbols. Haven't tried #3 yet so please let me know if there's any chance to make text in readables work.

This is the def and material setup I had to use for the lantern: Just add the custom lamp to your map and that's all!

lights/tdm_lanternlight_spectrum
{
	spectrum 1
	lightFalloffImage	makeintensity( textures/lights/brightround )
	{
		map	textures/lights/tdm_lanternlight
		forceHighQuality
		colored
		zeroClamp
		red	((.1 * sintable [(time * ( 1 + Parm3 ) ) ]) +.9) * Parm0
		green	((.1 * sintable [(time * ( 1 + Parm3 ) ) ]) +.9) * Parm1
		blue	((.1 * sintable [(time * ( 1 + Parm3 ) ) ]) +.9) * Parm2
	}
}
light_lantern_oil_omni_spectrum_0
{
	"inherit"		"light_lantern_oil_omni"
	"light_radius" 	"192 192 192"
	"_color"		"0.125 0 0.5"
	"texture"		"lights/tdm_lanternlight"
}

light_lantern_oil_omni_spectrum_1
{
	"inherit"		"light_lantern_oil_omni"
	"light_radius" 	"192 192 192"
	"_color"		"0.75 0.5 1"
	"texture"		"lights/tdm_lanternlight_spectrum"
}

atdm:moveable_lantern_oil_hand_colorme_lit_spectrum
{
	"inherit"		"atdm:moveable_lantern_oil_hand_colorme_lit"
	"_color"		"0.25 0 1"
	"def_attach"	"light_lantern_oil_omni_spectrum_0"
	"def_attach_1"	"light_lantern_oil_omni_spectrum_1"
}

1980268660_olam(2022-12-0502-11-29)(-850.67-600.97116.25).thumb.jpg.a9301e2351598e900c799d52669065ee.jpg968472165_olam(2022-12-0502-11-41)(-850.67-600.97116.25).thumb.jpg.f789ea1d2d1154f1df9639d4fe7f9f07.jpg

Link to comment
Share on other sites

An unfortunate side effect to be aware of: The spectrum light won't respect shadows that should be cast by normal surfaces. I can easily imagine that's because the light completely ignores anything that isn't on the custom spectrum including shadow casters. Would be nice to have a solution, especially as this should mean symbols can be illuminated through solid walls. A bearable inconvenience at the end of the day however, might shorten the UV light radius if it seems too bad.

601482242_olam(2022-12-0504-39-09)(-886.45-627_4116.25).thumb.jpg.0d5fc752ce240e1ec2d00f595ffa743c.jpg

Link to comment
Share on other sites

  • 11 months later...

I remember I got it working last time but had one issue left: The UV light doesn't cast shadows. That's because being on its own spectrum, it doesn't interact with anything on the normal spectrum any more... this means it will illuminate only the special materials I want it to, but at the cost of only those materials existing to the light thus being able to cast or receive shadows too. Let me know if there's any known solution or potential fix for this so the UV light doesn't reveal objects through walls.

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

    • 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.
      · 3 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...