Lightmap Family Mod Help :)

Hi guys,
this is my first post on the forum :).
Is there any way for the lightmap not to affect the illumination, but just modulate over the base texture?

Thanks. :slight_smile:

do you mean bake?

and welcome to the forums.

I would like to modify the LightMap Shaders Family for have an effect similar to the Multiply blending mode of Photoshop, without affect the illumination on the mesh. The mesh should be lit by real light in the scene. In other words, I want multiply a baked occlusion (generated with a secondary uv) on the color, mantain the parameters of the LightMap Shaders Family (specular,normal diffuse, normal specular, and so on).

you can merge shaders together that are on the wiki to make that, you’ll have to do them yourself but it is possible.

That’s all a lightmap is. A multiply with the texture. It doesn’t actually generate light or anything.

Lightmaps do modulate the base colour. With a lightmapped shader, you will get:

result = lightmap*base + dynamicLights*base

Essentially, the lightmap is treated as an extra, pre-computed light. How does what you want differ from this?

Thanks to all for the replies.
I try to explain better what i want to obtain.

For example in Unity there are the builtin “Specular” and “Bumped Specular”.

How can I modify the shaders for modulate my occlusion (secondary uv) over the main texture?

The Lightmapped shaders all use the second UV set for the light map texture. Just put your occlusion map in there. If you want bump and/or specular from the base texture, use Lightmapped/Specular or Lightmapped/Bumped Specular.

If you’re having trouble with the second UV set, it could be that it’s not importing properly.

If i turn off a PP light the mesh became like self illuminated, because, infact, lightmap affect che illumination on the mesh.
I don’t want the “lightmap effect”…forget lightmap family for now :).

I would like simply multiply the occlusion color on the main texture color , in the specular and bumped specular shaders.

Something like this:

			SetTexture [_MainTex] { Combine texture * primary DOUBLE}
			SetTexture [_MultiTex] { combine texture * previous}

but in don’t now how to integrate it in the specular and bumped specular shader.

Bye.

Ok, from the code you’ve written it sounds like you want to use the occlusion map to modulate the lighting results, not just multiply it with the main texture. That is indeed different from light mapping, as it affects other lighting rather than just behaving as an additional light.

You’ll have to modify a number of passes to do that, although I’m still not sure why you’d want to do it. Occlusion maps are of ambient occlusion, meaning that they shouldn’t affect direct lighting. If you’ve got a bright light in a tight corner, it should still light the corner.

Occlusion maps are of ambient occlusion, meaning that they shouldn’t affect direct lighting. If you’ve got a bright light in a tight corner, it should still light the corner.[/quote]

I use it for the self occlusion effect.

Conceptually i want a shader similar to the decal shader but with come differences:

  • the decal use the second uv
  • can use rgba specular (A for gloss)
  • can use bump (normal map)
  • cast and receive shadows

I’m not a programmer but i thing is possibile to do.

Thanks for alla replies.

What do you mean by self occlusion?

Only the occlusion generated by an object on himself.

Can you explain how your self-occlusion is different from a light map that contains ambient lighting and accounts for occlusion caused by the object itself, i.e. baked ambient lighting with ambient occlusion?

Forget anyting…

Anyway… Maybe I dont’ explain the situation at my best, my english is too bad :smile:

What i need is a Bumped Specular shader + Decal (decal on secondary uv).

Someone can help me to insert the Decal Code in a Bumped Specular shader (I’m not a programmer)?

Thanks.

Ok, I had a chat with a guy named Erik on IRC who wants to do the same thing you do. We had similar confusion to what you and I have gone through here, but we finally figured it out:

You crazy artists and your terminology! You were both going on about wanting to use an occlusion map to modulate the base texture before the lighting equation. This didn’t make sense, because occlusion maps are for ambient occlusion, and should only affect ambient light. If you modulate all lighting with the occlusion map, you’ll have parts of the model that are always in shadow, even if they are in direct light.

It turns out that what modellers often do is use an occlusion map in place of a “dirt map”, which represents grime that has built up in creases of a model. It is generally darker, so it is multiplied with the base texture before lighting. In direct light, dirt is still somewhat dark, so it makes sense in the case where an ambient map doesn’t.

The important thing is that even though they can be generated in the same way, ambient maps and dirt maps are applied differently because they represent very different things.

Now that I understand what you are after, I’ll see about making an appropriate shader in the next week or so.

Ok, here’s my first attempt. I don’t actually have any 2-UV models handy so I’m not sure if it handles the second UV set properly at all. Let me know how it works.

216339–7902–$dirtmapspecular_101.zip (3.33 KB)