A Beginner's Guide to Shaders

Strangely enough the player doesn't even have a pre/post draw its just funnelled through main's draw so I'd need to utilize something like a projectile instead of custom drawing for what I am trying to do.
Because the player is a ton of drawing calls in a list of something called player layers, if you want to alter the vanilla layers your going to have to likely use some IL editing (not really a good idea unless you know completely what your doing, vanilla layers use dye shaders) or otherwise mess with the layers (you could add your own layer if you need to draw something new over the player, you can add a new layer, draw whatever, and give that the custom shader and then reset the spritebatch)
 
The post talked about how screen shaders can flip your screen upside down if you wanted to. Is it possible to flip the screen horizontally when a boss attacks?
 
Wow, finally made an account here specifically for this question...
Can you call a shader inside another shader?
I just wrote a piece of 'wrapper' math that acts like an image mask - essentially a more complicated version of the demonstration gradients.
Ideally, I'd like to be able to slap this function onto/around any of the other shader functions (passing it parameters as needed), but I've never used C# before so I don't know how to do that properly. (I'm assuming that on some level, shaders are Just A Kind Of Function, and there's no deep hardcoded witchy magic constraining what you can do with them???)

I think this would require adding an additional parameter that holds the name of the shader you're specifically passing in?
 
"The name filterRef does not exist in the current context"
I am using Microsoft.Xna.Framework.Graphics Terraria.Graphics.Effects and Terraria.Graphics.Shaders.
 
"The name filterRef does not exist in the current context"
I am using Microsoft.Xna.Framework.Graphics Terraria.Graphics.Effects and Terraria.Graphics.Shaders.
Send code bruh
 
I tried to compile a shader and this bug appeared

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Xna.Framework.Content.Pipeline, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553' or one of its dependencies. The system cannot find the file specified.
at DynamicFontGenerator.Generator..ctor()
at DynamicFontGenerator.Generator.Main()
 
With most shaders they can run several passes, looking at the code in more detail it would seem terraria will only process one pass?
How would I go about managing multiple passes on the same shader?

Also is it viable, because of instruction limit I want one pass to do my actual effect, second pass to do some clean up or validation and another pass to do extra things.
Extra things could probably be processed by a separate shader but that requires a second slot loading
 
How would I pass in two colors for a gradient?
 
How would I pass in two colors for a gradient?
To pass in a second color, use UseSecondaryColor() just like how you would use UseColor().
 
mac alt to easyxnb or fxcompiler?
 
Can I compile shaders on macOS? I cannot use fxcompiler and easyXNB through wine for some reason.
 
I'm extremely late to the party, but I'm wondering-- is there any way to access lighting data in a screen shader without writing custom uniforms and rewriting a bunch of the shader code? In a perfect world it'd be awesome if I could do a godot-style light() function in shader, which runs for every light source in range of a given pixel, but pretty much anything that gets me lighting data would work. Also, would there be a way to generate a texture containing purely the opaque/non-background objects in a scene? If I could get that, I could do a simple SDF calculation w/ jump flooding :3

(I can probably figure out all this on my own but I don't want to waste a bunch of time on smth for which the answer is already known/which the answer is that it's infeasible without a major restructuring of the terraria render pipeline)
 
Back
Top Bottom