When writing shaders in CG, there is a function called GrabPass that lets you get the rendered scene behind an object as an input to your fragment shader. This lets you do, for example, post processing effects on only the part of the scene behind a given object, as well as doing things like computationally cheap (fake) mobile glass displacement.
I’m still fairly new to UE (about three months in) and haven’t fully wrapped my head around the PBR stuff, and mostly, I haven’t needed to. The past few days, I’ve been trying to understand the material system better and have been trying to figure out how you’d get access to this same data in a material or material instance.
I’ve had zero luck finding anything. The various material nodes like SceneTexture, that look like they might work be what I was looking for have all turned out to be available only in post processing materials.
Any pointers in the right direction would be much appreciated. Thanks!
SceneColor node should do what you want, and you can use that in a translucent material on a mesh in the world, or as a PP material.
Thank you. This does give what I need.
I think I’m starting to understand the way materials work. So, if I manipulate UVs and feed the manipulated values directly into SceneColor, those calculations will happen in the fragment shader. If, instead, I add a UV pin to the material and pass the manipulated UVs into the pin, then I’m doing the calculations in the vertex shader and they are getting interpolated linearly into the fragment shader.
Okay, a little more help please.
If I hook up the Scene Color node to diffuse:
I get pretty much what I expect:
However, I hit problems the second I want to mess with the UVs. If I hook up a TextureCoord node (with no UV pins turned on):
My expectation is that I’ll get the same exact result as before, since I’m just passing the UVs in. But, that’s not what I get (same result, whether I mask the TexCoords or not):
So, either I’m misunderstanding something about the way this works, or there’s a bug. I’m guessing it’s the former, but I don’t know what I don’t know, so to speak.
Hey Jeff -
I answered you also on AnswerHub, but plugging the Texture Coordinate into the Customized UV0 input instead of the UV input of the Scene Color should correct the error that you are seeing.
Unfortunately, it doesn’t seem to fix it, regardless of which UV index I use.