# Texture2D  Material

**URL:** https://discussions.unity.com/t/texture2d-material/496322
**Category:** Shaders & Materials
**Tags:** Scripting
**Created:** [January 31, 2013, 5:03am UTC](https://discussions.unity.com/t/texture2d-material/496322 "2013-01-31T05:03:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![MikeBastien](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/mikebastien/32/441649_2.png) [@MikeBastien](https://discussions.unity.com/u/MikeBastien)
#### Post date: [January 31, 2013, 5:03am UTC](https://discussions.unity.com/t/texture2d-material/496322/1 "2013-01-31T05:03:30Z")

</div>

Hi,

I would appreciate any direction on how to take a Texture2D, and **multiply** it on an existing Material.

This would be the similar functionality I imagine to what Beast is doing behind the scenes, when it is applying lightmaps to objects after rendering.

I’m not looking to use the built-in shaders, rather I want to add a script to a GO that does this.

Thank you!

---

<div class="post-metadata">

### Author: ![Eric5h5](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/eric5h5/32/44225_2.png) [@Eric5h5](https://discussions.unity.com/u/Eric5h5)
#### Post date: [January 31, 2013, 5:21am UTC](https://discussions.unity.com/t/texture2d-material/496322/2 "2013-01-31T05:21:05Z")

</div>

Not really sure what you’re asking, since a Texture2D and a Material are completely different things that can’t be multiplied in any way. Are you talking about combining two different textures?

–Eric

---

<div class="post-metadata">

### Author: ![MikeBastien](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/mikebastien/32/441649_2.png) [@MikeBastien](https://discussions.unity.com/u/MikeBastien)
#### Post date: [January 31, 2013, 6:21am UTC](https://discussions.unity.com/t/texture2d-material/496322/3 "2013-01-31T06:21:02Z")

</div>

Hi Eric,

Sorry, I meant multiply in a shader sense.

Hopefully this is a bit better in explaining:

- Add a static mesh to a scene.
- Set the mesh to be ‘Lightmap Static’
- Add any material, or just use the default assigned… it doesn’t matter.
- Add a light to the scene, and set it to be ‘Bake Only’.
- Now bake the lighting in the scene.
- Beast has baked out a lightmap texture.

This texture is automatically combined with the material applied to the mesh.

To summarize:

- I would like to attach a script with a public Texture2D var, to an object with a mesh renderer.
- I would then assign a lightmap texture via a public var.
- The lightmap would be applied to the material on the object, in the same manner as what Beast does.

Mike

---

<div class="post-metadata">

### Author: ![MikeBastien](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/mikebastien/32/441649_2.png) [@MikeBastien](https://discussions.unity.com/u/MikeBastien)
#### Post date: [January 31, 2013, 8:57pm UTC](https://discussions.unity.com/t/texture2d-material/496322/4 "2013-01-31T20:57:50Z")

</div>

Actually I thought further on this last night, and have an idea I’ll try in the next day or so.

If it works out I’ll follow-up.
