-
Notifications
You must be signed in to change notification settings - Fork 78
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
Vertex shader translation does not work as expected (Star Wars Republic Commando) #28
Comments
It looks like the regex can't handle cases where the argument already use just the one .x component |
The relevant source code line is https://github.com/crosire/d3d8to9/blob/master/source/d3d8to9_device.cpp#L1392. |
From what I can tell the issue is that it matches on the first number in the I think we should change this line from this:
To this:
From my tests this seems to solve the issue. Basically I am adding This also fixes the shader translation issue in Silent Hill 2 mentioned in this comment. Code changes to fix this issue is posted here 6483006. |
Adding it as another bracketed expression, it would need to be referenced as $5 in the output, otherwise the digit would get lost. It's simpler to put the additional expression inside the fourth expression, but the plus sign already there should have catched multiple digits already... |
It does match on both digits but it also matches on one digit. Since As far as referencing $5 in the output, that is not needed. If you notice there are actually 6 bracketed expressions not 5. However the last two expressions are "Negative Lookahead" expressions which are not included in the groups. Check out this site and add |
UPDATE I feel like it's the pixel shader now, as I went back and looked at the code.
Notice In the d3d8to9 it takes away the - sign making it Correct me if I'm wrong, but I think that's the issue. It's supposed to take away from the saturation there but it's being changed so it adds to it instead. (I'm way over my head....) Hope this helps track it down. UPDATE 2 WELL WHADDYA KNOWIt also exposes that another shader has the same issue and it's a pixel shader issue. If anyone wants me to, I'll open a new issue only dealing with the pixel shader. |
Interesting. This is a separate issue. What game is this happening in and how do I reproduce it? Can you try with this file and let me know what the results are? |
This is still Star Wars Republic Commando with a unreleased, still in development mod, and I'm guessing you commented out the lines for the removed modifier, since I just tried that before trying yours. This causes the editor to crash, producing
I'll make a new issue for this. |
So I've been following this project silently for about a year and a half for now as it interested me in the project I'm working on.
I have no c++ knowledge of any sorts, since I am primarily a Java programmer, but I hope I can help with one issue with vertex shaders.
For the longest time, the hardware shaders (Unreal Engine 2 combines vertex and pixel shaders) for some of the effects have not been being rebuilt properly. In d3d8, the shaders work fine, but in d3d8to9 it rebuilds the vertex shaders with wrong instructions.
Take for example: the hardware shader DynamicHologram, this is how it appears in editor
(I'm using quote since the code tag does not want to work with it)
But this is how d3d8to9 parses it
Note the last line on each one: the engine's version has
mov oFog, c20.x
d3d8to9 inserts a comment and changes it to
mov oFog /* removed swizzle */, c2.x /* select single component */0.x
and leaves the old 0.x after the inserted comment
It also errors out in the log for d3d8to9 with
In the game's log it writes
Log: CreateVertexShader failed(88760B59).
I looked up the error and 88760B59 means invalid data (D3DXERR_INVALIDDATA).
Now, if I go in game and change the last line from
mov oFog.x, c20.x
to
mov oFog.x, c2.x
d3d8to9 builds the shader just fine and it works in game.
This is what it outputs with that change
Now, I do not know c++ or directx at all, so I don't know how to fix it in d3d8to9, but this is the information I've collected on this issue, I only wanted to submit this once I had everything and had time to try everything.
A few other vertex shaders do not recompile correctly, but I do not know exactly which ones they are.
The primary ones that do not recompile are ones used for bump mapping, specularity, and the one hologram shader that is used on a lot of different objects throughout the game.
If anyone needs more information, like the raw log files, pictures, or the code to other shaders feel free to ask.
The text was updated successfully, but these errors were encountered: