Masked Self illumination support?
by Ben "Djaggernaut" Chavigner · in Torque Game Engine Advanced · 09/17/2006 (3:12 pm) · 9 replies
A simple question, does TSE support masked self illumination like some other 3D softwares?
That is to say, limiting the self illumination to a black and white mask (defining the intensity with the values of grey). This mask could be the alpha channel of a PNG.
As I knew I wouldn't be very clear (and in case someone wants to know too) I've made a quick example for what it would be useful:

That is to say, limiting the self illumination to a black and white mask (defining the intensity with the values of grey). This mask could be the alpha channel of a PNG.
As I knew I wouldn't be very clear (and in case someone wants to know too) I've made a quick example for what it would be useful:

#2
Yes, I'm aware of that technique. But it makes extra polygons. Of course on a simple shape it's not so embarassing, but when you have complex object, it can be a serious increase.
Z-sorting issues can also be a pain in this case... :)
That's why having a mask is simple to setup and could flyby those problems.
09/17/2006 (4:34 pm)
Thanks for your answer Stefan.Yes, I'm aware of that technique. But it makes extra polygons. Of course on a simple shape it's not so embarassing, but when you have complex object, it can be a serious increase.
Z-sorting issues can also be a pain in this case... :)
That's why having a mask is simple to setup and could flyby those problems.
#3
09/17/2006 (5:13 pm)
This going be dump question. What is the major difference between a mask and transparency? I know what book say but I am wondering what an artist would say? What is the best way to make mask.? I used Paint Shop Pro 8. I have only use them in masking the different part of uvmap to make the parts easy selectable during painting. Thanks!
#4
No it doesn't - the shader combines the two layers per pixel. No fuss, no muss, and NO z-sorting.
Assuming you use a shader - not using a shader would be slower, harder to work with, and easier to break, but you could certainly do it if you wanted. :P
09/18/2006 (1:16 am)
Quote:But it makes extra polygons.
No it doesn't - the shader combines the two layers per pixel. No fuss, no muss, and NO z-sorting.
Assuming you use a shader - not using a shader would be slower, harder to work with, and easier to break, but you could certainly do it if you wanted. :P
#5
It doesn't look hard either to do.
Thanks, great tip ;)
09/18/2006 (2:16 am)
Oh sorry, I've been too quick to read, I though you talked about adding a clone of the mesh with an alpha-ed PNG. Wich is more or less the only solution I thought of in TGE. I totally forgot about the layers.It doesn't look hard either to do.
Thanks, great tip ;)
#6


The one to the right being the overlay [ 1 ] and the one to the left being the base texture [ 0 ].
As you can see in the image above there is overexposure of the base layer. I'm not sure why, but it probably has to do with the transparancy and the fact that the engine uses the same channel for specular mapping, too. Hopefully it gets fixed in the future.
Here is the material:
Hope that clears it up a little bit.
09/18/2006 (2:18 am)
Not layer as in putting polygons ontop, but as layering on the shader. It's really not too difficult. First, let's take a look at two bitmaps:

The one to the right being the overlay [ 1 ] and the one to the left being the base texture [ 0 ].
As you can see in the image above there is overexposure of the base layer. I'm not sure why, but it probably has to do with the transparancy and the fact that the engine uses the same channel for specular mapping, too. Hopefully it gets fixed in the future.Here is the material:
new Material(plating)
{
mapTo = "plating";
baseTex[0] = "plating.png";
baseTex[1] = "glowMask.png";
emissive[1] = true;
glow[1] = true;
};Hope that clears it up a little bit.
#7
09/18/2006 (4:42 pm)
The overexposure is probably due to glow being on. Turn it off and you'll get the pure emissive behavior that is seen in the original shots.
#8
Perhaps it wasnt truly transparent when I saved it out.
09/19/2006 (2:11 am)
I tried that before. The only way to get it to look normal was to not have a second layer.Perhaps it wasnt truly transparent when I saved it out.
#9
09/19/2006 (4:17 pm)
Ya, this should be possible without overexposure. On the second pass, make sure everything you don't want glowing is completely(!) black in the texture. Might want to try turning off emissive in second pass as well since the glow is inherently emissive, but it probably won't make much of a difference.
Torque Owner Stefan Lundmark
There are to my knowledge no masks, but you should be able to get the same results by painting on a transparent .png and layer it ontop of your solid material material. Then set the second layer to be emissive, and it will be self illuminated but only to the second layer and not the first.
If I am not clear, I will post images later.