Skip to content

[ZH] Remove the unused WWShade library #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 12, 2025

Conversation

tomsons26
Copy link

@tomsons26 tomsons26 commented Apr 4, 2025

WWShade code isn't called in any ZH binary, no tools for making these W3D models exist, only models in existence are ones Westwood quietly posted on their FTP after Renegade 2 got cancelled and some strange odballs in BFMEs that use some of the SHD chunks. No game or tool however can show these models as nothing is compiled with this code

tomsons26 added a commit to tomsons26/GeneralsGameCode that referenced this pull request Apr 4, 2025
Copy link

@roossienb roossienb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, USE_WWSHADE is also used in ww3d2/shdlib.h. If USE_WWSHADE is always false, shouldn't it be deleted in there as well?

@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Build Anything related to building, compiling labels Apr 6, 2025
@@ -23,7 +23,6 @@ target_include_directories(z_wwcommon INTERFACE
WWMath
WWSaveLoad
Wwutil
wwshade
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would a WWShade model look like? Does the WWShade code work in principle? Would it be possible to revive this feature instead of deleting it? Would it be worth it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can try building W3DView with USE_WWSHADE on and open these w3ds https://www.moddb.com/games/cc-renegade/addons/cc-renegade-2-model-pack

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would a WWShade model look like? Does the WWShade code work in principle? Would it be possible to revive this feature instead of deleting it? Would it be worth it?

I agree with that, this library although it seems like it has no use, it's quite good starter step for managing the pixel shader 2.0 and 3.0 of dx 9 or later version
I don't agree with removing it, but it can be replaced with something else

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Launching w3dview with USE_WWSHADE crashes:

>	W3DView.exe!ShdHWPixelShader::Create(unsigned long * shader_code_str) Line 355	C++
 	W3DView.exe!Shd8BumpSpecClass::Init() Line 120	C++
 	[Inline Frame] W3DView.exe!ShdRendererClass::Init_Shaders() Line 95	C++
 	W3DView.exe!ShdRendererClass::Init() Line 85	C++
 	[Inline Frame] W3DView.exe!DX8Wrapper::Do_Onetime_Device_Dependent_Inits() Line 383	C++
 	W3DView.exe!DX8Wrapper::Create_Device() Line 616	C++
 	W3DView.exe!DX8Wrapper::Set_Render_Device(int dev, int width, int height, int bits, int windowed, bool resize_window, bool reset_device, bool restore_assets) Line 1076	C++
 	W3DView.exe!WW3D::Set_Render_Device(int dev, int width, int height, int bits, int windowed, bool resize_window, bool reset_device, bool restore_assets) Line 446	C++
 	W3DView.exe!CGraphicView::InitializeGraphicView() Line 209	C++
 	W3DView.exe!CMainFrame::Select_Device(bool show_dlg) Line 2195	C++
 	W3DView.exe!CMainFrame::OnCreateClient(tagCREATESTRUCTA * __formal, CCreateContext * pContext) Line 564	C++

It fails with call to D3DXAssembleShader with shd8bumpspec_psh_code. Then crashes.

The crashes can be avoided. Then all things in Shd8BumpSpecClass::Init fail initialize.

The Ren2 models do open, but I do not know what to look for in regards to wwshade. Considering it fails to initialize shaders, perhaps it will not work anyway.

kirovefih3q45t9g

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, do we remove WWShade, or not? Any opinions?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to run it. Exception states, shader_code is null, while it is -- if I understand correctly -- supposedly to be set by a DirectX API method, but it doesn't. Most documentation I can found refers to DirectX9 for shaders, not DirectX8. Wasn't Renegade 2 in DirectX9? Maybe they were planning to port ZH to DirectX9 but never got to it. Maybe shaders were never properly implemented in DirectX8?

Current models don't have shading and if there are no tools available to add shading to W3D models, then everything we want to with regards to shading needs to be built up from the ground anyways.

From that perspective, I think WWShade is more a liability then an asset and should be removed, including any reference to it. Worst case when it turns out WWShade is the way forward, we can restore it and take the extra work for granted. This PR is clear enough to understand what has been removed and can be easily reverted.

Copy link
Author

@tomsons26 tomsons26 Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is still for DX8
Not all models use the chunks, indeed kirov is one that didn't, examine in wdump which do
Grizzly iirc does

@xezon xezon changed the title [ZH] Removes WWShade [ZH] Remove unused WWShade Apr 8, 2025
@xezon xezon added ZH Relates to Zero Hour Refactor Improves the structure of the code, with negligible changes in function. Unify Unifies code between Generals and Zero Hour and removed Build Anything related to building, compiling labels Apr 12, 2025
@xezon xezon changed the title [ZH] Remove unused WWShade [ZH] Remove the unused WWShade library Apr 12, 2025
Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased and comment added to the relevant header for the WWShade removal.

@xezon xezon merged commit 4e45e90 into TheSuperHackers:main Apr 12, 2025
11 checks passed
@tomsons26 tomsons26 deleted the nowwshade branch April 12, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Minor Severity: Minor < Major < Critical < Blocker Refactor Improves the structure of the code, with negligible changes in function. Unify Unifies code between Generals and Zero Hour ZH Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants