View Issue Details

IDProjectCategoryView StatusLast Update
0006278The Dark ModMappingpublic20.04.2024 14:46
ReporterAmadeus Assigned To 
Status newResolutionopen 
Product VersionTDM 2.11 
Target VersionTDM 2.13 
Summary0006278: Func_Peek lightgem glitch
DescriptionWhen using the func_peek entity in game, the player's lightgem reflects the light value of the room they are peeking into instead of the light value of where the player actually is.

For instance, if the player is standing/crouching in a pitch-black room and peers through a keyhole looking into a brightly lit room, the player's light gem will brighten as though they are standing in that brightly lit room.
Steps To Reproduce1. Load up an FM that uses func_peek entity, such as A Good Neighbor, Written in Stone, or Seeking Lady Leicester
2. Lean forward into a func_peek entity (such as a keyhole on a door) in game.
3. Notice how the lightgem reflects the brightness of the room the player is peering into, not the room the player is actually standing in
Additional InformationPlease let me know if additional description/input is needed by me. I'd be happy to include a test map if required.
Tagsleaning, lighting


duplicate of 0006207 new When peeking, lightgem matches lighting on the other side of the door 
related to 0006477 new func_peek view in wrong position on Linux 
related to 0004848 resolvedduzenko Crashes when quick loading | Lightgem as Subview 




30.01.2024 22:00

administrator   ~0016466

The code for setting up lightgem is in function R_Lightgem_Render.

I believe right now it always uses eye position as lightgem location.
There is some logic to put to put location 30% between normal origin and leaned position, to adjust for crouching, etc.
But right now it is not used.
I guess all of it was broken during changing how lightgem works in terms of rendering (maybe 2.05?)

So I would say that:
 1) Use the LGPos as origin for lightgem subview rendering (lightgemRv.viewOrg).
   Check that lightgem works properly and nothing is broken =)
 2) Make sure peeking does not modify lightgem position.
   I think as soon as p.1 is fixed, lightgem will behave properly while peeking.
 3) Preferably move the whole stuff about lightgem position calculation into a method of idPlayer class.
  It is strange that frontend code contains this obviously gameplay logic.


30.01.2024 22:42

administrator   ~0016467

Here is restoring back LGPos.

However, there are many more problems:
1) Moving mouse in peeked view is inverted horizontally from one side of the door.
2) It is weird that moving mouse around causes camera to slide along the door plane.
  At the same time, view direction is not orthogonal to this plane.
  The math and controls for peeking view need some love, that's for sure =)
3) I still get dark lightgem when peeking into a door from bright side.
  Moreover, I get dark lightgem when peeking even if there is strong light on both sides of the door.
tr_subview.cpp.patch (508 bytes)   
Index: tr_subview.cpp
--- tr_subview.cpp	(revision 10635)
+++ tr_subview.cpp	(working copy)
@@ -569,6 +569,7 @@
 	lightgemRv.fov_x = lightgemRv.fov_y = DARKMOD_LG_RENDER_FOV;	// square, TODO: investigate lowering the value to increase performance on tall maps
 	lightgemRv.x = lightgemRv.y = 0;
 	lightgemRv.viewID = VID_LIGHTGEM;
+	lightgemRv.vieworg = LGPos;
 	lightgemRv.viewaxis = idMat3(
 		0.0f, 0.0f, 1.0f,
 		0.0f, 1.0f, 0.0f,
tr_subview.cpp.patch (508 bytes)   


31.01.2024 14:31

developer   ~0016468

Hm, that is strange you are seeing a dark lightgem when looking into a lit room. Admittedly, I haven't really looked at this since I first reported this for Seeking Lady Leicester, but I'll do some testing later. Maybe something has changed?


16.03.2024 18:31

developer   ~0016571

So I tested using func_peek in the 2.12 release build, and I am still getting this lightgem glitch. It's puzzling why you aren't able to replicate this. For me, the light gem changes slightly. Try this door in SLL:

Issue History

Date Modified Username Field Change
22.03.2023 17:43 Amadeus New Issue
29.01.2024 01:23 Daft Mugi Relationship added related to 0006477
30.01.2024 22:00 stgatilov Note Added: 0016466
30.01.2024 22:22 stgatilov Relationship added related to 0004848
30.01.2024 22:42 stgatilov Note Added: 0016467
30.01.2024 22:42 stgatilov File Added: tr_subview.cpp.patch
31.01.2024 14:31 Amadeus Note Added: 0016468
03.02.2024 12:46 stgatilov Target Version => TDM 2.13
10.02.2024 05:55 Fiver Tag Attached: leaning
10.02.2024 05:55 Fiver Tag Attached: lighting
10.02.2024 05:55 Fiver Tag Attached: realism
16.03.2024 18:31 Amadeus Note Added: 0016571
16.03.2024 18:31 Amadeus File Added: seekinglady (2024-03-16 12-26-08) (2580 642 41).jpg
20.04.2024 14:44 Fiver Relationship added duplicate of 0006207
20.04.2024 14:46 Fiver Tag Detached: realism