... well and fully, and before getting out of the parking garage.
In a more serious description, starting off, I load the client and can play the game, but only solo queue, or training grounds. Should I attempt to run with a group, it will make it into the loading screen for the map, then CTD.
I can attempt to reconnect, and occasionally get into the client, "rejoin" match, and it will make it to the same spot before CTD.
After this occurs, I load the client, and it will make it through the login, gameplay tip screen, and CTD amid the loading of the mech bay.
On a hunch from another thread I had my unit-mate check, and I was still showing online. Had him PM me to make the server check to see if I was online, it refreshed to show me offline, and I was able to log back in passed the mechbay loading screen. This workaround works consistently, and can be necessary hours later.
Again, at this point I'm back to either dropping in solo queue, or crashing, and repeating the process. I'm at a loss. It seems like it's something between authentication and possibly just the group-queue servers, but the Crashrpt and Omicron contents suggest something related to graphics.
Things I've tried -
- Fresh install
- Repair tool (which comes up with nothing to repair)
- Compatibility Modes for Win7 and Win8
- It is running in Administrator Mode
- UAC is off, and login has Administrator
- Malware / Virus protection is off
- Have gone into Windows Defender, and added exclusions for all executables in the MWO folders
- Have tried turning Windows Defender off entirely
- Drivers:
Catalyst Control Center 15.6, 15.7, 15.7.1
Driver package 15.20.1062.1002-150715a-187327c (and whatever came with CCC 15.6 and 15.7)
For those so inclined/adept, here's the section of the crashrpt.xml:
Spoiler
<ExceptionAddress>0x15aa77bc</ExceptionAddress>
<ExceptionModule>C:\Games\MWO\MechWarrior Online\Bin64\CryRenderD3D9.DLL</ExceptionModule>
<ExceptionModuleBase>0x15a30000</ExceptionModuleBase>
<ExceptionModuleVersion>3.4.7.6977</ExceptionModuleVersion>
<ExceptionType>0</ExceptionType>
<ExceptionCode>0</ExceptionCode>
<ExceptionAddress>0x15aa77bc</ExceptionAddress>
<ExceptionModule>C:\Games\MWO\MechWarrior Online\Bin64\CryRenderD3D9.DLL</ExceptionModule>
<ExceptionModuleBase>0x15a30000</ExceptionModuleBase>
<ExceptionModuleVersion>3.4.7.6977</ExceptionModuleVersion>
<ExceptionType>0</ExceptionType>
<ExceptionCode>0</ExceptionCode>
... and the error-laden portion of the Omicron, cut down with a sub-spoiler so it doesn't fill the entire screen:
Spoiler
BackupNameAttachment=" Build(0) 29 Jul 15 (21 23 23)" -- used by backup system
Log Started at 07/29/15 21:23:23
Running 64 bit version
Executable: C:\Games\MWO\MechWarrior Online\Bin64\MWOClient.exe
FileVersion: 1.3.414.0
ProductVersion: 1.3.414.0
Using STLport C++ Standard Library implementation
Added MOD directory <engine> to CryPak
Executable Command Line: "C:\Games\MWO\MechWarrior Online\Bin64\MWOClient.exe" flowthru
Total number of logical processors: 4
Number of available logical processors: 4
Total number of system cores: 2
Number of cores available to process: 2
Processor 0:
CPU: AMD AMD FX™-4100 Quad-Core Processor
Family: 15, Model: 1, Stepping: 2
FPU: On-Chip
CPU Speed (estimated): 14.3 MHz
MMX: not present
SSE: present
3DNow!: not present
Serial number not present or disabled
Processor 1:
CPU: AMD AMD FX™-4100 Quad-Core Processor
Family: 15, Model: 1, Stepping: 2
FPU: On-Chip
CPU Speed (estimated): 14.3 MHz
MMX: not present
SSE: present
3DNow!: not present
Serial number not present or disabled
<21:23:23> [Error] Error: ConsoleVariableGroup 'sys_spec_environment' key 'e_TerrainTextureLodRatio' is not missing in default
<21:23:23> [Error] Error: ConsoleVariableGroup 'sys_spec_environment' key 'e_TerrainTextureLodRatio' is not missing in default
<21:23:23> [Error] Error: ConsoleVariableGroup 'sys_spec_environment' key 'e_TerrainTextureStreamingPoolItemsNum' is not missing in default
<21:23:23> [Error] Error: ConsoleVariableGroup 'sys_spec_environment' key 'sys_spec_Quality' is not missing in default
<21:23:23> [Error] Error: ConsoleVariableGroup 'sys_spec_environment' key 'e_TerrainTextureStreamingPoolItemsNum' is not missing in default
<21:23:23> [Error] Error: ConsoleVariableGroup 'sys_spec_postprocessing' key 'r_UseEdgeAA' is not missing in default
<21:23:23> Windows 64 bit (build 6.2.9200)
<21:23:23> System language: English
<21:23:23> Windows Directory: "C:\WINDOWS"
<21:23:23> Prerequisites...
<21:23:23> * Installation of KB940105 hotfix required: no! (either not needed or already installed)
<21:23:23> Local time is 21:23:23 07/29/15, system running for 644 minutes
<21:23:23> 16123MB physical memory installed, 13216MB available, 134217727MB virtual memory installed, 18 percent of memory in use
<21:23:23> PageFile usage: 44MB, Working Set: 37MB, Peak PageFile usage: 44MB,
<21:23:23> Current display mode is 1680x1050x32, (Unknown graphics card)
<21:23:23> Japanese keyboard and 5+ button mouse installed
<21:23:23> --------------------------------------------------------------------------------
<21:23:23> Stream Engine Initialization
<21:23:23> GameName: MechWarrior Online (64 bit)
<21:23:23> BuildTime: Jul 21 2015 16:06:24
<21:23:23> Windows Error Reporting is enabled setting exception handler
<21:23:23> Font initialization
<21:23:23> Physics initialization
<21:23:23> Sound initialization
<21:23:23> <Sound> Initializing AudioDevice now!
<21:23:23> <Sound> Initialize FMOD with dynamic memory callbacks
<21:23:23> <Sound> Starting to initialize Windows Audio Session API output!
<21:23:23> <Sound> Playback drivers found: 4
<21:23:23> <Sound> Available playback drivers:
1. Speakers (Realtek High Definition Audio)
2. 1 - HP w2216 (AMD High Definition Audio Device)
3. Realtek Digital Output(Optical) (Realtek High Definition Audio)
4. Realtek Digital Output (Realtek High Definition Audio)
<21:23:23> <Sound> FmodEx-AudioDevice: Now running on driver: Speakers (Realtek High Definition Audio)
<21:23:23> <Sound> Record drivers found: 2
<21:23:23> <Sound> Available record drivers:
1. Microphone (Realtek High Definition Audio)
2. Microphone (Microsoft LifeCam VX-7000.)
<21:23:23> <Sound> Record config is set to autodetect using record driver 0
<21:23:23> <Sound> Using speaker mode: FMOD_SPEAKERMODE_5POINT1
<21:23:23> <Sound> Initializing FMOD-EX now!
<21:23:24> <Sound> Initialized FMOD-EX
<21:23:24> <Sound> Using FMOD version: 00044211 and internal 00044211!
<21:23:24> <Sound> Initializing SoundSystem now!
<21:23:24> Renderer initialization
<21:23:24> [Error] Failed to create stereo device
<21:23:24> used GeomInstancingThreshold is 2
<21:23:24> Localized language content(english) not available or modified from the original installation.
<21:23:24> Localized language content(english) not available or modified from the original installation.
<21:23:24> Network initialization
<21:23:24> [net] using iocp socket io management
<21:23:24> network hostname: Agony
<21:23:24> ip:192.168.1.6
<21:23:24> [Network Version]: RELEASE PURE CLIENT
<21:23:24> MovieSystem initialization
<21:23:24> Console initialization
<21:23:24> Time initialization
<21:23:24> Input initialization
<21:23:25> AI initialization
<21:23:25> Initializing Animation System
<21:23:25> Initializing 3D Engine
<21:23:25> Initializing default materials...
<21:23:25> Script System Initialization
<21:23:25> Entity system initialization
<21:23:25> Initializing AI System
<21:23:26> [PlayerProfiles] Login of user 'RonanFrost' successful.
<21:23:26> [PlayerProfiles] Found 2 profiles.
<21:23:26> Profile 0 : 'RonanFrost'
<21:23:26> Profile 1 : 'default'
<21:23:26> [GameProfiles]: Successfully activated profile 'RonanFrost' for user 'RonanFrost'
<21:23:30> TrackIRManager: DLL Location key not present
<21:23:30> TrackIRManager: Error initializing NPClient interface!! (Err: 4)
<21:23:30> TrackIRManager: Error registering window handle!!
<21:23:30> TrackIRManager: Error querying NaturalPoint software version!!
<21:23:30> TrackIRManager: Error stopping cursor
<21:23:30> TrackIRManager: Error starting data transmission
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(btn_160x44, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(ButtonCommonObject, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(btn_160x44, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(ButtonCommonObject, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(check, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(ButtonCommonObject, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(UINumericStepperTiny, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(UINumericStepperSmall, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(UINumericStepper, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(UINumericStepperTiny, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(UINumericStepperSmall, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(UINumericStepper, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:50> Patch Complete Received
<21:23:50> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:03> sv_gamerules = mechlab []
<21:24:03> ============================ Loading level mechlab ============================
<21:24:06> [Error] Error: CTexMan::ImagePreprocessing: Scaling of 'textures/particles/weapons/laser_beam_1x4_lop0.dds' compressed texture is dangerous (only single mip) [File=textures/particles/weapons/laser_beam_1x4_lop0.dds]
<21:24:06> [Error] Error: CTexMan::ImagePreprocessing: Scaling of 'textures/particles/weapons/ppc_beam_b.dds' compressed texture is dangerous (only single mip) [File=textures/particles/weapons/ppc_beam_b.dds]
<21:24:06> ======== mechlab is loaded in 2.7 sec ========
<21:24:08> Finished IS map update for cycle 833, next update in 5761.000000 seconds
<21:24:25> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:26> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:26> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:26> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Import error: GFxResource 'UILabelCCW' is not exported from movie '.\UILabel.swf' [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: GFxLoader failed to open 'Libs/UI/System\../Screens/Assets/UIWebDownloads/DailyStock.jpg' [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> GFxLoader failed to open "Libs/UI/System\../Screens/Assets/UIWebDownloads/DailyStock.jpg" [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: GFxLoader failed to open 'Libs/UI/System\../Screens/Assets/UIWebDownloads/Stock.jpg' [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> GFxLoader failed to open "Libs/UI/System\../Screens/Assets/UIWebDownloads/Stock.jpg" [Libs/UI/System\Main.gfx]
<21:24:30> Finished IS map update for cycle 833, next update in 5739.000000 seconds
<21:24:31> Material objects/mechs/skins/pcgamer/awesome_pcgamer not found during Unregister
<21:24:32> could not free all buffers from CDevBufferMan!
<21:24:32> UnLoadLevel End: 0.6 sec
<21:24:35> Game rules class: Conquest
<21:24:35> ============================ PrepareLevel tourmalinedesert ============================
<21:24:36> Initializing default materials...
<21:24:41> [Error] Error: CTexMan::ImagePreprocessing: Scaling of 'objects/environments/skyboxes/forestcolony_clouddome_a.dds' compressed texture is dangerous (only single mip) [File=objects/environments/skyboxes/forestcolony_clouddome_a.dds]
<21:24:41> [Error] Error: CTexMan::ImagePreprocessing: Scaling of 'objects/environments/skyboxes/td_rednebula_dif.dds' compressed texture is dangerous (only single mip) [File=objects/environments/skyboxes/td_rednebula_dif.dds]
<21:24:41> [Error] Error: CTexMan::ImagePreprocessing: Scaling of 'textures/particles/weapons/laser_beam_1x4_lop0.dds' compressed texture is dangerous (only single mip) [File=textures/particles/weapons/laser_beam_1x4_lop0.dds]
<21:24:41> [Error] Error: CTexMan::ImagePreprocessing: Scaling of 'textures/particles/weapons/ppc_beam_b.dds' compressed texture is dangerous (only single mip) [File=textures/particles/weapons/ppc_beam_b.dds]
<21:24:41> [Error] Runaway thread
Shader Name Mech
Shader File Shaders/HWScripts/CryFX/Mech.cfx
Shader Error
D3DXCompileShader failed
BackupNameAttachment=" Build(0) 29 Jul 15 (21 23 23)" -- used by backup system
Log Started at 07/29/15 21:23:23
Running 64 bit version
Executable: C:\Games\MWO\MechWarrior Online\Bin64\MWOClient.exe
FileVersion: 1.3.414.0
ProductVersion: 1.3.414.0
Using STLport C++ Standard Library implementation
Added MOD directory <engine> to CryPak
Executable Command Line: "C:\Games\MWO\MechWarrior Online\Bin64\MWOClient.exe" flowthru
Total number of logical processors: 4
Number of available logical processors: 4
Total number of system cores: 2
Number of cores available to process: 2
Processor 0:
CPU: AMD AMD FX™-4100 Quad-Core Processor
Family: 15, Model: 1, Stepping: 2
FPU: On-Chip
CPU Speed (estimated): 14.3 MHz
MMX: not present
SSE: present
3DNow!: not present
Serial number not present or disabled
Processor 1:
CPU: AMD AMD FX™-4100 Quad-Core Processor
Family: 15, Model: 1, Stepping: 2
FPU: On-Chip
CPU Speed (estimated): 14.3 MHz
MMX: not present
SSE: present
3DNow!: not present
Serial number not present or disabled
<21:23:23> [Error] Error: ConsoleVariableGroup 'sys_spec_environment' key 'e_TerrainTextureLodRatio' is not missing in default
<21:23:23> [Error] Error: ConsoleVariableGroup 'sys_spec_environment' key 'e_TerrainTextureLodRatio' is not missing in default
<21:23:23> [Error] Error: ConsoleVariableGroup 'sys_spec_environment' key 'e_TerrainTextureStreamingPoolItemsNum' is not missing in default
<21:23:23> [Error] Error: ConsoleVariableGroup 'sys_spec_environment' key 'sys_spec_Quality' is not missing in default
<21:23:23> [Error] Error: ConsoleVariableGroup 'sys_spec_environment' key 'e_TerrainTextureStreamingPoolItemsNum' is not missing in default
<21:23:23> [Error] Error: ConsoleVariableGroup 'sys_spec_postprocessing' key 'r_UseEdgeAA' is not missing in default
<21:23:23> Windows 64 bit (build 6.2.9200)
<21:23:23> System language: English
<21:23:23> Windows Directory: "C:\WINDOWS"
<21:23:23> Prerequisites...
<21:23:23> * Installation of KB940105 hotfix required: no! (either not needed or already installed)
<21:23:23> Local time is 21:23:23 07/29/15, system running for 644 minutes
<21:23:23> 16123MB physical memory installed, 13216MB available, 134217727MB virtual memory installed, 18 percent of memory in use
<21:23:23> PageFile usage: 44MB, Working Set: 37MB, Peak PageFile usage: 44MB,
<21:23:23> Current display mode is 1680x1050x32, (Unknown graphics card)
<21:23:23> Japanese keyboard and 5+ button mouse installed
<21:23:23> --------------------------------------------------------------------------------
<21:23:23> Stream Engine Initialization
<21:23:23> GameName: MechWarrior Online (64 bit)
<21:23:23> BuildTime: Jul 21 2015 16:06:24
<21:23:23> Windows Error Reporting is enabled setting exception handler
<21:23:23> Font initialization
<21:23:23> Physics initialization
<21:23:23> Sound initialization
<21:23:23> <Sound> Initializing AudioDevice now!
<21:23:23> <Sound> Initialize FMOD with dynamic memory callbacks
<21:23:23> <Sound> Starting to initialize Windows Audio Session API output!
<21:23:23> <Sound> Playback drivers found: 4
<21:23:23> <Sound> Available playback drivers:
1. Speakers (Realtek High Definition Audio)
2. 1 - HP w2216 (AMD High Definition Audio Device)
3. Realtek Digital Output(Optical) (Realtek High Definition Audio)
4. Realtek Digital Output (Realtek High Definition Audio)
<21:23:23> <Sound> FmodEx-AudioDevice: Now running on driver: Speakers (Realtek High Definition Audio)
<21:23:23> <Sound> Record drivers found: 2
<21:23:23> <Sound> Available record drivers:
1. Microphone (Realtek High Definition Audio)
2. Microphone (Microsoft LifeCam VX-7000.)
<21:23:23> <Sound> Record config is set to autodetect using record driver 0
<21:23:23> <Sound> Using speaker mode: FMOD_SPEAKERMODE_5POINT1
<21:23:23> <Sound> Initializing FMOD-EX now!
<21:23:24> <Sound> Initialized FMOD-EX
<21:23:24> <Sound> Using FMOD version: 00044211 and internal 00044211!
<21:23:24> <Sound> Initializing SoundSystem now!
<21:23:24> Renderer initialization
<21:23:24> [Error] Failed to create stereo device
<21:23:24> used GeomInstancingThreshold is 2
<21:23:24> Localized language content(english) not available or modified from the original installation.
<21:23:24> Localized language content(english) not available or modified from the original installation.
<21:23:24> Network initialization
<21:23:24> [net] using iocp socket io management
<21:23:24> network hostname: Agony
<21:23:24> ip:192.168.1.6
<21:23:24> [Network Version]: RELEASE PURE CLIENT
<21:23:24> MovieSystem initialization
<21:23:24> Console initialization
<21:23:24> Time initialization
<21:23:24> Input initialization
<21:23:25> AI initialization
<21:23:25> Initializing Animation System
<21:23:25> Initializing 3D Engine
<21:23:25> Initializing default materials...
<21:23:25> Script System Initialization
<21:23:25> Entity system initialization
<21:23:25> Initializing AI System
<21:23:26> [PlayerProfiles] Login of user 'RonanFrost' successful.
<21:23:26> [PlayerProfiles] Found 2 profiles.
<21:23:26> Profile 0 : 'RonanFrost'
<21:23:26> Profile 1 : 'default'
<21:23:26> [GameProfiles]: Successfully activated profile 'RonanFrost' for user 'RonanFrost'
<21:23:30> TrackIRManager: DLL Location key not present
<21:23:30> TrackIRManager: Error initializing NPClient interface!! (Err: 4)
<21:23:30> TrackIRManager: Error registering window handle!!
<21:23:30> TrackIRManager: Error querying NaturalPoint software version!!
<21:23:30> TrackIRManager: Error stopping cursor
<21:23:30> TrackIRManager: Error starting data transmission
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(btn_160x44, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(ButtonCommonObject, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(btn_160x44, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(ButtonCommonObject, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(check, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(ButtonCommonObject, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(UINumericStepperTiny, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(UINumericStepperSmall, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(UINumericStepper, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(UINumericStepperTiny, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(UINumericStepperSmall, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:30> [Error] <Flash> Error: Second parameter of Object.registerClass(UINumericStepper, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:23:50> Patch Complete Received
<21:23:50> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:03> sv_gamerules = mechlab []
<21:24:03> ============================ Loading level mechlab ============================
<21:24:06> [Error] Error: CTexMan::ImagePreprocessing: Scaling of 'textures/particles/weapons/laser_beam_1x4_lop0.dds' compressed texture is dangerous (only single mip) [File=textures/particles/weapons/laser_beam_1x4_lop0.dds]
<21:24:06> [Error] Error: CTexMan::ImagePreprocessing: Scaling of 'textures/particles/weapons/ppc_beam_b.dds' compressed texture is dangerous (only single mip) [File=textures/particles/weapons/ppc_beam_b.dds]
<21:24:06> ======== mechlab is loaded in 2.7 sec ========
<21:24:08> Finished IS map update for cycle 833, next update in 5761.000000 seconds
<21:24:25> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:26> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:26> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:26> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Import error: GFxResource 'UILabelCCW' is not exported from movie '.\UILabel.swf' [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:27> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: Second parameter of Object.registerClass(mcColumnHeader, undefined) should be function or null [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: GFxLoader failed to open 'Libs/UI/System\../Screens/Assets/UIWebDownloads/DailyStock.jpg' [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> GFxLoader failed to open "Libs/UI/System\../Screens/Assets/UIWebDownloads/DailyStock.jpg" [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> Error: GFxLoader failed to open 'Libs/UI/System\../Screens/Assets/UIWebDownloads/Stock.jpg' [Libs/UI/System\Main.gfx]
<21:24:28> [Error] <Flash> GFxLoader failed to open "Libs/UI/System\../Screens/Assets/UIWebDownloads/Stock.jpg" [Libs/UI/System\Main.gfx]
<21:24:30> Finished IS map update for cycle 833, next update in 5739.000000 seconds
<21:24:31> Material objects/mechs/skins/pcgamer/awesome_pcgamer not found during Unregister
<21:24:32> could not free all buffers from CDevBufferMan!
<21:24:32> UnLoadLevel End: 0.6 sec
<21:24:35> Game rules class: Conquest
<21:24:35> ============================ PrepareLevel tourmalinedesert ============================
<21:24:36> Initializing default materials...
<21:24:41> [Error] Error: CTexMan::ImagePreprocessing: Scaling of 'objects/environments/skyboxes/forestcolony_clouddome_a.dds' compressed texture is dangerous (only single mip) [File=objects/environments/skyboxes/forestcolony_clouddome_a.dds]
<21:24:41> [Error] Error: CTexMan::ImagePreprocessing: Scaling of 'objects/environments/skyboxes/td_rednebula_dif.dds' compressed texture is dangerous (only single mip) [File=objects/environments/skyboxes/td_rednebula_dif.dds]
<21:24:41> [Error] Error: CTexMan::ImagePreprocessing: Scaling of 'textures/particles/weapons/laser_beam_1x4_lop0.dds' compressed texture is dangerous (only single mip) [File=textures/particles/weapons/laser_beam_1x4_lop0.dds]
<21:24:41> [Error] Error: CTexMan::ImagePreprocessing: Scaling of 'textures/particles/weapons/ppc_beam_b.dds' compressed texture is dangerous (only single mip) [File=textures/particles/weapons/ppc_beam_b.dds]
<21:24:41> [Error] Runaway thread
Shader Name Mech
Shader File Shaders/HWScripts/CryFX/Mech.cfx
Shader Error
D3DXCompileShader failed
Spoiler
Shader Source
float4 WorldLightsPos3:register(c10);
float4 g_PS_SunLightDir:register(c30);
half4 ShadowChanMasks3:register(c11);
half4 SkinColorPrimary:register(c21);
float NumInstructions;
float4 g_PS_ProjRatio:register(c223);
float4 PS_WorldViewPos;
half4 LDiffuses0:register(c0);
float4 g_PS_DepthFactor:register(c222);
half4 SkinColorTertiary:register(c19);
half4 LDiffuses1:register(c3);
half4 g_PS_FogColor:register(c31);
half4 MatEmissiveColor:register(c14);
half4 AlphaTest;
half4 ShadowChanMasks2:register(c8);
float4 DetailParams;
half4 MatSpecColor:register(c13);
float4 WorldLightsPos2:register(c7);
float4 SnowVolumeParams[2];
float4 PS_NearFarClipDist;
float4 ResInfoBump;
half4 g_PS_SunColor:register(c29);
float4x4 matViewProjI;
half4 Ambient:register(c25);
half4 ShadowChanMasks0:register(c2);
float4 WorldLightsPos0:register(c1);
half4 LDiffuses3:register(c9);
float3 CamFrontVector_POM;
half4 g_PS_SkyColor:register(c28);
float4 PS_ScreenSize;
float4 g_PS_NearestScaled:register(c221);
half4 LSpeculars0:register(c3);
half4 AvgFogVolumeContrib;
half4 LDiffuses2:register(c6);
half4 SkinColorSecondary:register(c22);
half4 MatDifColor:register(c12);
float4 WorldLightsPos1:register(c4);
half4 ShadowChanMasks1:register(c5);
float3 __0FresnelScale__1FresnelPower__2FresnelBias__3:register(c15);
float4 __0SpecMapChannelR__1SpecMapChannelG__2SpecMapChannelB__3GlossMapChannelB:register(c18);
float4 __0BlendFactor__1BlendLayer2Tiling__2BlendFalloff__3BlendMaskRotation:register(c20);
struct pixout
{
half4 Color:COLOR0;
};
half4 LGetDiffuse(int nID)
{
return LDiffuses0;
}
float4 LGetPosition(int nID)
{
return WorldLightsPos0;
}
half4 LGetShadowMask(int nID)
{
return ShadowChanMasks0;
}
void ComputeGlobalFogPS(inout half3 cOut,float fDist)
{}
half4 EXPAND(half4 a)
{
return a*2-1;
}
half3 EXPAND(half3 a)
{
return a*2-1;
}
half EXPAND(half a)
{
return a*2-1;
}
half2 EXPAND(half2 a)
{
return a*2-1;
}
half3 GetBumpFromTextureColor(half4 color)
{
half3 bump;
bump.xy=color.xy;
bump.z=1;
return bump;
}
half3 GetNormalMapFromTextureColor(half4 color)
{
half3 normal;
normal.xy=GetBumpFromTextureColor(color).xy;
normal.xy=EXPAND(normal.xy);
normal.z=sqrt(saturate(1.h+dot(normal.xy,-normal.xy)));
return normal;
}
half3 GetNormalMap(sampler2D bumpMap,float2 bumpTC)
{
return GetNormalMapFromTextureColor(tex2D(bumpMap,bumpTC.xy));
}
half3 GetNormalMapGrad(sampler2D bumpMap,float2 bumpTC,float2 ddx_bumpTC,float2 ddy_bumpTC)
{
half3 bumpNormal;
bumpNormal.xy=EXPAND(tex2Dgrad(bumpMap,bumpTC,ddx_bumpTC,ddy_bumpTC).xy);
bumpNormal.z=sqrt(saturate(1-dot(bumpNormal.xy,bumpNormal.xy)));
return bumpNormal;
}
half4 GetTexture2DGrad(sampler2D texSampler,float2 uv,float2 ddxUV,float2 ddyUV)
{
return tex2Dgrad(texSampler,uv,ddxUV,ddyUV);
}
half4 GetTexture2D(sampler2D MapSampler,float2 texTC)
{
half4 texColor=tex2D(MapSampler,texTC.xy);
return texColor;
}
float GetLinearDepth(float fDevDepth,bool bDrawNearAdjust=true,bool bScaled=false)
{
if(bScaled)
{
return fDevDepth*PS_NearFarClipDist.y;
}
return fDevDepth;
}
float GetLinearDepth(sampler2D depthSampler,float2 ScreenTC)
{
float fDepth=tex2D(depthSampler,ScreenTC.xy).x;
return GetLinearDepth(fDepth);
}
float GetLinearDepth_ProjTC(sampler2D depthSampler,float4 ProjTC)
{
float fDepth=tex2Dproj(depthSampler,ProjTC).x;
return GetLinearDepth(fDepth);
}
void ReconstructNormalFromNormalsBuffer(inout half4 vNormal,bool bNormalize)
{
vNormal.xyz=normalize(vNormal.xyz);
}
half4 GetWorldSpaceNormals(half4 vNormals,bool bNormalize)
{
vNormals.xyz=EXPAND(vNormals.xyz);
ReconstructNormalFromNormalsBuffer(vNormals,bNormalize);
return vNormals;
}
half4 GetWorldSpaceNormals(sampler2D smpNormals,float2 tc,bool bNormalize)
{
half4 vNormals=tex2D(smpNormals,tc.xy);
return GetWorldSpaceNormals(vNormals,bNormalize);
}
sampler2D DebugMipColorsDiffuseSampler;
sampler2D DebugMipColorsBumpSampler;
float4 DVColor(float2 d)
{
float Reso=512;
float TargetDeriv=1.0f/Reso;
float HalfTD=(TargetDeriv*0.5);
float TwoTD=(TargetDeriv*2.0);
float4 dd=float4(0,0,0,1);
if(d.x>TwoTD)
{
dd.x=1.0;
}
if(d.y>TwoTD)
{
dd.y=1.0;
}
if(d.x<HalfTD)
{
dd.z=1.0;
}
return(dd);
}
void DebugOutput(out half4 Color,in float4 baseTC)
{
Color=0;
}
int GetShaderQuality()
{
int nQuality;
nQuality=0;
return nQuality;
}
int GetMSAASampleNum()
{
int nSamplesNum=0;
return nSamplesNum;
}
float ComputeTextureLOD(in float2 uv,in float2 texDim)
{
uv*=texDim;
float2 ddx_=ddx(uv);
float2 ddy_=ddy(uv);
float2 mag=abs(ddx_)+abs(ddy_);
float lod=log2(max(mag.x,mag.y));
return lod;
}
float ComputeTextureLOD(in float2 uv,in float2 texDim,out float2 ddx_uv,out float2 ddy_uv)
{
ddx_uv=ddx(uv);
ddy_uv=ddy(uv);
float2 mag=(abs(ddx_uv)+abs(ddy_uv))*texDim;
float lod=log2(max(mag.x,mag.y));
return lod;
}
float2 DecodeSceneUV(in const float uvPacked)
{
return float2(0,0);
}
struct fragPassCustom
{
half3 vTangent;
half3 vBinormal;
half fSpecMultiplier;
half2 vSurfaceRoughness;
};
struct fragLightPassCustom
{};
sampler2D DiffuseMap2Sampler;
sampler2D BumpMap2Sampler;
sampler2D HeightMap2Sampler;
sampler2D BlendMapSampler;
sampler2D CustomizedSkinControlMapSampler;
sampler2D diffuseMapSampler:register(s0);
sampler2D bumpMapSampler:register(s1);
sampler2D bumpHeightMapSampler;
sampler2D projMapSampler;
sampler2D glossMapSampler:register(s2);
sampler2D sceneDepthSampler;
sampler2D diffuseMapSampler_Decal;
sampler2D detailMapSampler;
sampler2D sceneNormalsSampler:register(s12);
sampler2D sceneNormalsBentSampler:register(s14);
sampler2D sceneUVsSampler;
sampler2D sceneDiffuseAccSampler:register(s13);
sampler2D sceneSpecularAccSampler:register(s10);
sampler2D decalsAccSampler:register(s11);
sampler2D sceneSnowMapSampler;
struct fragInput
{
float4 baseTC;
float4 basesectorTC;
float4 bumpTC;
float4 terrainDetailTC;
half4 vTangent;
half4 vBinormal;
half4 vNormal;
half4 vView;
float4 screenProj;
float4 projTC;
half4 Color;
half4 Color1;
float4 VisTerrainCol;
float4 SunRefl;
half4 Ambient;
half4 AlphaTest;
float3 DistAtten;
float4 AvgFogVolumeContrib;
float4 OutdoorAOInfo;
};
struct fragPass
{
fragInput IN;
bool bCustomComposition;
bool bRenormalizeNormal;
bool bForceRenormalizeNormal;
bool bDontUseBump;
bool bDetailBumpMapping;
bool bDetailBumpMappingMasking;
bool bVertexColors;
bool bAlphaGlow;
bool bHemisphereLighting;
bool bDontUseEmissive;
bool bRefractionMap;
bool bSkinIrradiancePass;
bool bDisableInShadowShading;
bool bDisableAlphaTestD3D10;
bool bDeferredSpecularShading;
bool bSkipMaterial;
int nReflectionMapping;
int nMicroDetailQuality;
half fBumpHeightScale;
half fHeightBias;
half fSelfShadowStrength;
half2 vDetailBumpTilling;
half2 vDetailBlendAmount;
half fDetailBumpScale;
half fLod;
half blendFac;
int nQuality;
half3x3 mTangentToWS;
half3 vView;
half3 vNormal;
half3 vNormalDiffuse;
half3 vReflVec;
half3 cBumpMap;
half4 cDiffuseMap;
half4 cGlossMap;
half3 cEnvironment;
half4 cShadowOcclMap;
half4 cSnowMap;
half fNdotE;
half fGloss;
half fAlpha;
half fAlphaTestRef;
half4 cNormalMapRT;
half4 cDiffuseAccRT;
half4 cSpecularAccRT;
half fSceneDepthRT;
half2 vSceneUVsRT;
half fFresnel_Bias;
half fFresnel_Scale;
half fFresnel_Pow;
half fFresnel;
half fAlphaGlow_Multiplier;
half3 cAmbientAcc;
half3 cDiffuseAcc;
half3 cBackDiffuseAcc;
half3 cSpecularAcc;
fragPassCustom pCustom;
};
struct fragLightPass
{
int nType;
half3 cDiffuse;
half3 cSpecular;
half3 cFilter;
half3 vLight;
half fNdotL;
half fFallOff;
half fOcclShadow;
half3 cOut;
fragLightPassCustom pCustom;
};
half GetAttenuation(half3 L,half fInvRadius)
{
half3 vDist=L*fInvRadius;
half fFallOff=saturate(1-dot(vDist,vDist));
return fFallOff;
}
half4 EncodeRGBK(in half4 Color,const half fMultiplier,bool bUsePPP=false)
{
const half4 cScale=half4(half3(1.h,1.h,1.h)/fMultiplier,1.h/255.0);
half fMax=saturate(dot(half4(Color.rgb,1.h),cScale));
Color.a=ceil(fMax*255.h)/255.h;
Color.xyz/=Color.a*fMultiplier;
if(bUsePPP)
{
Color.a=sqrt(Color.a);
}
return Color;
}
half4 DecodeRGBK(in half4 Color,const half fMultiplier,bool bUsePPP=false)
{
if(bUsePPP)
{
Color.rgb*=(Color.a*Color.a)*fMultiplier;
}
else Color.rgb*=Color.a*fMultiplier;
return Color;
}
half4 DecodeLightBuffer(in half4 color)
{
return color;
}
half BlinnBRDF(half3 N,half3 V,half3 L,half Gloss)
{
half3 H=normalize(V+L);
float power=exp2(10.h*Gloss+1.h);
float fNormFactor=power*(1.0/8.0)+(2.0/8.0);
return fNormFactor*pow(saturate(dot(N,H)),power);
}
half GetLayerBlendingValue(in sampler2D blendMapSampler,in float2 uv,in float lod,in half vtxAlpha,in half blendFactor,in half blendFalloff,bool bTerrainLayer=false)
{
half4 blendMap=GetTexture2D(blendMapSampler,uv);
if(bTerrainLayer)blendMap=saturate(saturate(vtxAlpha*2-1)+blendMap.w);
half blendFac=vtxAlpha*blendMap.r*(1+blendFactor);
blendFac=saturate(pow(blendFac,blendFalloff));
return blendFac;
}
void ComputeSnowBlending(inout half3 cDiffuse,in half4 cSnowMap,in half3 cDiffuseMap)
{
if(SnowVolumeParams[0].x)
{
cSnowMap.z=saturate((cSnowMap.z>=1)?cSnowMap.z-1.h:cSnowMap.z);
cSnowMap.x+=cSnowMap.z*saturate(dot(cDiffuseMap.xyz,1)*1.5f);
cDiffuse=lerp(cSnowMap.y,cDiffuse+cSnowMap.x,cSnowMap.w);
}
}
float2 ParallaxOcclusionMap(in float2 baseTC,in float lod,in float3 viewDirNrm,in int numSteps,in float displacement,in float bias,in float blendLayerFactor,in float blendLayer2Tiling)
{
float step=1.0/numSteps;
float bumpScale=displacement;
float2 delta=float2(viewDirNrm.x,viewDirNrm.y)*bumpScale/(-viewDirNrm.z*numSteps);
baseTC-=(1.0-bias)*numSteps*delta;
float4 NB0=tex2D(bumpHeightMapSampler,baseTC);
NB0+=blendLayerFactor*(tex2D(HeightMap2Sampler,baseTC.xy*blendLayer2Tiling)-NB0);
float height=1-step;
float4 offset=float4(baseTC+delta,0,lod);
float4 NB1=tex2D(bumpHeightMapSampler,offset);
NB1+=blendLayerFactor*(tex2D(HeightMap2Sampler,offset.xy*blendLayer2Tiling)-NB1);
for(int i=0;
i<numSteps;
i++)
{[flatten]if(NB1.w>=height)break;
NB0=NB1;
height-=step;
offset.xy+=delta;
NB1=tex2Dlod(bumpHeightMapSampler,offset);
NB1+=blendLayerFactor*(tex2Dlod(HeightMap2Sampler,float4(offset.xy*blendLayer2Tiling,offset.zw))-NB1);
}
float4 offsetBest=offset;
float error=1.0;
float t1=height;
float t0=t1+step;
float delta1=t1-NB1.w;
float delta0=t0-NB0.w;
float4 intersect=float4(delta*numSteps,delta*numSteps+baseTC);
for(int i=0;
i<10;
i++)
{[flatten]if(abs(error)<=0.01)break;
float denom=delta1-delta0;
float t=(t0*delta1-t1*delta0)/denom;
offsetBest.xy=-t*intersect.xy+intersect.zw;
float4 NB=tex2Dlod(bumpHeightMapSampler,offsetBest);
NB+=blendLayerFactor*(tex2Dlod(HeightMap2Sampler,float4(offsetBest.xy*blendLayer2Tiling,offsetBest.zw))-NB);
error=t-NB.w;
if(error<0)
{
delta1=error;
t1=t;
}
else
{
delta0=error;
t0=t;
}
}
return offsetBest.xy;
}
float2 OffsetMap(in float2 baseTC,in half3 viewDirNrm,in int numSteps,in half displacement,in half bias,in half blendLayerFactor,in float blendLayer2Tiling)
{
half offset=-bias*displacement;
float3 newCoords=float3(baseTC,0);
for(int i=0;
i<numSteps;
++i)
{
half nz=GetNormalMap(bumpMapSampler,newCoords.xy).z;
half h=tex2D(bumpHeightMapSampler,newCoords.xy).a;
const float2 newCoords2=newCoords.xy*blendLayer2Tiling;
nz+=blendLayerFactor*(GetNormalMap(BumpMap2Sampler,newCoords2.xy).z-nz);
h+=blendLayerFactor*(tex2D(HeightMap2Sampler,newCoords2.xy).a-h);
half height=h*displacement+offset;
newCoords+=(height-newCoords.z)*nz*viewDirNrm;
}
return newCoords.xy;
}
half4 GetEnvironmentCMap(samplerCUBE envMap,in half3 envTC,in half fGloss)
{
const half numCMapMips=6.0;
half fGlossinessLod=numCMapMips-fGloss*numCMapMips;
half4 envColor=DecodeRGBK(texCUBElod(envMap,half4(envTC,fGlossinessLod)),16);
return envColor;
}
half4 GetEnvironment2DMap(sampler2D envMap,in half2 envTC)
{
half4 envColor=tex2D(envMap,envTC.xy);
return envColor;
}
void HDROutput(out pixout OUT,half4 Color,half fDepth)
{
OUT.Color=Color;
OUT.Color.xyz=1.0f-exp(-OUT.Color.xyz);
OUT.Color.xyz=pow(OUT.Color.xyz,1.0/2.2);
}
float DecodeSceneDepth(sampler2D smpDepth,float4 homogeneousPositionTexProj)
{
float depthNormalized=GetLinearDepth_ProjTC(smpDepth,homogeneousPositionTexProj);
return depthNormalized*PS_NearFarClipDist.y;
}
struct vert2FragGeneral
{
float4 HPosition:POSITION;
float4 baseTC:TEXCOORD0;
float4 vView:TEXCOORD1;
float4 screenProj:TEXCOORD2_centroid;
float4 Color:COLOR0;
};
sampler2D envMapSampler;
samplerCUBE envMapSamplerCUBE;
void frag_unify_parameters(inout fragPass pPass)
{
pPass.bRenormalizeNormal=true;
pPass.bForceRenormalizeNormal=true;
pPass.bHemisphereLighting=true;
pPass.bDisableInShadowShading=true;
pPass.bDeferredSpecularShading=true;
pPass.fFresnel_Bias=__0FresnelScale__1FresnelPower__2FresnelBias__3.z;
pPass.fFresnel_Scale=__0FresnelScale__1FresnelPower__2FresnelBias__3.x;
pPass.fFresnel_Pow=__0FresnelScale__1FresnelPower__2FresnelBias__3.y;
pPass.vDetailBumpTilling=DetailParams.xy;
pPass.bDetailBumpMappingMasking=true;
}
void frag_custom_begin(inout fragPass pPass)
{
float4 baseTC=pPass.IN.baseTC;
float4 bumpTC=pPass.IN.bumpTC;
pPass.cGlossMap=1;
pPass.cGlossMap=GetTexture2D(glossMapSampler,baseTC.xy);
pPass.fGloss*=pPass.cGlossMap.a;
pPass.fGloss*=lerp(1,pPass.cGlossMap.b,__0SpecMapChannelR__1SpecMapChannelG__2SpecMapChannelB__3GlossMapChannelB.w);
half3 cSpecChannels=half3(__0SpecMapChannelR__1SpecMapChannelG__2SpecMapChannelB__3GlossMapChannelB.x,__0SpecMapChannelR__1SpecMapChannelG__2SpecMapChannelB__3GlossMapChannelB.y,__0SpecMapChannelR__1SpecMapChannelG__2SpecMapChannelB__3GlossMapChannelB.z);
half fChannelPicked=saturate(dot(pPass.cGlossMap.rgb,cSpecChannels.rgb));
pPass.cGlossMap.rgb=lerp(pPass.cGlossMap.rgb,fChannelPicked,saturate(dot(cSpecChannels.rgb,1)));
half fAlpha=pPass.cDiffuseMap.a;
if(pPass.bVertexColors)fAlpha*=pPass.IN.Color.w;
else if(pPass.bAlphaGlow)fAlpha=pPass.IN.Color.w;
pPass.fAlpha=fAlpha*pPass.IN.Ambient.w;
half4 skinCustomizationControlMap=GetTexture2D(CustomizedSkinControlMapSampler,baseTC.xy);
float4 blendFactor4=float4(0,0,0,0);
float colorChannelSum=skinCustomizationControlMap.r+skinCustomizationControlMap.g+skinCustomizationControlMap.b;
blendFactor4.w=max(skinCustomizationControlMap.r,max(skinCustomizationControlMap.g,skinCustomizationControlMap.
);
float oneOverColorChaaneSum=1.0f/(colorChannelSum+0.00001f);
blendFactor4.xyz=saturate(skinCustomizationControlMap.rgb*oneOverColorChaaneSum);
half4 skinColor=SkinColorPrimary*blendFactor4.x+SkinColorSecondary*blendFactor4.y+SkinColorTertiary*blendFactor4.z;
pPass.cDiffuseMap=lerp(pPass.cDiffuseMap,skinColor,blendFactor4.w);
half4 diffuseMap2=GetTexture2D(DiffuseMap2Sampler,baseTC.xy*__0BlendFactor__1BlendLayer2Tiling__2BlendFalloff__3BlendMaskRotation.y);
pPass.cDiffuseMap=lerp(pPass.cDiffuseMap,diffuseMap2,pPass.blendFac);
half4 glossMap2=diffuseMap2.a;
pPass.cGlossMap=lerp(pPass.cGlossMap,glossMap2,pPass.blendFac);
}
void frag_custom_per_light(inout fragPass pPass,inout fragLightPass pLight)
{
pLight.fNdotL=saturate(pLight.fNdotL);
half3 cDiffuse=pLight.cDiffuse.xyz*pLight.fNdotL;
half fSpec=BlinnBRDF(pPass.vNormal,pPass.vView,pLight.vLight,pPass.fGloss)*pLight.fNdotL;
half3 cSpecular=pLight.cSpecular.xyz*fSpec;
half3 cK=pLight.fOcclShadow*pLight.fFallOff*pLight.cFilter;
pPass.cDiffuseAcc.xyz+=cDiffuse.xyz*cK.xyz;
pPass.cSpecularAcc.xyz+=cSpecular.xyz*cK.xyz;
}
void frag_custom_ambient(inout fragPass pPass,inout half3 cAmbient)
{
pPass.cAmbientAcc.xyz+=cAmbient.xyz;
}
void frag_custom_end(inout fragPass pPass,inout half3 cFinal)
{}
void frag_unify(inout fragPass pPass,in vert2FragGeneral IN)
{
pPass.nQuality=GetShaderQuality();
pPass.fFresnel_Bias=1.0h;
pPass.fFresnel_Scale=0.0h;
pPass.fFresnel_Pow=4.0h;
pPass.IN.baseTC=IN.baseTC;
pPass.IN.bumpTC=pPass.IN.baseTC;
pPass.IN.Ambient=1.0;
pPass.IN.vTangent=half4(1,0,0,1);
pPass.IN.vBinormal=half4(0,1,0,1);
pPass.IN.vNormal.xyz=half4(0,0,1,1);
pPass.IN.screenProj=IN.screenProj;
pPass.IN.vView=IN.vView;
pPass.IN.Color=IN.Color;
frag_unify_parameters(pPass);
}
void frag_final_composition(inout fragPass pPass,inout half3 cFinal)
{
half3 cDiffuse=pPass.cDiffuseMap.xyz;
if(!pPass.bSkipMaterial)cDiffuse.xyz*=MatDifColor.xyz;
half3 cSpecularCol=MatSpecColor.xyz;
ComputeSnowBlending(cDiffuse,pPass.cSnowMap,pPass.cDiffuseMap.xyz);
if(SnowVolumeParams[0].x)cSpecularCol=lerp(cSpecularCol,0.3f,pPass.cSnowMap.w);
half4 cDecalsMap=tex2Dproj(decalsAccSampler,pPass.IN.screenProj.xyzw);
cDecalsMap.rgb*=cDecalsMap.rgb;
cDiffuse.xyz*=(1.0f-cDecalsMap.w);
cDiffuse.xyz+=cDecalsMap.xyz;
cDiffuse*=(pPass.cAmbientAcc.xyz+pPass.cDiffuseAcc.xyz);
if(pPass.nReflectionMapping)
{
half3 cEnvShading=lerp(1,(pPass.cAmbientAcc.xyz+pPass.cDiffuseAcc.xyz),MatDifColor.w);
pPass.cSpecularAcc.xyz+=pPass.cEnvironment.xyz*cEnvShading;
}
half3 cSpecular=pPass.cSpecularAcc.xyz*pPass.cGlossMap.xyz;
if(!pPass.bSkipMaterial)cSpecular.xyz*=cSpecularCol.xyz;
cSpecular.xyz*=pPass.fFresnel;
cFinal.xyz+=cDiffuse;
cFinal.xyz+=cSpecular;
}
void frag_quality_setup(inout fragPass pPass)
{
pPass.nQuality=GetShaderQuality();
if(pPass.nQuality==0)
{
pPass.bRenormalizeNormal=pPass.bForceRenormalizeNormal;
pPass.nReflectionMapping=false;
pPass.bDetailBumpMapping=false;
}
}
void frag_fog_setup(inout fragPass pPass,inout half4 cOut)
{}
void frag_get_deferred_buffers(inout fragPass pPass)
{
pPass.cShadowOcclMap=0;
float2 tcProj=pPass.IN.screenProj.xy/pPass.IN.screenProj.w;
pPass.fSceneDepthRT=DecodeSceneDepth(sceneDepthSampler,pPass.IN.screenProj.xyww);
pPass.vSceneUVsRT=DecodeSceneUV(tex2Dproj(sceneUVsSampler,pPass.IN.screenProj.xyww).x);
pPass.cNormalMapRT=GetWorldSpaceNormals(tex2Dproj(sceneNormalsSampler,pPass.IN.screenProj.xyzw),true);
pPass.cShadowOcclMap=pPass.cNormalMapRT.w;
}
void frag_hdr_setup(inout fragPass pPass,inout half4 cOut)
{
if(!pPass.bSkinIrradiancePass)cOut.xyz*=g_PS_SunLightDir.w;
}
void frag_ambient(inout fragPass pPass,half3 vNormal)
{}
half GetBlendedHeight(float2 uv,half blendLayerFactor,in float blendLayer2Tiling)
{
half h=tex2D(bumpHeightMapSampler,uv).w;
h+=blendLayerFactor*(tex2D(HeightMap2Sampler,uv*blendLayer2Tiling).w-h);
return h;
}
half4 frag_shared_output(inout fragPass pPass)
{
half4 cOut=0;
frag_quality_setup(pPass);
frag_get_deferred_buffers(pPass);
const float2 microDetailBaseTC=pPass.IN.baseTC.xy;
const float dispAmount=pPass.fBumpHeightScale;
float blendLayer2Tiling=0;
pPass.blendFac=GetLayerBlendingValue(BlendMapSampler,microDetailBaseTC,0,pPass.IN.Color.a,__0BlendFactor__1BlendLayer2Tiling__2BlendFalloff__3BlendMaskRotation.x,__0BlendFactor__1BlendLayer2Tiling__2BlendFalloff__3BlendMaskRotation.z);
blendLayer2Tiling=__0BlendFactor__1BlendLayer2Tiling__2BlendFalloff__3BlendMaskRotation.y;
pPass.vView=normalize(-pPass.IN.vView.xyz);
pPass.mTangentToWS=float3x3(pPass.IN.vTangent.xyz,pPass.IN.vBinormal.xyz,pPass.IN.vNormal.xyz);
if(pPass.nMicroDetailQuality==1)
{
const half3 viewDir=mul(pPass.mTangentToWS,pPass.vView);
const float2 newCoords=OffsetMap(microDetailBaseTC,viewDir,2,dispAmount,pPass.fHeightBias,pPass.blendFac,blendLayer2Tiling);
pPass.IN.baseTC.xy=newCoords;
pPass.IN.bumpTC.xy=newCoords;
}
if(pPass.nMicroDetailQuality==2)
{
float2 ddxMicroDetailBaseTC,ddyMicroDetailBaseTC;
float lod=ComputeTextureLOD(microDetailBaseTC,ResInfoBump.xy,ddxMicroDetailBaseTC,ddyMicroDetailBaseTC);
if(pPass.nMicroDetailQuality==2)
{
const float3 viewDirWS=pPass.IN.vView.xyz;
const float3 parallax=mul(pPass.mTangentToWS,pPass.vView).xyz;
const float sceneDepth=pPass.fSceneDepthRT;
const float scale=sceneDepth-dot(viewDirWS,-CamFrontVector_POM);
const float2 offset=normalize(parallax.xy/-parallax.z)*scale*0.25;
pPass.IN.baseTC.xy=microDetailBaseTC+offset.xy;
pPass.IN.bumpTC.xy=microDetailBaseTC+offset.xy;
}
else
{
const float2 sceneUVs=pPass.vSceneUVsRT;
pPass.IN.baseTC.xy=sceneUVs;
pPass.IN.bumpTC.xy=sceneUVs;
}
if(pPass.nMicroDetailQuality==2)
{
pPass.cDiffuseMap=GetTexture2DGrad(diffuseMapSampler,pPass.IN.baseTC.xy,ddxMicroDetailBaseTC,ddyMicroDetailBaseTC);
if(!pPass.bDontUseBump)pPass.cBumpMap.xyz=GetNormalMapGrad(bumpMapSampler,pPass.IN.bumpTC.xy,ddxMicroDetailBaseTC,ddyMicroDetailBaseTC);
else pPass.cBumpMap=half3(0,0,1);
}
else
{
pPass.cDiffuseMap=tex2Dlod(diffuseMapSampler,float4(pPass.IN.baseTC.xy,0,0));
}
}
else
{
pPass.cDiffuseMap=tex2D(diffuseMapSampler,pPass.IN.baseTC.xy);
if(!pPass.bDontUseBump)pPass.cBumpMap=GetNormalMap(bumpMapSampler,pPass.IN.bumpTC.xy);
else pPass.cBumpMap=half3(0,0,1);
}
pPass.vNormalDiffuse=pPass.cBumpMap;
half2 vDetailTC=pPass.vDetailBumpTilling*pPass.IN.baseTC.xy;
half4 cDetailMap=tex2D(detailMapSampler,vDetailTC);
if(pPass.bDetailBumpMapping)
{
if(pPass.bDetailBumpMappingMasking)
{
pPass.fDetailBumpScale*=pPass.cDiffuseMap.w;
pPass.vDetailBlendAmount*=pPass.cDiffuseMap.w;
}
half2 vDetailN=EXPAND(cDetailMap).xy;
pPass.cBumpMap.xy+=vDetailN.xy*pPass.fDetailBumpScale;
}
pPass.fAlpha=pPass.cDiffuseMap.w*pPass.IN.Ambient.w;
pPass.vNormal.xyz=pPass.cNormalMapRT.xyz;
pPass.fNdotE=(dot(pPass.vView.xyz,pPass.vNormal.xyz));
pPass.fGloss=MatSpecColor.w;
pPass.vReflVec=(2.0h*pPass.fNdotE*pPass.vNormal.xyz)-pPass.vView.xyz;
pPass.fFresnel=pPass.fFresnel_Bias+pPass.fFresnel_Scale*pow(1.001h-saturate(pPass.fNdotE),pPass.fFresnel_Pow);
frag_custom_begin(pPass);
if(SnowVolumeParams[0].x)
{
pPass.cSnowMap=tex2Dlod(sceneSnowMapSampler,half4(pPass.IN.screenProj.xy/pPass.IN.screenProj.w,0,0));
pPass.fGloss=lerp(pPass.fGloss,0.3f,pPass.cSnowMap.w);
}
if(pPass.bDetailBumpMapping)
{
half2 vBlendAmount=lerp(0.5,cDetailMap.zw,pPass.vDetailBlendAmount)*2.0;
pPass.cDiffuseMap.xyz*=vBlendAmount.x;
pPass.cGlossMap.xyz*=vBlendAmount.y;
}
else
{
half fLerp=length(pPass.IN.vView.xyz/DetailParams.w/0.8);
if(pPass.bDetailBumpMappingMasking)
{
fLerp/=pPass.cDiffuseMap.w+0.001;
}
half3 detColor=lerp(cDetailMap.xyz,0.5,saturate(fLerp));
pPass.cDiffuseMap.xyz*=2*detColor;
}
if(pPass.nReflectionMapping>0)
{
if(pPass.nReflectionMapping==1)
{
pPass.cEnvironment=GetEnvironmentCMap(envMapSamplerCUBE,pPass.vReflVec.xyz,pPass.fGloss).xyz;
}
else if(pPass.nReflectionMapping==2)
{
pPass.cEnvironment=GetEnvironment2DMap(envMapSampler,pPass.vReflVec.xy);
}
}
half3 vAmbientNormal=pPass.vNormal.xyz;
const int aLType[4]=
{
0,0,0,0};
for(int i=0;
i<1;
i++)
{
int nType=aLType[i];
float4 WorldLightPos=LGetPosition(i);
half4 Diffuse=LGetDiffuse(i);
half4 Specular;
Specular=Diffuse;
Specular.xyz*=Diffuse.w;
half fOcclShadow;
if(nType==0)
{
WorldLightPos=g_PS_SunLightDir;
fOcclShadow=1.h-pPass.cNormalMapRT.w;
}
else
{
half4 ShadowChanMask=LGetShadowMask(i);
fOcclShadow=saturate(1-dot(pPass.cShadowOcclMap,ShadowChanMask));
}
half fFallOff=1;
float3 vLight,vLightWS;
if(nType==0)
{
vLightWS=WorldLightPos.xyz*10000.0f;
vLight=WorldLightPos.xyz;
}
else
{
vLightWS=WorldLightPos.xyz-pPass.IN.vView.xyz;
vLight=normalize(vLightWS.xyz);
fFallOff=GetAttenuation(vLightWS.xyz,WorldLightPos.w);
}
if(pPass.nMicroDetailQuality==2||pPass.nMicroDetailQuality==1)
{
float3 light=mul(pPass.mTangentToWS,vLight.xyz);
float2 lightDelta=float2(light.x,light.y)*pPass.fBumpHeightScale;
float h0=GetBlendedHeight(pPass.IN.bumpTC.xy,pPass.blendFac,blendLayer2Tiling);
float h=h0;
if(pPass.nMicroDetailQuality==2)
{
h=max(0,GetBlendedHeight(pPass.IN.bumpTC.xy+1.000*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.875*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.750*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.625*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.500*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.375*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.250*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.125*lightDelta,pPass.blendFac,blendLayer2Tiling));
}
else
{
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+1.000*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.666*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.333*lightDelta,pPass.blendFac,blendLayer2Tiling));
}
float soften=pPass.fSelfShadowStrength;
if(SnowVolumeParams[0].x)soften*=pPass.cSnowMap.w;
float shadow=1-saturate((h-h0)*soften);
fOcclShadow*=shadow;
}
half3 filterColor=1;
half fNdotL=dot(vLight.xyz,pPass.vNormal.xyz);
half4 occlusionTex=tex2Dproj(sceneNormalsBentSampler,pPass.IN.screenProj.xyzw);
occlusionTex.xyz=(occlusionTex.xyz*2.h-1.h)*half3(0.48860,0.48860,0.48860);
half fOcclusion=1.h-saturate(dot(half4(vLight.xyz,0.28209),occlusionTex)*AlphaTest.z);
fNdotL*=fOcclusion;
fragLightPass pLight=(fragLightPass)0;
pLight.nType=nType;
pLight.cDiffuse=Diffuse.xyz;
pLight.cSpecular=Specular.xyz;
pLight.vLight=vLight;
pLight.fNdotL=fNdotL;
pLight.fOcclShadow=fOcclShadow;
pLight.fFallOff=fFallOff;
pLight.cFilter=filterColor;
frag_custom_per_light(pPass,pLight);
cOut.xyz+=pLight.cOut.xyz;
}
frag_ambient(pPass,vAmbientNormal);
if(pPass.bCustomComposition==false)
{
frag_final_composition(pPass,cOut.xyz);
}
frag_custom_end(pPass,cOut.xyz);
if(pPass.bVertexColors)
{
cOut.xyz*=pPass.IN.Color.xyz;
}
cOut.w=pPass.fAlpha;
frag_fog_setup(pPass,cOut);
frag_hdr_setup(pPass,cOut);
return cOut;
}
pixout MechPS(vert2FragGeneral IN)
{
pixout OUT=(pixout)0;
fragPass pPass=(fragPass)0;
frag_unify(pPass,IN);
half4 cFinal=frag_shared_output(pPass);
HDROutput(OUT,cFinal,1);
return OUT;
}
Shader Source
float4 WorldLightsPos3:register(c10);
float4 g_PS_SunLightDir:register(c30);
half4 ShadowChanMasks3:register(c11);
half4 SkinColorPrimary:register(c21);
float NumInstructions;
float4 g_PS_ProjRatio:register(c223);
float4 PS_WorldViewPos;
half4 LDiffuses0:register(c0);
float4 g_PS_DepthFactor:register(c222);
half4 SkinColorTertiary:register(c19);
half4 LDiffuses1:register(c3);
half4 g_PS_FogColor:register(c31);
half4 MatEmissiveColor:register(c14);
half4 AlphaTest;
half4 ShadowChanMasks2:register(c8);
float4 DetailParams;
half4 MatSpecColor:register(c13);
float4 WorldLightsPos2:register(c7);
float4 SnowVolumeParams[2];
float4 PS_NearFarClipDist;
float4 ResInfoBump;
half4 g_PS_SunColor:register(c29);
float4x4 matViewProjI;
half4 Ambient:register(c25);
half4 ShadowChanMasks0:register(c2);
float4 WorldLightsPos0:register(c1);
half4 LDiffuses3:register(c9);
float3 CamFrontVector_POM;
half4 g_PS_SkyColor:register(c28);
float4 PS_ScreenSize;
float4 g_PS_NearestScaled:register(c221);
half4 LSpeculars0:register(c3);
half4 AvgFogVolumeContrib;
half4 LDiffuses2:register(c6);
half4 SkinColorSecondary:register(c22);
half4 MatDifColor:register(c12);
float4 WorldLightsPos1:register(c4);
half4 ShadowChanMasks1:register(c5);
float3 __0FresnelScale__1FresnelPower__2FresnelBias__3:register(c15);
float4 __0SpecMapChannelR__1SpecMapChannelG__2SpecMapChannelB__3GlossMapChannelB:register(c18);
float4 __0BlendFactor__1BlendLayer2Tiling__2BlendFalloff__3BlendMaskRotation:register(c20);
struct pixout
{
half4 Color:COLOR0;
};
half4 LGetDiffuse(int nID)
{
return LDiffuses0;
}
float4 LGetPosition(int nID)
{
return WorldLightsPos0;
}
half4 LGetShadowMask(int nID)
{
return ShadowChanMasks0;
}
void ComputeGlobalFogPS(inout half3 cOut,float fDist)
{}
half4 EXPAND(half4 a)
{
return a*2-1;
}
half3 EXPAND(half3 a)
{
return a*2-1;
}
half EXPAND(half a)
{
return a*2-1;
}
half2 EXPAND(half2 a)
{
return a*2-1;
}
half3 GetBumpFromTextureColor(half4 color)
{
half3 bump;
bump.xy=color.xy;
bump.z=1;
return bump;
}
half3 GetNormalMapFromTextureColor(half4 color)
{
half3 normal;
normal.xy=GetBumpFromTextureColor(color).xy;
normal.xy=EXPAND(normal.xy);
normal.z=sqrt(saturate(1.h+dot(normal.xy,-normal.xy)));
return normal;
}
half3 GetNormalMap(sampler2D bumpMap,float2 bumpTC)
{
return GetNormalMapFromTextureColor(tex2D(bumpMap,bumpTC.xy));
}
half3 GetNormalMapGrad(sampler2D bumpMap,float2 bumpTC,float2 ddx_bumpTC,float2 ddy_bumpTC)
{
half3 bumpNormal;
bumpNormal.xy=EXPAND(tex2Dgrad(bumpMap,bumpTC,ddx_bumpTC,ddy_bumpTC).xy);
bumpNormal.z=sqrt(saturate(1-dot(bumpNormal.xy,bumpNormal.xy)));
return bumpNormal;
}
half4 GetTexture2DGrad(sampler2D texSampler,float2 uv,float2 ddxUV,float2 ddyUV)
{
return tex2Dgrad(texSampler,uv,ddxUV,ddyUV);
}
half4 GetTexture2D(sampler2D MapSampler,float2 texTC)
{
half4 texColor=tex2D(MapSampler,texTC.xy);
return texColor;
}
float GetLinearDepth(float fDevDepth,bool bDrawNearAdjust=true,bool bScaled=false)
{
if(bScaled)
{
return fDevDepth*PS_NearFarClipDist.y;
}
return fDevDepth;
}
float GetLinearDepth(sampler2D depthSampler,float2 ScreenTC)
{
float fDepth=tex2D(depthSampler,ScreenTC.xy).x;
return GetLinearDepth(fDepth);
}
float GetLinearDepth_ProjTC(sampler2D depthSampler,float4 ProjTC)
{
float fDepth=tex2Dproj(depthSampler,ProjTC).x;
return GetLinearDepth(fDepth);
}
void ReconstructNormalFromNormalsBuffer(inout half4 vNormal,bool bNormalize)
{
vNormal.xyz=normalize(vNormal.xyz);
}
half4 GetWorldSpaceNormals(half4 vNormals,bool bNormalize)
{
vNormals.xyz=EXPAND(vNormals.xyz);
ReconstructNormalFromNormalsBuffer(vNormals,bNormalize);
return vNormals;
}
half4 GetWorldSpaceNormals(sampler2D smpNormals,float2 tc,bool bNormalize)
{
half4 vNormals=tex2D(smpNormals,tc.xy);
return GetWorldSpaceNormals(vNormals,bNormalize);
}
sampler2D DebugMipColorsDiffuseSampler;
sampler2D DebugMipColorsBumpSampler;
float4 DVColor(float2 d)
{
float Reso=512;
float TargetDeriv=1.0f/Reso;
float HalfTD=(TargetDeriv*0.5);
float TwoTD=(TargetDeriv*2.0);
float4 dd=float4(0,0,0,1);
if(d.x>TwoTD)
{
dd.x=1.0;
}
if(d.y>TwoTD)
{
dd.y=1.0;
}
if(d.x<HalfTD)
{
dd.z=1.0;
}
return(dd);
}
void DebugOutput(out half4 Color,in float4 baseTC)
{
Color=0;
}
int GetShaderQuality()
{
int nQuality;
nQuality=0;
return nQuality;
}
int GetMSAASampleNum()
{
int nSamplesNum=0;
return nSamplesNum;
}
float ComputeTextureLOD(in float2 uv,in float2 texDim)
{
uv*=texDim;
float2 ddx_=ddx(uv);
float2 ddy_=ddy(uv);
float2 mag=abs(ddx_)+abs(ddy_);
float lod=log2(max(mag.x,mag.y));
return lod;
}
float ComputeTextureLOD(in float2 uv,in float2 texDim,out float2 ddx_uv,out float2 ddy_uv)
{
ddx_uv=ddx(uv);
ddy_uv=ddy(uv);
float2 mag=(abs(ddx_uv)+abs(ddy_uv))*texDim;
float lod=log2(max(mag.x,mag.y));
return lod;
}
float2 DecodeSceneUV(in const float uvPacked)
{
return float2(0,0);
}
struct fragPassCustom
{
half3 vTangent;
half3 vBinormal;
half fSpecMultiplier;
half2 vSurfaceRoughness;
};
struct fragLightPassCustom
{};
sampler2D DiffuseMap2Sampler;
sampler2D BumpMap2Sampler;
sampler2D HeightMap2Sampler;
sampler2D BlendMapSampler;
sampler2D CustomizedSkinControlMapSampler;
sampler2D diffuseMapSampler:register(s0);
sampler2D bumpMapSampler:register(s1);
sampler2D bumpHeightMapSampler;
sampler2D projMapSampler;
sampler2D glossMapSampler:register(s2);
sampler2D sceneDepthSampler;
sampler2D diffuseMapSampler_Decal;
sampler2D detailMapSampler;
sampler2D sceneNormalsSampler:register(s12);
sampler2D sceneNormalsBentSampler:register(s14);
sampler2D sceneUVsSampler;
sampler2D sceneDiffuseAccSampler:register(s13);
sampler2D sceneSpecularAccSampler:register(s10);
sampler2D decalsAccSampler:register(s11);
sampler2D sceneSnowMapSampler;
struct fragInput
{
float4 baseTC;
float4 basesectorTC;
float4 bumpTC;
float4 terrainDetailTC;
half4 vTangent;
half4 vBinormal;
half4 vNormal;
half4 vView;
float4 screenProj;
float4 projTC;
half4 Color;
half4 Color1;
float4 VisTerrainCol;
float4 SunRefl;
half4 Ambient;
half4 AlphaTest;
float3 DistAtten;
float4 AvgFogVolumeContrib;
float4 OutdoorAOInfo;
};
struct fragPass
{
fragInput IN;
bool bCustomComposition;
bool bRenormalizeNormal;
bool bForceRenormalizeNormal;
bool bDontUseBump;
bool bDetailBumpMapping;
bool bDetailBumpMappingMasking;
bool bVertexColors;
bool bAlphaGlow;
bool bHemisphereLighting;
bool bDontUseEmissive;
bool bRefractionMap;
bool bSkinIrradiancePass;
bool bDisableInShadowShading;
bool bDisableAlphaTestD3D10;
bool bDeferredSpecularShading;
bool bSkipMaterial;
int nReflectionMapping;
int nMicroDetailQuality;
half fBumpHeightScale;
half fHeightBias;
half fSelfShadowStrength;
half2 vDetailBumpTilling;
half2 vDetailBlendAmount;
half fDetailBumpScale;
half fLod;
half blendFac;
int nQuality;
half3x3 mTangentToWS;
half3 vView;
half3 vNormal;
half3 vNormalDiffuse;
half3 vReflVec;
half3 cBumpMap;
half4 cDiffuseMap;
half4 cGlossMap;
half3 cEnvironment;
half4 cShadowOcclMap;
half4 cSnowMap;
half fNdotE;
half fGloss;
half fAlpha;
half fAlphaTestRef;
half4 cNormalMapRT;
half4 cDiffuseAccRT;
half4 cSpecularAccRT;
half fSceneDepthRT;
half2 vSceneUVsRT;
half fFresnel_Bias;
half fFresnel_Scale;
half fFresnel_Pow;
half fFresnel;
half fAlphaGlow_Multiplier;
half3 cAmbientAcc;
half3 cDiffuseAcc;
half3 cBackDiffuseAcc;
half3 cSpecularAcc;
fragPassCustom pCustom;
};
struct fragLightPass
{
int nType;
half3 cDiffuse;
half3 cSpecular;
half3 cFilter;
half3 vLight;
half fNdotL;
half fFallOff;
half fOcclShadow;
half3 cOut;
fragLightPassCustom pCustom;
};
half GetAttenuation(half3 L,half fInvRadius)
{
half3 vDist=L*fInvRadius;
half fFallOff=saturate(1-dot(vDist,vDist));
return fFallOff;
}
half4 EncodeRGBK(in half4 Color,const half fMultiplier,bool bUsePPP=false)
{
const half4 cScale=half4(half3(1.h,1.h,1.h)/fMultiplier,1.h/255.0);
half fMax=saturate(dot(half4(Color.rgb,1.h),cScale));
Color.a=ceil(fMax*255.h)/255.h;
Color.xyz/=Color.a*fMultiplier;
if(bUsePPP)
{
Color.a=sqrt(Color.a);
}
return Color;
}
half4 DecodeRGBK(in half4 Color,const half fMultiplier,bool bUsePPP=false)
{
if(bUsePPP)
{
Color.rgb*=(Color.a*Color.a)*fMultiplier;
}
else Color.rgb*=Color.a*fMultiplier;
return Color;
}
half4 DecodeLightBuffer(in half4 color)
{
return color;
}
half BlinnBRDF(half3 N,half3 V,half3 L,half Gloss)
{
half3 H=normalize(V+L);
float power=exp2(10.h*Gloss+1.h);
float fNormFactor=power*(1.0/8.0)+(2.0/8.0);
return fNormFactor*pow(saturate(dot(N,H)),power);
}
half GetLayerBlendingValue(in sampler2D blendMapSampler,in float2 uv,in float lod,in half vtxAlpha,in half blendFactor,in half blendFalloff,bool bTerrainLayer=false)
{
half4 blendMap=GetTexture2D(blendMapSampler,uv);
if(bTerrainLayer)blendMap=saturate(saturate(vtxAlpha*2-1)+blendMap.w);
half blendFac=vtxAlpha*blendMap.r*(1+blendFactor);
blendFac=saturate(pow(blendFac,blendFalloff));
return blendFac;
}
void ComputeSnowBlending(inout half3 cDiffuse,in half4 cSnowMap,in half3 cDiffuseMap)
{
if(SnowVolumeParams[0].x)
{
cSnowMap.z=saturate((cSnowMap.z>=1)?cSnowMap.z-1.h:cSnowMap.z);
cSnowMap.x+=cSnowMap.z*saturate(dot(cDiffuseMap.xyz,1)*1.5f);
cDiffuse=lerp(cSnowMap.y,cDiffuse+cSnowMap.x,cSnowMap.w);
}
}
float2 ParallaxOcclusionMap(in float2 baseTC,in float lod,in float3 viewDirNrm,in int numSteps,in float displacement,in float bias,in float blendLayerFactor,in float blendLayer2Tiling)
{
float step=1.0/numSteps;
float bumpScale=displacement;
float2 delta=float2(viewDirNrm.x,viewDirNrm.y)*bumpScale/(-viewDirNrm.z*numSteps);
baseTC-=(1.0-bias)*numSteps*delta;
float4 NB0=tex2D(bumpHeightMapSampler,baseTC);
NB0+=blendLayerFactor*(tex2D(HeightMap2Sampler,baseTC.xy*blendLayer2Tiling)-NB0);
float height=1-step;
float4 offset=float4(baseTC+delta,0,lod);
float4 NB1=tex2D(bumpHeightMapSampler,offset);
NB1+=blendLayerFactor*(tex2D(HeightMap2Sampler,offset.xy*blendLayer2Tiling)-NB1);
for(int i=0;
i<numSteps;
i++)
{[flatten]if(NB1.w>=height)break;
NB0=NB1;
height-=step;
offset.xy+=delta;
NB1=tex2Dlod(bumpHeightMapSampler,offset);
NB1+=blendLayerFactor*(tex2Dlod(HeightMap2Sampler,float4(offset.xy*blendLayer2Tiling,offset.zw))-NB1);
}
float4 offsetBest=offset;
float error=1.0;
float t1=height;
float t0=t1+step;
float delta1=t1-NB1.w;
float delta0=t0-NB0.w;
float4 intersect=float4(delta*numSteps,delta*numSteps+baseTC);
for(int i=0;
i<10;
i++)
{[flatten]if(abs(error)<=0.01)break;
float denom=delta1-delta0;
float t=(t0*delta1-t1*delta0)/denom;
offsetBest.xy=-t*intersect.xy+intersect.zw;
float4 NB=tex2Dlod(bumpHeightMapSampler,offsetBest);
NB+=blendLayerFactor*(tex2Dlod(HeightMap2Sampler,float4(offsetBest.xy*blendLayer2Tiling,offsetBest.zw))-NB);
error=t-NB.w;
if(error<0)
{
delta1=error;
t1=t;
}
else
{
delta0=error;
t0=t;
}
}
return offsetBest.xy;
}
float2 OffsetMap(in float2 baseTC,in half3 viewDirNrm,in int numSteps,in half displacement,in half bias,in half blendLayerFactor,in float blendLayer2Tiling)
{
half offset=-bias*displacement;
float3 newCoords=float3(baseTC,0);
for(int i=0;
i<numSteps;
++i)
{
half nz=GetNormalMap(bumpMapSampler,newCoords.xy).z;
half h=tex2D(bumpHeightMapSampler,newCoords.xy).a;
const float2 newCoords2=newCoords.xy*blendLayer2Tiling;
nz+=blendLayerFactor*(GetNormalMap(BumpMap2Sampler,newCoords2.xy).z-nz);
h+=blendLayerFactor*(tex2D(HeightMap2Sampler,newCoords2.xy).a-h);
half height=h*displacement+offset;
newCoords+=(height-newCoords.z)*nz*viewDirNrm;
}
return newCoords.xy;
}
half4 GetEnvironmentCMap(samplerCUBE envMap,in half3 envTC,in half fGloss)
{
const half numCMapMips=6.0;
half fGlossinessLod=numCMapMips-fGloss*numCMapMips;
half4 envColor=DecodeRGBK(texCUBElod(envMap,half4(envTC,fGlossinessLod)),16);
return envColor;
}
half4 GetEnvironment2DMap(sampler2D envMap,in half2 envTC)
{
half4 envColor=tex2D(envMap,envTC.xy);
return envColor;
}
void HDROutput(out pixout OUT,half4 Color,half fDepth)
{
OUT.Color=Color;
OUT.Color.xyz=1.0f-exp(-OUT.Color.xyz);
OUT.Color.xyz=pow(OUT.Color.xyz,1.0/2.2);
}
float DecodeSceneDepth(sampler2D smpDepth,float4 homogeneousPositionTexProj)
{
float depthNormalized=GetLinearDepth_ProjTC(smpDepth,homogeneousPositionTexProj);
return depthNormalized*PS_NearFarClipDist.y;
}
struct vert2FragGeneral
{
float4 HPosition:POSITION;
float4 baseTC:TEXCOORD0;
float4 vView:TEXCOORD1;
float4 screenProj:TEXCOORD2_centroid;
float4 Color:COLOR0;
};
sampler2D envMapSampler;
samplerCUBE envMapSamplerCUBE;
void frag_unify_parameters(inout fragPass pPass)
{
pPass.bRenormalizeNormal=true;
pPass.bForceRenormalizeNormal=true;
pPass.bHemisphereLighting=true;
pPass.bDisableInShadowShading=true;
pPass.bDeferredSpecularShading=true;
pPass.fFresnel_Bias=__0FresnelScale__1FresnelPower__2FresnelBias__3.z;
pPass.fFresnel_Scale=__0FresnelScale__1FresnelPower__2FresnelBias__3.x;
pPass.fFresnel_Pow=__0FresnelScale__1FresnelPower__2FresnelBias__3.y;
pPass.vDetailBumpTilling=DetailParams.xy;
pPass.bDetailBumpMappingMasking=true;
}
void frag_custom_begin(inout fragPass pPass)
{
float4 baseTC=pPass.IN.baseTC;
float4 bumpTC=pPass.IN.bumpTC;
pPass.cGlossMap=1;
pPass.cGlossMap=GetTexture2D(glossMapSampler,baseTC.xy);
pPass.fGloss*=pPass.cGlossMap.a;
pPass.fGloss*=lerp(1,pPass.cGlossMap.b,__0SpecMapChannelR__1SpecMapChannelG__2SpecMapChannelB__3GlossMapChannelB.w);
half3 cSpecChannels=half3(__0SpecMapChannelR__1SpecMapChannelG__2SpecMapChannelB__3GlossMapChannelB.x,__0SpecMapChannelR__1SpecMapChannelG__2SpecMapChannelB__3GlossMapChannelB.y,__0SpecMapChannelR__1SpecMapChannelG__2SpecMapChannelB__3GlossMapChannelB.z);
half fChannelPicked=saturate(dot(pPass.cGlossMap.rgb,cSpecChannels.rgb));
pPass.cGlossMap.rgb=lerp(pPass.cGlossMap.rgb,fChannelPicked,saturate(dot(cSpecChannels.rgb,1)));
half fAlpha=pPass.cDiffuseMap.a;
if(pPass.bVertexColors)fAlpha*=pPass.IN.Color.w;
else if(pPass.bAlphaGlow)fAlpha=pPass.IN.Color.w;
pPass.fAlpha=fAlpha*pPass.IN.Ambient.w;
half4 skinCustomizationControlMap=GetTexture2D(CustomizedSkinControlMapSampler,baseTC.xy);
float4 blendFactor4=float4(0,0,0,0);
float colorChannelSum=skinCustomizationControlMap.r+skinCustomizationControlMap.g+skinCustomizationControlMap.b;
blendFactor4.w=max(skinCustomizationControlMap.r,max(skinCustomizationControlMap.g,skinCustomizationControlMap.

float oneOverColorChaaneSum=1.0f/(colorChannelSum+0.00001f);
blendFactor4.xyz=saturate(skinCustomizationControlMap.rgb*oneOverColorChaaneSum);
half4 skinColor=SkinColorPrimary*blendFactor4.x+SkinColorSecondary*blendFactor4.y+SkinColorTertiary*blendFactor4.z;
pPass.cDiffuseMap=lerp(pPass.cDiffuseMap,skinColor,blendFactor4.w);
half4 diffuseMap2=GetTexture2D(DiffuseMap2Sampler,baseTC.xy*__0BlendFactor__1BlendLayer2Tiling__2BlendFalloff__3BlendMaskRotation.y);
pPass.cDiffuseMap=lerp(pPass.cDiffuseMap,diffuseMap2,pPass.blendFac);
half4 glossMap2=diffuseMap2.a;
pPass.cGlossMap=lerp(pPass.cGlossMap,glossMap2,pPass.blendFac);
}
void frag_custom_per_light(inout fragPass pPass,inout fragLightPass pLight)
{
pLight.fNdotL=saturate(pLight.fNdotL);
half3 cDiffuse=pLight.cDiffuse.xyz*pLight.fNdotL;
half fSpec=BlinnBRDF(pPass.vNormal,pPass.vView,pLight.vLight,pPass.fGloss)*pLight.fNdotL;
half3 cSpecular=pLight.cSpecular.xyz*fSpec;
half3 cK=pLight.fOcclShadow*pLight.fFallOff*pLight.cFilter;
pPass.cDiffuseAcc.xyz+=cDiffuse.xyz*cK.xyz;
pPass.cSpecularAcc.xyz+=cSpecular.xyz*cK.xyz;
}
void frag_custom_ambient(inout fragPass pPass,inout half3 cAmbient)
{
pPass.cAmbientAcc.xyz+=cAmbient.xyz;
}
void frag_custom_end(inout fragPass pPass,inout half3 cFinal)
{}
void frag_unify(inout fragPass pPass,in vert2FragGeneral IN)
{
pPass.nQuality=GetShaderQuality();
pPass.fFresnel_Bias=1.0h;
pPass.fFresnel_Scale=0.0h;
pPass.fFresnel_Pow=4.0h;
pPass.IN.baseTC=IN.baseTC;
pPass.IN.bumpTC=pPass.IN.baseTC;
pPass.IN.Ambient=1.0;
pPass.IN.vTangent=half4(1,0,0,1);
pPass.IN.vBinormal=half4(0,1,0,1);
pPass.IN.vNormal.xyz=half4(0,0,1,1);
pPass.IN.screenProj=IN.screenProj;
pPass.IN.vView=IN.vView;
pPass.IN.Color=IN.Color;
frag_unify_parameters(pPass);
}
void frag_final_composition(inout fragPass pPass,inout half3 cFinal)
{
half3 cDiffuse=pPass.cDiffuseMap.xyz;
if(!pPass.bSkipMaterial)cDiffuse.xyz*=MatDifColor.xyz;
half3 cSpecularCol=MatSpecColor.xyz;
ComputeSnowBlending(cDiffuse,pPass.cSnowMap,pPass.cDiffuseMap.xyz);
if(SnowVolumeParams[0].x)cSpecularCol=lerp(cSpecularCol,0.3f,pPass.cSnowMap.w);
half4 cDecalsMap=tex2Dproj(decalsAccSampler,pPass.IN.screenProj.xyzw);
cDecalsMap.rgb*=cDecalsMap.rgb;
cDiffuse.xyz*=(1.0f-cDecalsMap.w);
cDiffuse.xyz+=cDecalsMap.xyz;
cDiffuse*=(pPass.cAmbientAcc.xyz+pPass.cDiffuseAcc.xyz);
if(pPass.nReflectionMapping)
{
half3 cEnvShading=lerp(1,(pPass.cAmbientAcc.xyz+pPass.cDiffuseAcc.xyz),MatDifColor.w);
pPass.cSpecularAcc.xyz+=pPass.cEnvironment.xyz*cEnvShading;
}
half3 cSpecular=pPass.cSpecularAcc.xyz*pPass.cGlossMap.xyz;
if(!pPass.bSkipMaterial)cSpecular.xyz*=cSpecularCol.xyz;
cSpecular.xyz*=pPass.fFresnel;
cFinal.xyz+=cDiffuse;
cFinal.xyz+=cSpecular;
}
void frag_quality_setup(inout fragPass pPass)
{
pPass.nQuality=GetShaderQuality();
if(pPass.nQuality==0)
{
pPass.bRenormalizeNormal=pPass.bForceRenormalizeNormal;
pPass.nReflectionMapping=false;
pPass.bDetailBumpMapping=false;
}
}
void frag_fog_setup(inout fragPass pPass,inout half4 cOut)
{}
void frag_get_deferred_buffers(inout fragPass pPass)
{
pPass.cShadowOcclMap=0;
float2 tcProj=pPass.IN.screenProj.xy/pPass.IN.screenProj.w;
pPass.fSceneDepthRT=DecodeSceneDepth(sceneDepthSampler,pPass.IN.screenProj.xyww);
pPass.vSceneUVsRT=DecodeSceneUV(tex2Dproj(sceneUVsSampler,pPass.IN.screenProj.xyww).x);
pPass.cNormalMapRT=GetWorldSpaceNormals(tex2Dproj(sceneNormalsSampler,pPass.IN.screenProj.xyzw),true);
pPass.cShadowOcclMap=pPass.cNormalMapRT.w;
}
void frag_hdr_setup(inout fragPass pPass,inout half4 cOut)
{
if(!pPass.bSkinIrradiancePass)cOut.xyz*=g_PS_SunLightDir.w;
}
void frag_ambient(inout fragPass pPass,half3 vNormal)
{}
half GetBlendedHeight(float2 uv,half blendLayerFactor,in float blendLayer2Tiling)
{
half h=tex2D(bumpHeightMapSampler,uv).w;
h+=blendLayerFactor*(tex2D(HeightMap2Sampler,uv*blendLayer2Tiling).w-h);
return h;
}
half4 frag_shared_output(inout fragPass pPass)
{
half4 cOut=0;
frag_quality_setup(pPass);
frag_get_deferred_buffers(pPass);
const float2 microDetailBaseTC=pPass.IN.baseTC.xy;
const float dispAmount=pPass.fBumpHeightScale;
float blendLayer2Tiling=0;
pPass.blendFac=GetLayerBlendingValue(BlendMapSampler,microDetailBaseTC,0,pPass.IN.Color.a,__0BlendFactor__1BlendLayer2Tiling__2BlendFalloff__3BlendMaskRotation.x,__0BlendFactor__1BlendLayer2Tiling__2BlendFalloff__3BlendMaskRotation.z);
blendLayer2Tiling=__0BlendFactor__1BlendLayer2Tiling__2BlendFalloff__3BlendMaskRotation.y;
pPass.vView=normalize(-pPass.IN.vView.xyz);
pPass.mTangentToWS=float3x3(pPass.IN.vTangent.xyz,pPass.IN.vBinormal.xyz,pPass.IN.vNormal.xyz);
if(pPass.nMicroDetailQuality==1)
{
const half3 viewDir=mul(pPass.mTangentToWS,pPass.vView);
const float2 newCoords=OffsetMap(microDetailBaseTC,viewDir,2,dispAmount,pPass.fHeightBias,pPass.blendFac,blendLayer2Tiling);
pPass.IN.baseTC.xy=newCoords;
pPass.IN.bumpTC.xy=newCoords;
}
if(pPass.nMicroDetailQuality==2)
{
float2 ddxMicroDetailBaseTC,ddyMicroDetailBaseTC;
float lod=ComputeTextureLOD(microDetailBaseTC,ResInfoBump.xy,ddxMicroDetailBaseTC,ddyMicroDetailBaseTC);
if(pPass.nMicroDetailQuality==2)
{
const float3 viewDirWS=pPass.IN.vView.xyz;
const float3 parallax=mul(pPass.mTangentToWS,pPass.vView).xyz;
const float sceneDepth=pPass.fSceneDepthRT;
const float scale=sceneDepth-dot(viewDirWS,-CamFrontVector_POM);
const float2 offset=normalize(parallax.xy/-parallax.z)*scale*0.25;
pPass.IN.baseTC.xy=microDetailBaseTC+offset.xy;
pPass.IN.bumpTC.xy=microDetailBaseTC+offset.xy;
}
else
{
const float2 sceneUVs=pPass.vSceneUVsRT;
pPass.IN.baseTC.xy=sceneUVs;
pPass.IN.bumpTC.xy=sceneUVs;
}
if(pPass.nMicroDetailQuality==2)
{
pPass.cDiffuseMap=GetTexture2DGrad(diffuseMapSampler,pPass.IN.baseTC.xy,ddxMicroDetailBaseTC,ddyMicroDetailBaseTC);
if(!pPass.bDontUseBump)pPass.cBumpMap.xyz=GetNormalMapGrad(bumpMapSampler,pPass.IN.bumpTC.xy,ddxMicroDetailBaseTC,ddyMicroDetailBaseTC);
else pPass.cBumpMap=half3(0,0,1);
}
else
{
pPass.cDiffuseMap=tex2Dlod(diffuseMapSampler,float4(pPass.IN.baseTC.xy,0,0));
}
}
else
{
pPass.cDiffuseMap=tex2D(diffuseMapSampler,pPass.IN.baseTC.xy);
if(!pPass.bDontUseBump)pPass.cBumpMap=GetNormalMap(bumpMapSampler,pPass.IN.bumpTC.xy);
else pPass.cBumpMap=half3(0,0,1);
}
pPass.vNormalDiffuse=pPass.cBumpMap;
half2 vDetailTC=pPass.vDetailBumpTilling*pPass.IN.baseTC.xy;
half4 cDetailMap=tex2D(detailMapSampler,vDetailTC);
if(pPass.bDetailBumpMapping)
{
if(pPass.bDetailBumpMappingMasking)
{
pPass.fDetailBumpScale*=pPass.cDiffuseMap.w;
pPass.vDetailBlendAmount*=pPass.cDiffuseMap.w;
}
half2 vDetailN=EXPAND(cDetailMap).xy;
pPass.cBumpMap.xy+=vDetailN.xy*pPass.fDetailBumpScale;
}
pPass.fAlpha=pPass.cDiffuseMap.w*pPass.IN.Ambient.w;
pPass.vNormal.xyz=pPass.cNormalMapRT.xyz;
pPass.fNdotE=(dot(pPass.vView.xyz,pPass.vNormal.xyz));
pPass.fGloss=MatSpecColor.w;
pPass.vReflVec=(2.0h*pPass.fNdotE*pPass.vNormal.xyz)-pPass.vView.xyz;
pPass.fFresnel=pPass.fFresnel_Bias+pPass.fFresnel_Scale*pow(1.001h-saturate(pPass.fNdotE),pPass.fFresnel_Pow);
frag_custom_begin(pPass);
if(SnowVolumeParams[0].x)
{
pPass.cSnowMap=tex2Dlod(sceneSnowMapSampler,half4(pPass.IN.screenProj.xy/pPass.IN.screenProj.w,0,0));
pPass.fGloss=lerp(pPass.fGloss,0.3f,pPass.cSnowMap.w);
}
if(pPass.bDetailBumpMapping)
{
half2 vBlendAmount=lerp(0.5,cDetailMap.zw,pPass.vDetailBlendAmount)*2.0;
pPass.cDiffuseMap.xyz*=vBlendAmount.x;
pPass.cGlossMap.xyz*=vBlendAmount.y;
}
else
{
half fLerp=length(pPass.IN.vView.xyz/DetailParams.w/0.8);
if(pPass.bDetailBumpMappingMasking)
{
fLerp/=pPass.cDiffuseMap.w+0.001;
}
half3 detColor=lerp(cDetailMap.xyz,0.5,saturate(fLerp));
pPass.cDiffuseMap.xyz*=2*detColor;
}
if(pPass.nReflectionMapping>0)
{
if(pPass.nReflectionMapping==1)
{
pPass.cEnvironment=GetEnvironmentCMap(envMapSamplerCUBE,pPass.vReflVec.xyz,pPass.fGloss).xyz;
}
else if(pPass.nReflectionMapping==2)
{
pPass.cEnvironment=GetEnvironment2DMap(envMapSampler,pPass.vReflVec.xy);
}
}
half3 vAmbientNormal=pPass.vNormal.xyz;
const int aLType[4]=
{
0,0,0,0};
for(int i=0;
i<1;
i++)
{
int nType=aLType[i];
float4 WorldLightPos=LGetPosition(i);
half4 Diffuse=LGetDiffuse(i);
half4 Specular;
Specular=Diffuse;
Specular.xyz*=Diffuse.w;
half fOcclShadow;
if(nType==0)
{
WorldLightPos=g_PS_SunLightDir;
fOcclShadow=1.h-pPass.cNormalMapRT.w;
}
else
{
half4 ShadowChanMask=LGetShadowMask(i);
fOcclShadow=saturate(1-dot(pPass.cShadowOcclMap,ShadowChanMask));
}
half fFallOff=1;
float3 vLight,vLightWS;
if(nType==0)
{
vLightWS=WorldLightPos.xyz*10000.0f;
vLight=WorldLightPos.xyz;
}
else
{
vLightWS=WorldLightPos.xyz-pPass.IN.vView.xyz;
vLight=normalize(vLightWS.xyz);
fFallOff=GetAttenuation(vLightWS.xyz,WorldLightPos.w);
}
if(pPass.nMicroDetailQuality==2||pPass.nMicroDetailQuality==1)
{
float3 light=mul(pPass.mTangentToWS,vLight.xyz);
float2 lightDelta=float2(light.x,light.y)*pPass.fBumpHeightScale;
float h0=GetBlendedHeight(pPass.IN.bumpTC.xy,pPass.blendFac,blendLayer2Tiling);
float h=h0;
if(pPass.nMicroDetailQuality==2)
{
h=max(0,GetBlendedHeight(pPass.IN.bumpTC.xy+1.000*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.875*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.750*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.625*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.500*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.375*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.250*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.125*lightDelta,pPass.blendFac,blendLayer2Tiling));
}
else
{
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+1.000*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.666*lightDelta,pPass.blendFac,blendLayer2Tiling));
h=max(h,GetBlendedHeight(pPass.IN.bumpTC.xy+0.333*lightDelta,pPass.blendFac,blendLayer2Tiling));
}
float soften=pPass.fSelfShadowStrength;
if(SnowVolumeParams[0].x)soften*=pPass.cSnowMap.w;
float shadow=1-saturate((h-h0)*soften);
fOcclShadow*=shadow;
}
half3 filterColor=1;
half fNdotL=dot(vLight.xyz,pPass.vNormal.xyz);
half4 occlusionTex=tex2Dproj(sceneNormalsBentSampler,pPass.IN.screenProj.xyzw);
occlusionTex.xyz=(occlusionTex.xyz*2.h-1.h)*half3(0.48860,0.48860,0.48860);
half fOcclusion=1.h-saturate(dot(half4(vLight.xyz,0.28209),occlusionTex)*AlphaTest.z);
fNdotL*=fOcclusion;
fragLightPass pLight=(fragLightPass)0;
pLight.nType=nType;
pLight.cDiffuse=Diffuse.xyz;
pLight.cSpecular=Specular.xyz;
pLight.vLight=vLight;
pLight.fNdotL=fNdotL;
pLight.fOcclShadow=fOcclShadow;
pLight.fFallOff=fFallOff;
pLight.cFilter=filterColor;
frag_custom_per_light(pPass,pLight);
cOut.xyz+=pLight.cOut.xyz;
}
frag_ambient(pPass,vAmbientNormal);
if(pPass.bCustomComposition==false)
{
frag_final_composition(pPass,cOut.xyz);
}
frag_custom_end(pPass,cOut.xyz);
if(pPass.bVertexColors)
{
cOut.xyz*=pPass.IN.Color.xyz;
}
cOut.w=pPass.fAlpha;
frag_fog_setup(pPass,cOut);
frag_hdr_setup(pPass,cOut);
return cOut;
}
pixout MechPS(vert2FragGeneral IN)
{
pixout OUT=(pixout)0;
fragPass pPass=(fragPass)0;
frag_unify(pPass,IN);
half4 cFinal=frag_shared_output(pPass);
HDROutput(OUT,cFinal,1);
return OUT;
}