Download

Postprocessing, translucency, subtracting colours and more!

Hello there.

So, for background, I’m trying to mod Xcom 2. It comes with a cut-down version of UE3, it seems. I’ve got pretty far, and now I’m trying to make an effect which greyscales everything except the reds in the scene.

The PostProcessing Chain is exposed, so I’ve dropped a material effect in there. I’ve more or less got it working, but some elements are ignored.

Here’s the original scene: http://i.imgur.com/WpQzbph.png
Here’s it with my material applied to the postprocessing chain: http://i.imgur.com/nams59J.png

You can see that (some of) the reds are still in place (lights), but some things aren’t (windscreens, icon on the back barrier).

I’m guessing this has to do with emissive colours vs base colours, and translucency, but I don’t really understand enough about how materials work to take it to the next step.

So, I’m hoping one of you kind fellows can help me out. I can post my current material pipeline(?) to show what you I’ve done so far if that’s helpful, but essentially, I’m taking a scenecapture, deleting the green and blue channels, putting it through a cheapcontrast, for the alpha channel on a lerp between greyscale and the red-only channel. The subtraction prevents whites being painted as bright red, which was previously a problem.

But, I suspect there’s a much easier way to do this. Basically, I was to overlay the original reds (not including purples, whites, etc) over a greyscale of the image.

Thank you in advance.

I sort of worked it out. But! Follow up question.

There’s an effect where some of the actors can be seen through the walls with a particular material applied. I can’t understand at all how they’re achieving this.

Here’s an example: Imgur: The magic of the Internet

See how the darker one is cut out against the terrain, but more than ~50% of the model is obscured, it takes a different texture. Can anyone help please?

Thanking in advance

See this tutorial: Rendering occluded actor

Thank you so much!

So, I’m sort of getting somewhere. But also sort of not. Because I’m modding something vs writing from scratch, I’m somewhat limited in what I have access to.

However, here’s where I am. In the editor, I’ve dropped in an alien, and made a green material and applied it. I’ve set it to SDPG Foreground - you can see it rendering through the wall.
Here it is:
HFPMtrz.png

I’ve also created a postprocess material which does this (the image is skewed because the image preview does nasty things):
kzXywvy.png

This is the material I’m using, in case you’re curious: http://i.imgur.com/C2HgL3b.png

In Xcom, I’m injecting a Process Process effect using the material created above, and changing all the pawn materials to use the green tint.


foreach B.AllActors(class'XComAlienPawn', Pawn) {
		Pawn.Mesh.SetDepthPriorityGroup(SDPG_Foreground);
		`Log("DPG:" @ Pawn.Mesh.DepthPriorityGroup);
		for(i = 0; i < Pawn.Mesh.GetNumElements(); i++) {
			`Log("Mat" @ Pawn.Mesh.GetMaterial(i));
			// Pray this works
			Pawn.Mesh.SetMaterial(i, Material(`CONTENT.LoadObjectFromContentPackage("PostProcessGreyScaleScan.Test.Green")));
		}
	}


It’s definitely setting things to the foreground, because the log shows this:
3671ccc7939d8cc9c6598e72b7babb52357dfac3.png

Here’s what it looks like in-game:
ggdt8xe.png

But! When I turn on the PostProcess Effect, I get this:
Hm92zcU.png

The troops are see-through. Also, they don’t render through terrain/walls/etc as they do in the editor. What could I be doing wrong?