MadDeCoDeR / Classic-RBDOOM-3-BFG

DOOM: BFA (Big Freaking Anniversary) Edition (former Classic RBDoom 3 BFG) is a source port based on RBDOOM-3-BFG and enchance the experience of Ultimate DOOM, DOOM 2 and DOOM 3.
GNU General Public License v3.0
211 stars 22 forks source link

Fix D3 Player Head Shadow Cast & Fix D3XP Starting Weapon #136

Closed mmillar-bolis closed 9 months ago

mmillar-bolis commented 9 months ago

Describe the Bug: First, the main Doom 3 campaign has a problem when g_showplayershadow is on: the player's head does not cast a shadow. This issue is present in vanilla Doom 3 BFG as well. This can be fixed by changing materials/characters.mtr and commenting out the shader keyword twosided on line 2483:

models/characters/player/playerhead
{
        noselfShadow
    noOverlays
    flesh
    clamp
    //twosided

    renderbump  -size 512 512 -trace 0.07 -colorMap -aa 2  models/characters/player/playerhead_512_local.tga models/characters/player/playerhead_hi.lwo

According to a few random posts online, twosided apparently not only draws a texture on both sides of the mesh, but also disables it's shadow volume cast, leading to the issue we see with the head. Other meshes use this keyword for hair and glasses, but no other part of the player body does. The Resurrection of Evil and Lost Episode player models do not exhibit this issue either.


Second, at the very start of Resurrection of Evil (game/erebus1.map), when the player initially spawns, they are holding the Grabber, despite not having acquired it yet. A script then appears to run and automatically changes inventory to the Pistol, and the Grabber is no longer selectable until it is picked up later. This issue is also present in vanilla Doom 3 BFG. This can be fixed by changing def/d3xp-player.def and setting current_weapon from 1 to 2 on line 437:

    "weapon18_visible"                  "0"                 // whether you can see this weapon in the inventory or not

    "current_weapon"                    "2"

    "weapontoggle0"                     "0,1"

Screenshots:

screenshot001 Screenshot 1 - Default rendering of player using twosided shader key on head, resulting in headless shadow. ​

screenshot002 Screenshot 2 - Fixed rendering of player by removing twosided shader key from head, resulting in normal shadow. ​

screenshot003 Screenshot 3 - Initial spawn in RoE on Erebus 1, showing momentary Grabber before a script triggers the switch to Pistol. "current_weapon" "2" prevents this from ever occurring.

Desktop:

MadDeCoDeR commented 9 months ago

Hi, the grabber doesn't show on new game. Instead you start with the artifact and then it autoswap to the pistol. Have you load the map with the new game option in the main menu or using console/dev menu?

mmillar-bolis commented 9 months ago

Hey-hey! So, in both vanilla BFG and BFA, I am not using the console but loading from the New Game menu. In both editions, the player appears to spawn with weapon 1 (as specified in def/d3xp-player.def) which is the Grabber. The above screenshot is from BFA after starting a new game from the Main Menu.

Here is a screenshot of the exact same thing happening in vanilla BFG:

screenshot004

Is this not happening for you?

Also, I see what you're saying about how it should be expected that the player should spawn with the Artifact, as that maintains continuity with the previous cutscene. So, perhaps "current_weapon" should be "12" (weapon_bloodstone_passive) instead of "2".

MadDeCoDeR commented 9 months ago

Yeah, as far as I remember on d3xp you start with the artifact and then swap to the pistol. Even in the .map the info_player_start doesn't give you the grabber. Also if you check the d3xp_player.def in the lines 145 and 146 it doesn't give you the grabber. How and why it does that on you I really don't know, have you tried the vanilla DOOM 3?

mmillar-bolis commented 9 months ago

You are absolutely right about both of those points: it's not in the weapon inventory or info_player_start. I wasn't really sure why this was happening to me and not you, but I believe that I just figured it out.

Spawning with the Grabber happens when set ui_autoSwitch is 0. If it is left on the default value 1, the bug does not occur and the player spawns with the Artifact like they should.

Clearly, I should not have bundled both of these things into one commit, but I should have done more testing first. I didn't realize that I somehow had that set for both engines and am very sorry about that! Would you like me to close this pull request and open a separate one for the player head? Also, would you like me to submit an issue for starting RoE with ui_autoSwitch 0?

Hey, thank you so much for being patient with me on this. I definitely didn't mean to pollute your pull request history and I will be more careful going forward.

MadDeCoDeR commented 9 months ago

Sure, any help is always appreciated