Material That Ignores Ambient Light?

Is there a way to flag a particular material such that it won’t be affected by ambient light settings?

Actually, maybe it’s a bit more complicated than that.

In this image, I’m showing an overhead view of a dungeon corridor. Basically I’m just pulling my camera out above the scene and looking down. This is a snapshot from the actual running game - i.e in terms of rendering. This overhead view will eventually form the mini-map for the game.

In the dungeon there are illusionary walls, so I need to hide those tunnel sections from this overhead view. I’m doing this by placing a flat(ish) cube over the tunnel section with a diffuse black material on it.

No matter what I do though - it always appears as grey, as you can see in the image (large grey section on left). There are no lights in the scene by the way.

I’ve just tried turning the ambient lighting completely to black, and that hasn’t helped so maybe my problem is elsewhere.

Anyone have any ideas? Basically, why would my black material be showing up as grey?

Bumping this just once cause I’m desperate :slight_smile:

I don’t know what’s going on, but your shader is overkill. This is the simplest shader you can use to make something black.

Shader "Black" {

SubShader
{
	Pass {}
} 

}

I’m not specifically using my own shader - just creating a material with its diffuse color set to black and then dropping that onto a cube.

I’ll play around again tonight and see what happens. There has to be some light coming from somewhere - that’s the only answer I can think of.

It wouldn’t matter, if your texture was black; Light can’t brighten up a black texture. I realize you’re not using your own shader, but considering you don’t need a texture, you don’t need the diffuse shader. It’s a waste. If you really love that diffuse shader, and think using what I posted is so complicated, then by all means, go into Photoshop and make a 1x1 pixel black image. :stuck_out_tongue:

Or maybe I’m just not too familiar with shaders etc and wasn’t totally sure what you meant. No need to be rude about it man.

Sorry, to me, it sounded like you were just completely discounting my suggestion. So I perceived what you said as rude. I don’t think I was rude, but feel free to interpret it that way. Regardless of what you do, either of my suggestions should work!

I’m sure you already know this, but just in case anyone who doesn’t reads this, it isn’t really safe to use textures of such low dimensions. I tend to use 32x32 as a minimum to be safe, although I’ve never actually witnessed any problems with anything less than 8x8. Below 8 pixels (or beyond a width/height ratio of 8:1 or 1:8, I have seen problems. Not sure offhand if they were driver problems, hardware problems or what, but there were occasional nasty issues either way.

I don’t think either of us meant to be rude :slight_smile: Just another case of tone getting messed up through text.

I appreciate all the advice I can get from you guys. It hadn’t even occurred to me that I don’t even need a texture. I’ll play around and see what I can do with what you’ve mentioned here.

Thanks mate.

I’ve never seen an issue myself, but I’ve only used really low-res textures a few times. Thanks for the warning.

For anyone who ever comes across a similar issue to my original post, the answer to why my black material appeared grey… fog :slight_smile:

Hah! In that case, the second idea wouldn’t help at all! But the first is still your best solution for something that needs to be black.

I’ve removed the material from the cube altogether as per your advice, and just added a little scrap of code to the camera movement script:

RenderSettings.fog = false;
RenderSettings.ambientLight = Color.black;

(and obviously the reverse when the map is turned off)

Overall, works pretty nicely as a map that can be toggled off and on.

What about swapping layers and disable the camera form certain layers. So when you open a wall, change its layers and there’s your updated minimap