Jump to content


Photo

Color Grading Shader


32 replies to this topic

#26 rich_is_bored

rich_is_bored

    Advanced Member

  • Member
  • PipPipPip
  • 856 posts

Posted 17 July 2017 - 10:52 PM

Just tested it in Mother Rose and went into the house...

 

nvmvetn.jpg

 

I want to say it's a graphics setting but at the same time the shader obviously runs because you've posted screenshots above. Try Mother Rose again but this time hide the HUD with g_showHud and test the shader directly with g_testPostProcess. At least then we will know for certain if it's the gui overlay or not.


  • Anderson likes this

#27 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1421 posts

Posted 18 July 2017 - 10:20 AM

Indeed my friend, Im afraid it seems to be the GUI implementation. I've tested both versions, following the instructions, and Im always getting the same result. First, there's a black screen with little color dots. If I move around, randomly I get a picture, visually the shader is working as intended, but there is frequent freezing (only the image freezes, I can hear the game going on underneath). It happened in The New Job, Saint Lucia, Training Mission, even my own testing map, the one I used to post the pictures (it doesnt have any portals). My guess is that it was working flawlessly for me before because I was simply applying the shader to the bound sphere. I didnt even try using the g_test command before, thats why I didnt notice the issues at the time.

 

My settings are these, if relevant: ambient rendering - simple, interaction shader - default, post processing - disabled, no bloom.


Edited by RPGista, 18 July 2017 - 10:24 AM.

  • Anderson likes this

#28 rich_is_bored

rich_is_bored

    Advanced Member

  • Member
  • PipPipPip
  • 856 posts

Posted 18 July 2017 - 02:39 PM

I've tested with your settings and I replicated the freezing picture. I've narrowed it down to post processing being disabled. It makes sense since you're telling the engine that you don't want to run post processing effects.

 

The peculiar thing to me is that anything is visible at all. If you've disabled post processing then in the material shader the conditional "if (fragmentPrograms == 1)" should evaluate to false and the entire stage should be skipped. And yet even on my end, I'm still seeing color grading with post processing disabled.

 

As for the black screen with color dots, that must be unique to your hardware setup. For the record I'm using an NVidia GeForce GTX 970.



#29 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1421 posts

Posted 19 July 2017 - 10:44 PM

I'm having trouble with this. The post process works half the time and at seemingly random looking angles the screen stops rendering. Without bloom it looks like the image is frozen, with bloom it quickly blooms up to a white screen.

I tried playing with switching interaction shaders, vsync and full screen without any success. It doesn't matter which map I use.

 

Unfortunately, turning the post processing option on results in the exact same problem reported by Spooks, the screen quickly brightens to a solid white... 

 

I was looking into the post processing info (here http://wiki.thedarkm...isuals_Tweaking ), perhaps we are having these issues due to the way the mechanics were written into TDM. I have no technical knowledge on the matter, but the way it sounds is that the implementation was not a straight foward affair, and might have altered the way vanilla idtech4 had this set up, in unpredicatable ways? (Assuming you wrotte the program and shader having the original engine in mind) "During development the team of developers ran into several problems with the original HDR implementation, including performance issues and some visual artifacts, that were hard to circumvent given the fact that the source of idTech 4 is still closed. It was then decided not to work on the basis of an actual "High Dynamic Range", but to still maintain most of the resulting effects. The HDR implementation was altered and split up into the new Enhanced Interaction Shader and the HDR-Lite Post-Processing."


Edited by RPGista, 19 July 2017 - 10:47 PM.


#30 rich_is_bored

rich_is_bored

    Advanced Member

  • Member
  • PipPipPip
  • 856 posts

Posted 20 July 2017 - 01:45 AM

Yeah, I've read through that but nothing jumps out at me as the cause of this issue. It does however answer a question I had about how bloom is implemented. The fragment programs responsible; brightPass_opt.vfp and finalScenePass_opt.vfp, are called from within the engine. The color grading shader cannot be implemented in the same fashion without modifying the TDM codebase and compiling a custom executable. That's fine if it became a core part of the mod but it's not an option for a single mission.

 

However, there are some slight differences in the materials that may be worth looking into. Take for instance postprocess/finalScenePassOptimized...

material postprocess/finalScenePassOptimized {
    noshadows
    noimpact
    sort    postProcess
    {
        rgba 1
        vertexParm        0     parm0, parm1, parm2, parm3        
        program        finalScenePass_opt.vfp

        fragmentMap 0 forceHighQuality     _currentRender
        fragmentMap 1 linear             _bloomImage
        fragmentMap 2 nopicmip             _cookedMath
    }
}

There is no conditional. "rgba" is set to 1. _currentRender is passed to the fragment program with the parameter forceHighQuality. I can't see what good those changes would do but it might be worth making similar changes to the color grading material so it more closely matches other post process effects. Something like this ...

textures/postprocess/sepia
{
    noshadows
    noimpact
    sort    postProcess
    {
        rgba 1
        vertexProgram clut.vfp
        fragmentProgram    clut.vfp
        fragmentMap 0 forceHighQuality _currentRender
        fragmentMap 1 linear textures/clut/sepia_clut.tga
    }
}

Also, if you suspect bloom and such is interfering with the clut shader, you can override brightPass_opt.vfp and finalScenePass_opt.vfp with dummy files (empty files with no content). The console will complain about it but the net result is those graphics calls will be skipped.

 

I can't test this since it's working on my end. Out of curiosity, what GPU are you using?

 


  • RPGista likes this

#31 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1421 posts

Posted 20 July 2017 - 08:13 PM

Amazing, making those changes to the material actually fixed the problem! This is brilliant. I was able to playtest for quite a while without any glitches whatsoever. The only downside is that you still get the freezing problem if you turn postprocessing off in the menu settings (or, presumably, if you have it off when starting a mission). So you must have/keep post processing (bloom) on when playing the game with the color grading shader. Do you think theres a way for the shader to force this, and override the menu setting?

 

PS: This feature is so cool, I cant see any reasons for it not to be a part of the core game (apart from the implementation work load, of course). All we would need is for the post processing setting to be always on (and greyed out) whenever the color grading setting were to be set to on.


Edited by RPGista, 20 July 2017 - 08:24 PM.


#32 rich_is_bored

rich_is_bored

    Advanced Member

  • Member
  • PipPipPip
  • 856 posts

Posted 21 July 2017 - 12:50 AM

That's surprising. I wasn't expecting it to work.

 

Was it editing the material shader alone that did the trick? I'll have to update the package accordingly.

 

I'd really like to put the conditional back in provided it doesn't break anything. Skipping the color grading process is the proper fail safe in the event someone has turned off post processing. Color grading isn't so critical that your map should be unplayable without it.



#33 RPGista

RPGista

    Advanced Member

  • Member
  • PipPipPip
  • 1421 posts

Posted 02 August 2017 - 09:49 AM

Sorry, couldnt find the time to play with this further. I shall mess with the args a bit to see if I can pinpoint what made the difference.

Edited by RPGista, 02 August 2017 - 09:49 AM.




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users