Texture2D Material

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!

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

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

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.