• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Warcraft III Reforge Shaders Reversed Engineered.

Last edited:
When I was re-engineering something akin to these for the purpose of OpenGL rendering of the Reforged graphics on Retera Model Studio, one of the places I copied from was the code in the Hive's viewer ("view in 3D") which had a functional but less complete capability to render Reforged graphics. The one I set up is also not complete:

Hive/Ghostwolf's Viewer:

Retera Model Studio:

"Warsmash" (Desktop Java port of Hive/Ghostwolf viewer with edits):

I'm guessing that you didn't spend time looking at these haphazard fan reinventions and instead used the official game or debug leaks as the basis for your work. If that's correct, you think these other systems might be able to use the Wc3Shaders repo to better render the Reforged graphics?

We can look at stuff like the Retera Model Studio reinvention of the shaders, which is somewhat functional but lacks ambient occlusion and some other things:

225433-f2de020a4490caf9a43dd02e63cfe5a1.webp



I recall some musing at one point about how I discovered the Hive Viewer version had the normal map loaded incorrectly:

When I am playing World of Warsmash for example and I try to drop-in Reforged models using the Warsmash shader linked above into the graphics scene, it is again functional but misses ambient occlusion and also uses some possibly stupid lighting math that goes absolutely nuts and pukes rainbows if there are more than a few lights shining on the object:
full



Do you think these other systems would more likely benefit from Wc3Shaders by reading it and understanding it and then putting those understandings into practice in their own ecosystems, or by trying to load the Wc3Shaders directly? Or would they sort of not at all benefit and it's just entirely different?
 
Last edited:
When I was re-engineering something akin to these for the purpose of OpenGL rendering of the Reforged graphics on Retera Model Studio, one of the places I copied from was the code in the Hive's viewer ("view in 3D") which had a functional but less complete capability to render Reforged graphics. The one I set up is also not complete:

Hive/Ghostwolf's Viewer:

Retera Model Studio:

"Warsmash" (Desktop Java port of Hive/Ghostwolf viewer with edits):

I'm guessing that you didn't spend time looking at these haphazard fan reinventions and instead used the official game or debug leaks as the basis for your work. If that's correct, you think these other systems might be able to use the Wc3Shaders repo to better render the Reforged graphics?

We can look at stuff like the Retera Model Studio reinvention of the shaders, which is somewhat functional but lacks ambient occlusion and some other things:

225433-f2de020a4490caf9a43dd02e63cfe5a1.webp



I recall some musing at one point about how I discovered the Hive Viewer version had the normal map loaded incorrectly:

When I am playing World of Warsmash for example and I try to drop-in Reforged models using the Warsmash shader linked above into the graphics scene, it is again functional but misses ambient occlusion and also uses some possibly stupid lighting math that goes absolutely nuts and pukes rainbows if there are more than a few lights shining on the object:
full
All those shaders are written in Slang, so they compile to hlsl, glsl, metal, glsl, webgsl, spir-v, etc. I'm currently focused on matching the originals the best I can when recompiling. If you compile for d3d11 and generate the bls, at least sd and hd shjaders will match Reforged and you can replace the game shaders with my generated verions without losing any effects in-game.

you can use those shaders in warmash or retera model studio if you want, you may have to produce glsl for them, just run the python scriptsd on hd_vs, hd_ps, crystal_vs, crystal_ps, sd_vs, sd_ps, sd_on_hd_vs and sd_on_hd_ps; and use "--target opengl". The little tool which I use to develop cornflakes is actually in OpenGL and uses popcorn_fx_vs and popcorn_fx_ps from that repository:
1778432031361.webp



Now I would suggest you wait a bit for me to release WhiteoutFlakes (https://www.hiveworkshop.com/threads/whiteoutflakes-warcraft-iii-reforged-previewer.371713/) That's a render service written in C++ that I intend to release soon with language bindings for Javascript, Typescript, Python, Java and (maybe C# and Rust). It will be useful enough for you to render anything you want.

About Ambient occlussion: Reforged ignores it in the HD shader. it does an ambient occlussion pass later on but I have no idea how it works.

About Hive's viewer, it's good but it's off in ribbon emitters and it does not do the crazy transparency tricks the engine does. When rendering a Blend material the engine uses a Depth Prepass before rendering the actual model, this is what semi transparent models always show the front faces in the engine and almostz every viewer out there fails.

About your shader, you were missing the IBL calculations based on the specular and diffuse irrandiance cubemap. Chapter 19. Image-Based Lighting is a good read about it. Reforged uses a few IBL Probes for that. I wish I could tell you how they work precisely but I can't, I'm still over reflecting stuffs compared to the game and I can't get the day/night IBL to work correctly.

Finally to answer your question, yes I'm based everything on the game. For the shaders I extracted the bls, then extracted the permutations out of each bls and made a uber-shader.hlsl which could produce all the permutations, afterwards I renamed variables until it made sense. Finally, I rewrote the shaders in slang. For reverse engineering the game, I'm using IDA Pro.
 
Last edited:
When rendering a Blend material the engine uses a Depth Prepass before rendering the actual model, this is what semi transparent models always show the front faces in the engine and almostz every viewer out there fails.
I was thinking I had this mostly fixed in the Warsmash game environment by updating how the port of the viewer Z sorted stuff to include some extra sort parameters, but it's been a while since I exhaustively tested it. Would that classify as a solution to the same thing or does it need to be more complicated than that?

Also, maybe it's slightly off-topic, but:
  • Does your WhiteoutFlakes viewer and corresponding lib run on Linux?
  • Does your viewer/lib work with MDX1300 files from the early WoW alpha that are MDX format instead of M2? That's what I was loading in my hybrid War3/WoW client for something like this which is really just the Warcraft 3 simulator with the maximum map size increased, terrain parser changed to load WoW terrain, and model parser changed to support MDX1300 (but not M2)
    • The video linked above is a rendering done on Linux in a Java environment (no wine) using Libgdx+LWJGL (a tech stack a bit like minecraft)
 
I was thinking I had this mostly fixed in the Warsmash game environment by updating how the port of the viewer Z sorted stuff to include some extra sort parameters, but it's been a while since I exhaustively tested it. Would that classify as a solution to the same thing or does it need to be more complicated than that?

Also, maybe it's slightly off-topic, but:
  • Does your WhiteoutFlakes viewer and corresponding lib run on Linux?
  • Does your viewer/lib work with MDX1300 files from the early WoW alpha that are MDX format instead of M2? That's what I was loading in my hybrid War3/WoW client for something like this which is really just the Warcraft 3 simulator with the maximum map size increased, terrain parser changed to load WoW terrain, and model parser changed to support MDX1300 (but not M2)
    • The video linked above is a rendering done on Linux in a Java environment (no wine) using Libgdx+LWJGL (a tech stack a bit like minecraft)
First question: MDX Materials have 2 flags to control sorting (from Near and from Far), you should only sort when those flags are on; about if that would be equivalent to the engines approach; actually nope, you would still render backfaces and occluded faces. The engine's approach is meant for performance reasons just render the geoset's depth first without writing color and then draw it again with depth_test less_equal.

A. WhiteoutLib supports Windows, Linux, MacOS and WASM out of the bag except for online CASC (that just needs an http interface implementation over libcurl). About WhiteoutFlakes, I have not released it yet, but the service supports Vulkan and should compile in linux. The viewer itself uses Win32 GUI because of 3ds max being stubborn about it. I plan to replace it with Dear ImGui and just leave the old gui for the 3ds max plugin.

B. That's funny, my core library supports M2 loading and supports MDX Classic and MDX Reforged but not WoW's BETA MDX formats. I was thinking about adding M2 support eventually simnce it's pretty similar to Warcraft 3 Classic.
 
Back
Top