• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

GeDoSaTo - Downsampling from Infinity and Beyond!

Thanks :)

I kept getting crashes in Darksiders 2 when trying to capture screenshots. Maybe I was pushing the res too high (that game runs like crap due to non-existent SLI support).
 

Durante

Member
Sorry about that, I thought I had added the reloadShaders command to the file.

Is it just me (probably) or is there something wrong with the film grain code?

I'm currently here

Code:
	float3 noise = float3(pnoise3D(float3(rotCoordsR*float2(width/grainsize,height/grainsize),0.0)));

That seems fine as long as pnoise3D returns a float3, but looking at pnoise3D

Code:
float pnoise3D(in float3 p)
.
.
.
	// Blend contributions along z
	float n_xyz = mix(n_xy.x, n_xy.y, fade(pf.z));

	// We're done, return the final noise value.
	return n_xyz;

It returns a float value. As a result, I'm getting this error



This seems wrong, but I could of course just be doing something wrong as I'm unfamiliar with this.

For what it's worth, all of the original values were vec, vec2, vec3, and vec4 values so it may have something to do with an inherent difference between vec and float values, but there doesn't seem to be a vec data type I can use.

Any one have any ideas?
If I had to guess, it's the inner float3 that's the problem, not the outer one. The outer one is just the variant which initializes all 3 values with one float. The inner one appears to be something which exists in GLSL but not HLSL, that is, initializing a float3 by a float2 and a float.

Code:
        float2 rot = rotCoordsR*float2(width/grainsize,height/grainsize);
	float3 noise = float3(pnoise3D(float3(rot.x,rot.y,0.0)));

(Note I'm typing untested code in a message board here, so there's almost certainly something wrong :p)

When you have problems in a line like that it can always help to split it over multiple lines. If the above doesn't work you could go even further like this:
Code:
        float2 rot = rotCoordsR*float2(width/grainsize,height/grainsize);
        float pNoise = pnoise3D(float3(rot.x,rot.y,0.0));
	float3 noise = float3(pNoise, pNoise, pNoise);
 

Alo81

Low Poly Gynecologist
If I had to guess, it's the inner float3 that's the problem, not the outer one. The outer one is just the variant which initializes all 3 values with one float. The inner one appears to be something which exists in GLSL but not HLSL, that is, initializing a float3 by a float2 and a float.

After doing that and a bit more tweaking... it runs!

It doesn't function at all as intended, but it's running!

Example in game
http://a.pomf.se/qsnhyo.webm

Time to debug!

If anyone sees anything that's a plainly obvious mistake, feel free to let me know.

Link to current buggy grain code

I had to create functions for fract and mix which may be wrong.
I added 2 more parameters for coorRot so I could pass in the width and height.
Width and height are taken from tex.x and tex.y
There's this part
Code:
vec2 texCoord = gl_TexCoord[0].st;
Where I couldn't figure out what to replace it with, so I used
Code:
float2 texCoord = float2 (tex[0], tex[1]);
which seems wicked wrong!

There's probably a lot more but if anyone else is interested in taking a look at it the data is there in it's current state.
 

Durante

Member
Some hints:
- GLSL fract() is HLSL frac()
- GLSL mix() is HLSL lerp()
- .s and .t are the same as .x and .y or .r and .g (all of them refer to the first and second element respectively, you generally use s and t for texture coords, x and y for space coords, and r and g for colors)
 

Alo81

Low Poly Gynecologist
Some hints:
- GLSL fract() is HLSL frac()
- GLSL mix() is HLSL lerp()
- .s and .t are the same as .x and .y or .r and .g (all of them refer to the first and second element respectively, you generally use s and t for texture coords, x and y for space coords, and r and g for colors)

I did end up finding the bolded out. The frac() and lerp() methods are a GREAT help. replacing mix with lerp solved the "oh god why is this endlessly spinning" issue. Now it's got that same blinking in and out while intensity fades in and out, but at least it's not spinning!

It seems like there's no actual noise, so I'm gonna take a look at that section and see if I can figure anything out. I may end up checking it out tomorrow. It's too late over here.
 

RVinP

Unconfirmed Member
I am using the new SSAO technique with Dark Souls 2, it appears to be faster than the game's implementation? or is it just a placebo effect?.

Edit 2: SSAO with the tool, it looks loads better than the weird game's implementation.
 

Durante

Member
It's probably a bit slower than the in-game one (that one renders at quarter res). But it's much much much higher quality, and after the latest updates it's also very fast.
 

Jelle

Member
Great to see people contributing and working together :) The developments are amazing.

I just stumbled across this blog post of Timothy Lottes, he's made a fantastic CRT shader:

lottescrt_by_jelbo-d7wqbfm.png


Growing up in the era of the CRT "CGA" Arcade Monitor was just awesome. Roughly 320x240 or lower resolution at 60 Hz with a low persistence display. Mix that with stunning pixel art. One of the core reasons I got into the graphics industry.

Built the above Shadertoy example to show what I personally like in attempting to simulate that old look and feel on modern LCD displays. The human mind is exceptionally good at filling in hidden visual information. The dark gaps between scanlines enable the mind to reconstruct a better image than what is actually there. The right most panel adds a quick attempt at a shadow mask. It is nearly impossible to do a good job simulating that because the LCD cannot get bright enough. The compromise in the shader example is to rotate the mask 90 degrees to reduce chromatic aberration. The mask could definitely be improved, but this is a great place to start...

Feel free to use/modify the shader. Hopefully I'll get lucky and have the option to turn on the vintage scanline look when I play those soon to be released games with awesome pixel art!

I hope it's possible to make that work together with GeDoSaTo.
 

Alo81

Low Poly Gynecologist
Edit: I've learned I can replace texture2D with tex2D and have done such now. Post edited below.

Edit 2: I've tracked it down to noise being what causes the blinking. Old post in quotes below~

It seems like the grain is applying to the entire screen at once, rather than a per-pixel basis like it should. I believe I've nailed down the below as the cause

Code:
vec3 col = texture2D(bgl_RenderedTexture, texCoord).rgb;

I'm assuming that this takes the RGB value of a specific pixel that is at texCoord of the passed in image bgl_RenderedTexture.

Here's all of the relevant code as is if anyone wants to take a look.

Code:
uniform sampler2D bgl_RenderedTexture; //rendered scene sampler
float2 tcor : TEXCOORD0;
.
. //bunch of code
.
float4 GrainPass( float4 colorInput, float2 tex ) 
{
	float2 texCoord = tcor;
.
.
.
	float3 col = tex2D(bgl_RenderedTexture, texCoord).rgb;

	//noisiness response curve based on scene luminance
	float3 lumcoeff = float3(0.299,0.587,0.114);
	float luminance = lerp(0.0,dot(col, lumcoeff),lumamount);
	float lum = smoothstep(0.2,0.0,luminance);
	lum += luminance;
	
	
	noise = lerp(noise,0.0,pow(lum,4.0));
	col = col+noise*grainamount;
   
	return float4(col,1.0);
}

I was originally using colorInput.rgb for the value of col, but that changes the color of the whole image. Does colorinput have coordinate values as well or something maybe? I don't know!

In the current implementation, it is simply a blinking image, with none of the original image showing through. I believe that means I need to incorporate the "colorInput" somewhere, but I'm not certain where just yet. It looks like color input comes from

Code:
float4 c0 = tex2D(s0, tex);

I've tried replacing the tex2D from above with this

Code:
float3 col = tex2D(s0, tex).rgb;

but I get the original issue of it seeming to apply one noise pixel to the entire screen.


All help appreciated.
 

Buburibon

Member
Been playing a little DaS2 dlc and am I crazy or does the new SSAO code make a bright halo around the character?

I did notice it too last night while
farming souls in the Giant Lord memory
. SSAO strength was set to "high" at the time. Taking it down a notch to "medium" seems to have solved the problem for me.
 

Levyne

Banned
I updated gedosato for the new dlc, but I don't see any different with enabling and disabling ao or aa through the numpad toggles? I've uncommented that file so they are just set to defaults. Do I have to disable the aa and ao in game?
 

Alo81

Low Poly Gynecologist
I updated gedosato for the new dlc, but I don't see any different with enabling and disabling ao or aa through the numpad toggles? I've uncommented that file so they are just set to defaults. Do I have to disable the aa and ao in game?

Enable AA in game, disable AO in game.
 
I don't quite get Castlevania: Lords of Shadow 2. Does it only take 16:9 resolutions?

And it only seems to accept resolutions that I've already created in the nvidia control panel (up to 5120x2880, no higher). I have to set my desktop to that res before launching the game.

EDIT: I tried forceAlwaysDownsamplingRes true - which caused the first resolution to appear (the rest were ignored). But setting the res to that crashed the game.

EDIT 2: If the res in the game's config file is the same as the first GeDoSaTo downsampling resolution, it seems to work. But only 16:9 resolutions. Otherwise it boots up in 640x480

EDIT 3: Alt-tabbing results in a crash 100% of the time too. FFFFUUUUUU
 

Parsnip

Member
I don't quite get Castlevania: Lords of Shadow 2. Does it only take 16:9 resolutions?

And it only seems to accept resolutions that I've already created in the nvidia control panel (up to 5120x2880, no higher). I have to set my desktop to that res before launching the game.

EDIT: I tried forceAlwaysDownsamplingRes true - which caused the first resolution to appear (the rest were ignored). But setting the res to that crashed the game.

EDIT 2: If the res in the game's config file is the same as the first GeDoSaTo downsampling resolution, it seems to work. But only 16:9 resolutions. Otherwise it boots up in 640x480

EDIT 3: Alt-tabbing results in a crash 100% of the time too. FFFFUUUUUU
It doesn't work at the moment. Best to use hardware downsampling and set desktop to that resolution, as you have already discovered.
 

Alo81

Low Poly Gynecologist
I just realized that the specular maps use transparencies, so now I can add appropriately shiny highlights to non-shiny textures!

screenshot_2014_08_27_00_36_27_0_by_aloo81-d7wu7tf.jpg


No longer shall my helmet be dull and matte, and with a stylish insignia on my cape I shall get decimated by new DLC monsters!

Thanks SageThumbs for showing me the transperencies that photoshop immediately throws away upon loading a TGA file!
 

BONKERS

Member
I don't quite get Castlevania: Lords of Shadow 2. Does it only take 16:9 resolutions?

And it only seems to accept resolutions that I've already created in the nvidia control panel (up to 5120x2880, no higher). I have to set my desktop to that res before launching the game.

EDIT: I tried forceAlwaysDownsamplingRes true - which caused the first resolution to appear (the rest were ignored). But setting the res to that crashed the game.

EDIT 2: If the res in the game's config file is the same as the first GeDoSaTo downsampling resolution, it seems to work. But only 16:9 resolutions. Otherwise it boots up in 640x480

EDIT 3: Alt-tabbing results in a crash 100% of the time too. FFFFUUUUUU

We've had this conversation before.

If you have Nvidia hardware, using 4xSGSSAA+ Some driver downsampling will probably have the best results. (If you have the GPU power that is)


There is also http://www.neogaf.com/forum/showpost.php?p=126709928&postcount=2538 Maybe that's worth a shot. /shrug. Otherwise LoS2 is dead in the water
 
We've had this conversation before.

If you have Nvidia hardware, using 4xSGSSAA+ Some driver downsampling will probably have the best results. (If you have the GPU power that is)

There is also http://www.neogaf.com/forum/showpost.php?p=126709928&postcount=2538 Maybe that's worth a shot. /shrug. Otherwise LoS2 is dead in the water

This was 6720x3780 via GeDoSaTo (cropped):


Looks good enough. I may try lowering the res and using SGSSAA though to see how it looks. Some things in this game still look way too sharp
 

BONKERS

Member
This was 6720x3780 via GeDoSaTo (cropped):



Looks good enough. I may try lowering the res and using SGSSAA though to see how it looks. Some things in this game still look way too sharp

My guess is that's because maybe the artwork was designed with FXAA in mind as that's it's built in AA and what was used on consoles.

A few other games have done similar things before.

When I tested SGSSAA with the game with the demo, it doesn't produce the best edge quality. But temporally was a lot better on many aspects. 2x2+built in AA had better IQ but worse temporal aliasing.

But also I didn't really read "EDIT 2: If the res in the game's config file is the same as the first GeDoSaTo downsampling resolution, it seems to work. But only 16:9 resolutions. Otherwise it boots up in 640x480" The first time.

So you can successfully downsample this way without issue?

In the above shot are you using the built in FXAA to downsample with, or SMAA?
 
In that shot I'm just using SMAA. I might try and turn on the FXAA and see what happens.

I did get downsampling to work though. It requires me to do a few things:

1. forceAlwaysDownsamplingRes true
2. Only the first 16:9 downsampling resolution is accepted by the game and has to be set in the game's config file before booting
 

Parsnip

Member
I never got any resolution from GeDoSaTo to work with LoS2. I got them to show up but changing them in-game would cause black screen. And changing from ini seemed to initially work, but when I checked the overlay, it wasn't actually downsampling.

Pain in the butt either way.
 
Does anyone have a custom VSSAO2.fx for much stronger AO? I'm currently using high, but I feel like Dark Souls 2 needs something a bit stronger. Like this:
12027.jpg

What could I tweak to make the AO like this?
New SSAO code is great by the way :D Awesome work.
 

Alo81

Low Poly Gynecologist
YEAAAAAAAAAAAAAAAAAAAAAH!



Film grain pull request submitted!

It's hilarious how ridiculously crazy the code was starting to get, compared to what was actually required of the final code. Unsuprisingly, it ended up being a loooot closer to the original shader code than where it was headed halfway through.

I feel like I've got a much better understanding of what things like tex and colorInput actually mean and do now.

Huge thanks Durante for helping me get it all finished.
 

BONKERS

Member
after you enable it the second time are you adjusting it in realtime?


Looks good. Though something about that grain strikes me like it's being sharpened almost. I thought the same thing when I saw the creator's pictures. But I think it's just my eyes goin bonkers.

So does this mean I can download and play around with it too?
 

Durante

Member
Well done Alo, looks quite convincing. I prefer this procedural grain to a more texture-based one, since it should be easier to adjust for all kinds of use cases.
 

Alo81

Low Poly Gynecologist
after you enable it the second time are you adjusting it in realtime?


Looks good. Though something about that grain strikes me like it's being sharpened almost. I thought the same thing when I saw the creator's pictures. But I think it's just my eyes goin bonkers.

So does this mean I can download and play around with it too?

Yeah, when the intensity changed, that was me reloading the shader with a lower strength. I wanted to make it really obvious, then show a more dialed back example.

Durante merged it, so you should be able to update GeDo and grab it now.
 

BONKERS

Member
Well done Alo, looks quite convincing. I prefer this procedural grain to a more texture-based one, since it should be easier to adjust for all kinds of use cases.
What kind of values are adjustable to the end-user in this case for example?

Grain size? Sharpness? Strength? Gain? Luma noise?

NVM
Yeah, when the intensity changed, that was me reloading the shader with a lower strength. I wanted to make it really obvious, then show a more dialed back example.

Durante merged it, so you should be able to update GeDo and grab it now.

Will download and try thanks.
 
I never did thank you properly, Durante, for trying to sort out that Witcher 2 screenshot issue which had nothing to do with GeDeSaTo anyway. When I get paid next I'll remember to drop you a donation.

Here's a new one. When you use GeDoSaTo with Deus Ex: Human Revolution, the bloom doesn't resize properly to the new render resolution. It makes scenes like those in Hengsha look pretty horrible. The same thing happens if you run the game windowed and resize to super high resolutions. Is this just something that can't be fixed?
 
I'm trying to tweak VSSAO.fx file for Dark Souls 2. Is there anyway to play Dark Souls 2 in a window and edit the file to see live updates as i do so? I find it really awkward having to alt tab in and out everytime i tweak a setting.
 

molnizzle

Member
I'm sitting on my couch playing Dark Souls II downsampled from 3840x2160. Obviously capped at 30fps, but my machine doesn't seem to have any issues maintaining that. i5-4570 + GTX 770 2GB. So good.

I can't seem to make GeDoSaTo actually launch with Windows 8.1 though. Any tips?
 
Indeed. In any case, here's a working PSHash for CLOS2.

injectPSHash 3de11d46

Ugh. At a certain point in the game ("The City of the Damned") this stopped working. Now I have to use this:

injectPSHash aa219b4c
injectDelayAfterDraw true

So... yeah. This game really is difficult to work with.
 

Durante

Member
Here's a new one. When you use GeDoSaTo with Deus Ex: Human Revolution, the bloom doesn't resize properly to the new render resolution. It makes scenes like those in Hengsha look pretty horrible. The same thing happens if you run the game windowed and resize to super high resolutions. Is this just something that can't be fixed?
Since it also happens in the windowed case it's extremely likely that it is a game bug.

I wouldn't say it can't be fixed, since it's probably possible to write a game-specific plugin for GeDoSaTo to fix it, but it would take a lot of game-specific reverse engineering to pinpoint and fix the issue (and therefore a lot of time).


I'm trying to tweak VSSAO.fx file for Dark Souls 2. Is there anyway to play Dark Souls 2 in a window and edit the file to see live updates as i do so? I find it really awkward having to alt tab in and out everytime i tweak a setting.
Read my latest blog entry, it describes exactly that process. The keybinding is "reloadShaders".
 
Yeah, certainly don't waste your time on that one. The game's a curious specimen from a tech standpoint.

As it happens, Boris Vorontsov might be helping out with an update to his 'FXIMPLANT' ENB. His HDR actually scales properly and looks better anyway, but the ENB itself crashes the game in windowed mode. These Crystal Engine games only adjust their AR in windowed mode, otherwise they just stick at 16:9 and distort. Boris tried forcing the game into borderless mode but the mere fact it still thinks it's in fullscreen means its AR remains locked.

Hence the problem: without being able to resize the game on-the-fly, playing at one resolution and screenshotting at another, I'm stuck with fixed resolution fullscreen. Not ideal. On the plus side, ENB isn't as exponentially demanding at high res as I thought. In fact, it barely makes a difference.
 

Parsnip

Member
Ugh. At a certain point in the game ("The City of the Damned") this stopped working. Now I have to use this:

injectPSHash aa219b4c
injectDelayAfterDraw true

So... yeah. This game really is difficult to work with.

That's the case with LoS and LoS:MoF as well. Best I could get for LoS was one where the magic meters would still burn when used even when hud was hidden. And I bet that would have broken at some point in some other level. Didn't even bother mess with MoF that much, the dumps for it looked like they would give me a massive headache.
 

Durante

Member
Talking about injection targeting, there's now an "injectVSHash" setting. It does what you would expect, maybe it helps for some games. However, generally I'd expect pixel shader targeting to be more useful than vertex shader targeting. You can also use both and the first one will trigger.

I still plan to impelment regular expression support for both of them at some point (so you can do [hashA]|[hashB]).
 

BONKERS

Member
Since it also happens in the windowed case it's extremely likely that it is a game bug.

I wouldn't say it can't be fixed, since it's probably possible to write a game-specific plugin for GeDoSaTo to fix it, but it would take a lot of game-specific reverse engineering to pinpoint and fix the issue (and therefore a lot of time).


Read my latest blog entry, it describes exactly that process. The keybinding is "reloadShaders".


What about regular fullscreen? With DE:HR and the DC version, with driver downsampling, the bloom and HDR scale with resolution and very well that I saw with my play testing.
 

Durante

Member
I assumed when TheOctagon said "super high resolutions" he didn't mean anything which you could try with driver-level downsampling.
 
Since it also happens in the windowed case it's extremely likely that it is a game bug.

I wouldn't say it can't be fixed, since it's probably possible to write a game-specific plugin for GeDoSaTo to fix it, but it would take a lot of game-specific reverse engineering to pinpoint and fix the issue (and therefore a lot of time).


Read my latest blog entry, it describes exactly that process. The keybinding is "reloadShaders".

Thanks
 
Since it also happens in the windowed case it's extremely likely that it is a game bug.

I wouldn't say it can't be fixed, since it's probably possible to write a game-specific plugin for GeDoSaTo to fix it, but it would take a lot of game-specific reverse engineering to pinpoint and fix the issue (and therefore a lot of time).


Read my latest blog entry, it describes exactly that process. The keybinding is "reloadShaders".
How would I add tonemapping to the Dark Souls 2 post.fx?
Currently I've added
Code:
#define USE_TONEMAP       1  //[0 or 1] Tonemap : Adjust gamma, exposure, saturation, bleach and defog. (may cause clipping)
and
Code:
// Tonemap settings
#define Gamma 1.0                      //[0.000 to 2.000] Adjust midtones
#define Exposure 0.0                   //[-1.000 to 1.000] Adjust exposure
#define Saturation -1.000                 //[-1.000 to 1.000] Adjust saturation
#define Bleach 0.0                     //[0.000 to 1.000] Brightens the shadows and fades the colors
#define Defog 1.0                      //[0.000 to 1.000] How much of the color tint to remove
#define FogColor float3(0.0, 0.0, 0.0) //[0.00 to 2.55, 0.00 to 2.55, 0.00 to 2.55] What color to remove - default is blue
Also I've noticed that even though I have lumasharpen set to 0, the image is still sharpened in DS2. Is there a way to disable all sharpening?
 

Durante

Member
If you want to customize your DS2 postprocessing the best way to do it would probably be to copy the most recent post.fx file (with everything disabled) from the "asset" folder to the DS2 profile folder (replacing the existing one), and go from there.
 
If you want to customize your DS2 postprocessing the best way to do it would probably be to copy the most recent post.fx file (with everything disabled) from the "asset" folder to the DS2 profile folder (replacing the existing one), and go from there.

Cheers. I managed to just copy all of the tonemap settings from the default post.fx.
 

Alo81

Low Poly Gynecologist
Any idea why "bleach" isn't working in Dark Souls 2, in the tonemap settings? Every other tonemap setting appears to work.

I just copied the code straight over from SweetFx. I have no idea what it originally did.

I could look into it.

Edit: I took a quick look and I think I fixed it. I sent a pull request to Durante.
 

Alo81

Low Poly Gynecologist
Cool! What was the issue?

this line

Code:
float3 mixRGB = A2 * newColor;

I changed it to this

Code:
float3 mixRGB = (A2 * newColor.r, A2 * newColor.g, A2*newColor.b);

Also, this was listed nearby in the code

Code:
float A2 = Bleach * color.rgb; //why use a float for A2 here and then multiply by color.rgb (a float3)?
    //float3 A2 = Bleach * color.rgb; //

So I uncommented the second line that declares A2 as a float3 rather than float.
 
Top Bottom