Ported Storybook Shader
- One More Try
- Topic Author
Download
Questions:
What is the minimal, most vanilla way to make a one-pass shader? I got stuck on exactly what the vertex shader needed to do, and I had to define a multi-pass to get it to work.
Is there a proper way to sample from a .tga? I had to convert to .jpg else it looked way too yellow. Better yet, what is the suggested image format for sampling from an image?
What variable is for buffer width/height and what is for actual screen size width/height? The tutorial references buffer_width as screen width. I may be using terms wrong.
Please Log in or Create an account to join the conversation.
- Nerd
a.pomf.se/xxpayd.webm
a.pomf.se/kmovxu.webm
a.pomf.se/rdcjus.webm
a.pomf.se/aqnyyn.webm
Please Log in or Create an account to join the conversation.
- crosire
One More Try wrote: What is the minimal, most vanilla way to make a one-pass shader? I got stuck on exactly what the vertex shader needed to do, and I had to define a multi-pass to get it to work.
Is there a proper way to sample from a .tga? I had to convert to .jpg else it looked way too yellow. Better yet, what is the suggested image format for sampling from an image?
What variable is for buffer width/height and what is for actual screen size width/height? The tutorial references buffer_width as screen width. I may be using terms wrong.
The following is the most simple possible shader doing nothing but returning the input color:
There may be a bug in the TGA reader, which gets colors wrong. I'd use either BMP (stores image data the most simple way) or PNG (lossless too, but smaller, because compressable).
"BUFFER_WIDTH" and "BUFFER_HEIGHT" are two macros expanding to the backbuffer width and height, which equals the screen dimensions or whatever resolution is set in the game options if in fullscreen or the window size if in window mode.
Please Log in or Create an account to join the conversation.
- One More Try
- Topic Author
I don't want to spam you with questions, so I'll keep it down to just two more:
Buffer_width leads us to pixel size, so what gives us texel size? How do I calculate things off an internal rendering resolution (when it's not equal to screen size). I saw tex2dsize, wasn't sure about that - couldn't get it to work or find an example of using it. Poking around, it looks like there might not be a way to pull that information...?
Second. When there are black bars because the game's resolution doesn't equal the window/screen size, Reshade seems to treat it like part of the image it's modifying and fills it in. Seeing this with Dolphin. Are there any easy ways to correct this or would I have to make a pass to detect these areas and then correct the variables?
Please Log in or Create an account to join the conversation.
- crosire
.The backbuffer is the internal rendering target, so its resolution is what you get with those two macros. You're right about derivering the pixel size from there (it's the reciprocal): ReShade thus also defines "BUFFER_RCP_WIDTH" and "BUFFER_RCP_HEIGHT" to "1 / BUFFER_WIDTH" and "1 / BUFFER_HEIGHT" for convenience.
Which texel size do you want? The one of the backbuffer equals the pixel size, the one for other textures can be calculated manually, as their dimensions are known too (since required for creation).
Dolphin renders to the full window resolution, including the black bars, which is why there is no way for ReShade to get the size of just the image without them.
You could check the color value for pitch black and discard rendering if that's the case, though that would have some problems if the game is very dark.
Please Log in or Create an account to join the conversation.
- One More Try
- Topic Author
Yeah. I was thinking you could edge detect the black borders and get what coordinates they start at. If that's possible then maybe you could modify everything to keep them black, but more importantly not include them in how it samples (like sampling at a widescreen res can stretch my noise.img)? The more I think about it, the more complicated it sounds. There may be simpler workarounds.
Please Log in or Create an account to join the conversation.
- crosire
Here's an idea for black border detection.
Please Log in or Create an account to join the conversation.
- Nerd
This little tool is amazing! It's much better than the Dolphin shader tweaker, the reset key is a godsend.
Some suggestions I have(mainly because I'm too dense to figure it out) would be to make the shader it's own .fx so I can hook it into mastereffect's reshade.fx [strike]and for a toggle key[/strike](the intensity slider works for this actually). It seems like when I rename your shader and include it into reshade.fx the game becomes unstable with odd crashes. Maybe I'm doing something wrong though.
What kind of multi-pass shaders are you thinking about?
Please Log in or Create an account to join the conversation.
- One More Try
- Topic Author
Thanks so much Crosire! I came up with the same idea to run it once, run only until it hits a color, and also in the middle of the y-axis where it's less likely to have any issues (if we assume the borders are only on the left and right). I was floundering in actual implementation, so you've really helped me there. I can practice multi pass shading with that.
/edit Wow!! Looking it over in more detail you really did all the work for me. Glad I attempted it myself too. I can compare to better understand how to get to where I wanted to be. One question. The inserted, sampled .png gets stretched when there are borders. I don't think this fixes it. At what point would I connect it to the viewport dimensions so it gets scaled properly?
@Nerd (He's talking about my program that uses sliders to edit my .fx file).
Thanks, I'm glad it's useful! I'll get around to posting a new version with that program at some point. I can also add a toggle on/off.
I have no idea how to add it to mastereffect, but I plan on figuring that out at some point. By what method are you hooking it?
Other than the border fix, not sure on other multipass. There are other single-pass things I found to play with and maybe cross add to dolphin.
//Edit 2:
" Render the result of the CalculateViewport function into a texture ("viewportTex") only once (at start of post processing)."
I know this has to happen so it doesn't lag everything. I don't see any code in your example, nor tutorial file to make this happen. Right now it runs continually as far as I can tell. Another issue is that startup can be very black, so offsetting this one pass to a later point could make it more accurate (I could always make the user reload the shader if they need it). Other than that, I have it working well.
Please Log in or Create an account to join the conversation.
- Nerd
Please Log in or Create an account to join the conversation.
- crosire
Just scale the texture coordinates by those viewport dimensions before sampling:One More Try wrote: One question. The inserted, sampled .png gets stretched when there are borders. I don't think this fixes it. At what point would I connect it to the viewport dimensions so it gets scaled properly?
ReShade supports rendering multiple techniques, so just include this file into the MasterEffect shader, or the other way round. It will work. Not the best possible performance though.One More Try wrote: I have no idea how to add it to mastereffect, but I plan on figuring that out at some point.
With "only once" I meant "only once per frame", instead of per pixel. You could also run it only once globally:One More Try wrote: I know this has to happen so it doesn't lag everything. I don't see any code in your example, nor tutorial file to make this happen. Right now it runs continually as far as I can tell. Another issue is that startup can be very black, so offsetting this one pass to a later point could make it more accurate (I could always make the user reload the shader if they need it). Other than that, I have it working well.
Please Log in or Create an account to join the conversation.
- Nerd
Please Log in or Create an account to join the conversation.
- Ganossa
Add your resources (shader files and textures) to the CustomFX suite folder.
Add an entry for your shader in the Pipeline.cfg such as "#include EFFECT (CustomFX, YouShaderFileName)".
Add a shader entry to the CustomFX.cfg (use the custom entry in that file as a reference). Make sure to have the "#define USE_YOURSHADERNAME 0 //[YourShaderFileName]" line.
Adjust your shader file content to fit the format of the Custom.fx file which can be found in ReShade/CustomFX. So make sure all the USE, #includes, toggles and similar are set.
Please submit your proposal to our github repository and it will very likely be in the next release
Does that help or do you need any more information?
Please Log in or Create an account to join the conversation.
- Nerd
Please Log in or Create an account to join the conversation.
- Ganossa
The Mediator was changed accordingly and will be named ReShade Assistant with the next release:
Due to those changes, it should might become easier for you to add new shader to the framework.
In the GitHub changes, you can simply make a copy of YourName.cfg, YourName.undef, YourName folder and the "#include EFFECT(YourName, YourShaderName)" entry in pipeline.cfg.
Replace YourName/YourShader name in those files with your name and your shader name.
After that, you can simply copy your relevant shader content into the YourShaderName.fx file and place your relevant shader variables in YourShader.cfg.
Please Log in or Create an account to join the conversation.
- Sh1nRa358
Please Log in or Create an account to join the conversation.
- Nerd
Please Log in or Create an account to join the conversation.
- xley
seems like the dl link is down.
Please Log in or Create an account to join the conversation.
- hunt1hunt
- Sekkei
Works with sliders in 3.0
You need a image as 256x256 png named "noise.png"
Please Log in or Create an account to join the conversation.