Finding the Difference Between Two Texture Samples

Hello, so up till now I’ve been using Paint.net to manually generate emissive masks for my sprites, although I’ve found it isn’t very accurate and a solution inside the engine would be much more effective.

As you can see from my sprites, I have one sprite with all lights off, one with the left light on, and another with the right light on.

Here is what I want to achieve:

135383-emissive_mask.png

So effectively the difference between the two is what I’m looking for then desaturated, and then I’ve already got the rest sorted.

Thanks,
Alfie :slight_smile:

Hey Alfie,

This can be achieved in you material using the Blend_Difference node.

I grabbed this texture off google: https://s-media-cache-ak0.pinimg.com/736x/99/c1/9f/99c19fe9cb58c369f88761446d4d68fb.jpg

In my material I imported the both of them and grabbed the Blend Difference node which shows the color difference as seen below:

Now we just desaturate the result to get a black and white different node.

Thanks for the response! I’ve tried this before but just got pretty low quality results, which I presume may be related to my textures resolution, which is 256x256. Anyway, here is the result, which as you can see isn’t perfect.

Is there any other way to do this without the result being so distorted?

Thanks,
Alfie