First Person... Environmental Light Exposure Immersion?

Talk about the mods you'd like to see in Daggerfall Unity. Give mod creators some ideas!
User avatar
thenameisthegame
Posts: 36
Joined: Sun Feb 19, 2023 10:02 pm

First Person... Environmental Light Exposure Immersion?

Post by thenameisthegame »

I enjoy playing in the dark in DFU, the VERY dark, thanks to some features which allow me to really get to appreciate torches and the likes, as well as the added lighting sliders for dungeons and night and interiors. But this classic legacy DF reality that exists here as well makes the experience ''blinding'' in comparisson with the old due to being a much bigger contrast with what I'm seeing first(person)hand at any given time: whatever is rendered in first person is in a ''world of its own'', outside the laws of light and shades of DF/DFU, but always ''blinding bright''.

And while I know this might be a mod idea to make the elements rendered in first person ''forced'' to behave in a replicated mimicking bubble-world to that of the environment and light source triggers (flickering, spells) outside since it's clearly not in the base DF code, it occurred to me that maybe it can be something that's a tweak from within with what we have already in DFU but ''dormant/unused''?

I am not entirely familiar with all the settings in the .ini file, but I know some can make changes outside the options seen in the launcher, and that Unity can do a lot. Maybe one such setting could take care of that? If so, I'd love to know since I'd very much like to play with a sense of being part of the world I am in, ''light exposure-wise''~
Attachments
I_am_the_Law__and_the_light.png
I_am_the_Law__and_the_light.png (353.91 KiB) Viewed 6202 times
dungeons_are_dark__my_hands_are_not__I_do_not_even.png
dungeons_are_dark__my_hands_are_not__I_do_not_even.png (205.14 KiB) Viewed 6202 times

User avatar
pango
Posts: 3359
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: First Person... Environmental Light Exposure Immersion?

Post by pango »

That's not currently a feature of Daggerfall Unity, even hidden. Root issue is that weapons and horse are not "part of the world", they're sprites in from on the 3D view, like in the classic game.
As I said on Discord, lighting seems difficult to "fake", even if that's not impossible. I suspect it would be easier for a mod to replace the sprites with real 3D models.
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
King of Worms
Posts: 4753
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: First Person... Environmental Light Exposure Immersion?

Post by King of Worms »

Yes, I asked about this many times in the past, it seems its almost impossible to do, which I still cant believe to this day...
And yes as Pango said, its a base game feature, not only DFU feature.

In DREAM I worked around it a bit, by making the weapons darker, but only so much, its not too dark during the bright day. So just some avarage. Works for horse as well.

User avatar
thenameisthegame
Posts: 36
Joined: Sun Feb 19, 2023 10:02 pm

Re: First Person... Environmental Light Exposure Immersion?

Post by thenameisthegame »

Thanks for the replies (and adequate move), I am still in disbelief myself! It doesn't help my knowledge is very limited both on how things work on that front and how to execute this idea/workaround to 'cheat it into DFU' but as I like to say...

Knowledge is bliss, and bliss is power! Maybe one day I/we will figure this out!

User avatar
DunnyOfPenwick
Posts: 275
Joined: Wed Apr 14, 2021 1:58 am
Location: Southeast US

Re: First Person... Environmental Light Exposure Immersion?

Post by DunnyOfPenwick »

It is possible to apply (simulate) lighting for first person sprites, and I know this because I wrote the mod late last year.

Basically the code scans the nearby environment around the player for light sources (including sunlight and ambient), then uses that data to calculate appropriate shading for first-person graphics like weapons and horses. The shading is applied when drawing occurs in the OnGUI() method in FPSWeapon.

The mod also exposes a callback mechanism to allow other mods to retrieve the same lighting data.

I had to change some method/variable scoping in the FPSWeapon class to allow class override, and issued a pull request. Unfortunately, I submitted this rather late in the year, so it might have to wait until post version 1.

I also wrote a second mod (Monster-University) that uses the same lighting data to model entity vision. I implemented enemy-specific vision/hearing characteristics like visual range, field-of-view, and sensitivity. Some creatures just see better in the dark than others. With this mod, players (and other entities) can potentially avoid detection in dark areas, allowing more stealthy gameplay.
The mod also rebuilds human spellcaster spellbooks and adds enhanced spellcasting tactics. For example, human spellcasters and certain monsters might initiate combat by casting protective spells or invisibility spells. Spellcasters with healing spells will use them. Some Healers might cast healing spells on nearby injured allies. Some enemies might 'surrender' (become passive) if their health falls too low, and possibly cast an invisibility spell. Falling enemies might cast slowfall/levitate spells if available, etc.

User avatar
thenameisthegame
Posts: 36
Joined: Sun Feb 19, 2023 10:02 pm

Re: First Person... Environmental Light Exposure Immersion?

Post by thenameisthegame »

Wow, that's adding so much more depth than the 'surface level' change I was even dreaming of. I can't wait to see - and play - this!

User avatar
King of Worms
Posts: 4753
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: First Person... Environmental Light Exposure Immersion?

Post by King of Worms »

Yes please :ugeek:

l3lessed
Posts: 1409
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: First Person... Environmental Light Exposure Immersion?

Post by l3lessed »

Ohh that sounds amazing, but man, I'll have to update ambidexterity mod to work with those changes.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
DunnyOfPenwick
Posts: 275
Joined: Wed Apr 14, 2021 1:58 am
Location: Southeast US

Re: First Person... Environmental Light Exposure Immersion?

Post by DunnyOfPenwick »

...I'll have to update ambidexterity mod to work with those changes.
I assume you mean updating first-person graphics?
I tried to make the callback mechanism as easy as possible.
Basically you retrieve the color(tint) from the callback and use it in the OnGUI() like so:

Code: Select all

            if (Event.current.type.Equals(EventType.Repaint) && ShowWeapon)
            {
                Color tint = FirstPersonLightingMod.Instance.PlayerTint; //direct call here, other mods use callback mechanism.

                // Draw weapon texture behind other HUD elements
                Texture tex = curCustomTexture ? curCustomTexture : weaponAtlas.AtlasTexture;
                DaggerfallUI.DrawTextureWithTexCoords(weaponPosition, tex, curAnimRect, true, tint);
            }
Since my mod already replaces the FPSWeapon, you may have to make sure the mods are ordered correctly to get your version to override mine. I swap out the FPSWeapon of GameManager.Instance.RightHandWeapon and GameManager.Instance.WeaponManager.ScreenWeapon during mod Init().

<edit> Since you are probably using the standard FPSWeapon in your code, there is another callback message to get my shaded version of FPSWeapon, which is the ShadedFPSWeapon class. You call it with the "addShadedFPSWeapon" message, passing a gameobject to the callback and it will add a ShadedFPSWeapon component to that object for you. I can always add more callback messages if necessary to suit you.

<edit #2> Further clarification: most mods that manipulate FPSWeapon shouldn't require any changes, the shading happens automatically via the override mechanism and everything else works the same. A few mods may have to use the callback mechanism to integrate. For example, the Enhanced Riding of the Roleplay And Realism mod has custom code to draw horses. In order for the shading to match, it would have to issue a call to the callback of my mod to get the correct tint to use for drawing.

User avatar
thenameisthegame
Posts: 36
Joined: Sun Feb 19, 2023 10:02 pm

Re: First Person... Environmental Light Exposure Immersion?

Post by thenameisthegame »

So if I get this right, anything that will be transported into DFU to take place in that ''first person plane of existance''' would get to have the lighting adjusted? Say, even for things which go as far as first person render of The Future Shock weapons?

https://www.nexusmods.com/daggerfallunity/mods/411

Post Reply