icecoldduke Posted August 25, 2019 (edited) Hey, Today I created a simple PBR shader for Quake 4, uploaded a comparsion video and the source code for it here: https://www.youtube.com/watch?v=0uyGz2CWoP8 Interaction Shader(including CG source) for Quake4/Prey/Doom 3 here: https://github.com/jmarshall23/idtech4_pbr The data needs to be changed pretty drastically to make it look good all over the game(there are issues since the game was originally designed for phong based lighting). I'm not sure how much more I can do, since the game isn't open source, but I figured I would upload it here anyone and see what your guys's thoughts are. Edited August 25, 2019 by icecoldduke 1 Quote Share this post Link to post
MFG38 Posted August 25, 2019 Take away the shiny skin that makes everyone look like they've got oil all over their faces and you've got it, I'd say. 0 Quote Share this post Link to post
icecoldduke Posted August 25, 2019 1 hour ago, MFG38 said: Take away the shiny skin that makes everyone look like they've got oil all over their faces and you've got it, I'd say. Thanks :). What needs to be done is someone needs to create PBR textures for everything. The faces can be fixed by either setting a black texture for the specular texture or creating proper PBR textures. I updated the OP to include shaders for Prey and Doom 3. Prey I'm not sure why they have 5 or 6 different interaction programs, I simply replace them all(which is probably not correct), but it works. 0 Quote Share this post Link to post
Arl Posted August 26, 2019 (edited) Wait what? PBR can be achieve in regular D3? what is this taking as roughness input? Edited August 26, 2019 by Arl 0 Quote Share this post Link to post
icecoldduke Posted August 26, 2019 2 hours ago, Arl said: Wait what? PBR can be achieve in regular D3? what is this taking as roughness input? Currently the specular red channel is being used for roughness, and the metallic is set to 0.5. The shader can be easily modified so specular red channel is roughness and specular green channel is metallic. So to be clear, this works in vanilla Doom 3, vanilla Quake 4 and vanilla Prey. 0 Quote Share this post Link to post
Arl Posted August 26, 2019 Oh I see, very impresing! I should make some tests then, this is exciting. By the way, you said you wished to make SSS but you don't have the code, maybe you can take a look at some of the D3 source ports, maybe they can be extended to support Q4. 1 Quote Share this post Link to post
icecoldduke Posted August 26, 2019 (edited) 7 minutes ago, Arl said: Oh I see, very impresing! I should make some tests then, this is exciting. By the way, you said you wished to make SSS but you don't have the code, maybe you can take a look at some of the D3 source ports, maybe they can be extended to support Q4. I know how to code SSS, the issue is doing it in a codebase that's closed source. If Prey or Quake 4 was open source I could pretty easily add SSS. Let me know if you need any help, I'd love to see proper PBR textures for these games. EDIT: Does Quake 4 support custom interaction shaders on a per material basis? Edited August 26, 2019 by icecoldduke 0 Quote Share this post Link to post
Arl Posted August 26, 2019 Is there any diference in making those shaders with the current ARB2 and GLSL? Yeah man I'll be dreaming with PBR for D3, and I was waiting for some source port to make it possible, and suddenly you came! I'm totally going to work on it. 1 Quote Share this post Link to post
icecoldduke Posted August 26, 2019 (edited) 9 minutes ago, Arl said: Is there any diference in making those shaders with the current ARB2 and GLSL? Yeah man I'll be dreaming with PBR for D3, and I was waiting for some source port to make it possible, and suddenly you came! I'm totally going to work on it. Sweet :). No there isn't a difference between adding PBR via ARB2 vs GLSL. The delta in PBR vs Phong is mostly ALU(math computation), and you have a couple extra texture lookups, which is easily supported by ARB2. Edited August 26, 2019 by icecoldduke 0 Quote Share this post Link to post
icecoldduke Posted August 26, 2019 (edited) For Doom 3 here is the modified interaction.vfp that supports roughness as specular red channel and metallic as speculator green channel. Let me know how this works for you, and I'll make the change in my repository for all platforms. If anyone wants the change before I do the update. In interaction.vfp change: float4 metallic = 0.5; float4 roughness = tex2D( specularImage, To: float4 specTex = tex2D( specularImage, specularST ); float4 roughness = float4(specTex.r, specTex.r, specTex.r, specTex.r); float4 metallic = float4(specTex.g, specTex.g, specTex.g, specTex.g); Heres the Doom 3 interaction.vfp https://pastebin.com/xbueBENV Edited August 26, 2019 by icecoldduke 0 Quote Share this post Link to post
Avoozl Posted August 26, 2019 Ah Prey, the one ID Tech 4 game I just can't get myself to play through more than once. 0 Quote Share this post Link to post
Arl Posted August 26, 2019 I was thinking of using the specular map for all of PBR exclusive maps, being roughness and metallic the first channels and maybe the B channel can be SSS, altough we could not control the subdermal color. 0 Quote Share this post Link to post
icecoldduke Posted August 26, 2019 (edited) 11 minutes ago, Avoozl said: Ah Prey, the one ID Tech 4 game I just can't get myself to play through more than once. I really liked Prey multiplayer, it's always been my hope that the game would be open sourced and we could do a proper visual upgrade to bring back some multiplayer interest. Maybe that might happen with the PBR shader. 10 minutes ago, Arl said: I was thinking of using the specular map for all of PBR exclusive maps, being roughness and metallic the first channels and maybe the B channel can be SSS, altough we could not control the subdermal color. I might be able to do a proper SSS shader with whats exposed. If you can create some subsurface assets for one of the faces, I'll see if I can add SSS support with what's exposed by the default engine. Edited August 26, 2019 by icecoldduke 0 Quote Share this post Link to post
Arl Posted August 26, 2019 Yes I can do somes pbr maps for a head right now. I also have full PBR maps for the Cyberdemon and the Resurrection of Evil demon called Bruiser, are those of any use for you? 0 Quote Share this post Link to post
icecoldduke Posted August 26, 2019 4 minutes ago, Arl said: Yes I can do somes pbr maps for a head right now. I also have full PBR maps for the Cyberdemon and the Resurrection of Evil demon called Bruiser, are those of any use for you? Yeah send those over(would be good to test the current PBR implementation with proper PBR assets), but to test SSS I'd need more of a humanoid head. 0 Quote Share this post Link to post
Arl Posted August 26, 2019 (edited) Here it is the player (and also the Cyberdemon because I already made prb maps for him in the past). I took the liberty to gather all maps in the specular file, as you pointed before, R channel is Roughness, G metallic, and B is SSS. pbr_s.zip Let me know if you need anything else. Edited August 26, 2019 by Arl 0 Quote Share this post Link to post
icecoldduke Posted August 26, 2019 (edited) 4 hours ago, Arl said: Let me know if you need anything else. So couple issues with just using vanilla D3/Quake 4 and Prey with SubSurface scattering. A good portion of their specular maps actually have the same thing in all three channels, and with DDS compression, there specular is condensed down to a single channel in some cases. Were going to need another place to piggy back SSS on too, or someone has to modify all the spec maps. Edited August 26, 2019 by icecoldduke 0 Quote Share this post Link to post
Arl Posted August 26, 2019 Is it possible to use a another texture without having to modify material declarations? something like "walltexture_pbr". That way we can leave the specular map alone, leaving the game look intact and only changing the textures that have that extra texture with the PBR maps. 0 Quote Share this post Link to post
icecoldduke Posted August 26, 2019 2 hours ago, Arl said: Is it possible to use a another texture without having to modify material declarations? something like "walltexture_pbr". That way we can leave the specular map alone, leaving the game look intact and only changing the textures that have that extra texture with the PBR maps. In Doom 3 adding another texture isn't difficult, however I was hoping for a solution that would work in Quake 4 and Prey as well 0 Quote Share this post Link to post
Arl Posted August 26, 2019 I was thinking something that searchs for roughness/metallic/SSS maps on a texture with '_pbr' at the end of the name, or at the begining. If that's posible I don't see how that wouldn't be compatible with Q4 and Prey. I'm having a lot of fun making the Player model full PBR by the way, thank you for this! 0 Quote Share this post Link to post
Mr.Rocket Posted August 27, 2019 (edited) I know you guys are working on it, but yeah if you could get a roughness/flat or non shiny in the mix without having to create a new material script for every single resource known, then that would be sweet. Perhaps if there was a color range that PBR could only be layered to? eg light skin tone = no PBR. heh At least if it's possible to do something like that with affected MD5 etc.. Edited August 27, 2019 by Mr.Rocket 0 Quote Share this post Link to post
icecoldduke Posted August 27, 2019 We can't expand the material system without source code to the renderer, which we have for Doom 3, but not for Quake 4 and Prey. For those two games we can probably add metallic by disabling RXGB compression in Quake 4 and Prey, and attaching the metallic as the alpha channel for the normals. Not sure yet about SSS. I still think the best way forward for all three games is just to modify the specular textures to match the R=Roughness, B=Metallic, G=SSS. All textures are going to have to touched in a proper PBR pass anyway. 0 Quote Share this post Link to post
Arl Posted August 28, 2019 Whatever you say is the best implementation I'll stick with it, if it works the same for all tree games the better. 0 Quote Share this post Link to post
icecoldduke Posted August 28, 2019 I uploaded a quick Prey playthrough with my shader enabled. 0 Quote Share this post Link to post
icecoldduke Posted August 28, 2019 Also in theory you can rename my interaction.vfp program to interaction_pbr.vfp and use add program interaction_pbr.vfp to materials you want to have PBR. 0 Quote Share this post Link to post
icecoldduke Posted August 30, 2019 (edited) Committed a quick fix, the BRDF contribution is now multiplied by the light attenuation/falloff images, and metallic is no longer hardcoded. The specular image is now used as R=Roughness and B=Metallic. Edited August 30, 2019 by icecoldduke 0 Quote Share this post Link to post
icecoldduke Posted October 5, 2019 (edited) I committed to my Quake 4 PBR github, a fix for nospecular. In all idTech 4 games(Prey, Quake 4 and Doom 3), ticking "nospecular" in the editor, didn't do anything. Through some memory injection magic I fixed that. Relevant code is here: https://github.com/jmarshall23/idtech4_pbr/tree/master/quake4/code With the two relevant source files: https://github.com/jmarshall23/idtech4_pbr/blob/master/quake4/code/renderer/draw_arb2.cpp https://github.com/jmarshall23/idtech4_pbr/blob/master/quake4/code/renderer/tr_inject.cpp So if you drag and drop the files in code into the Quake 4 SDK and compile, nospecular option will work. Edited October 5, 2019 by icecoldduke 0 Quote Share this post Link to post
icecoldduke Posted October 5, 2019 Prey 1.3 NoSpecular fix https://github.com/jmarshall23/idtech4_pbr/tree/master/prey/code 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.