Forum rules - please read before posting.

2D Tint/lightmap?

2»

Comments

  • edited July 2015
    I modified the script a bit so I didn't have to assign the lightmap mesh manually for every character in every scene. Now just create a new tag named "LightMap2D" and add it to the mesh with the light map, and it will choose it automatically.


    First, copy the script I linked above and in your project create a C# script called LightMap2D, then paste the content into it.

    Now, apologies if this is too basic, but I'll write it down for anyone who's interested.

    Paint a lightmap which matches up with the background, the colour and brightness used will tint the character accordingly:

    image
    image

    Make sure the texture is set to Advanced in the Inspector and that Read/Write Enabled is checked.

    image

    Now you have to create a 3D Plane in the scene, drag the lightmap texture onto it and rotate and scale the plane so it lines up with the background image:

    image

    Select the 3D Plane with the lightmap, and in the Inspector you open the Tag dropdown menu, add a new tag called LightMap2D, and make sure you choose it for the 3D Plane.

    image

    Lastly, select the sprite of your character, add a new component and select Light Map 2D. Do this with every character who should be affected by the lightmap.

    Now, as long as each lightmap plane is tagged properly in each scene the lightmap should be used automatically.
  • I think @Eastman just made everything clear :)

    Thanks for the improvement with the tag that's interesting. The only situation where it's not cool is if you want to have different lightmaps for different objects, even if in most cases it won't happen.

    Could still make a mix with a default tagged lightmap but keeping an optional parameter for a "custom" lightmap. I might do that and post it here.


  • You are right! I actually added that to my own script an hour after posting that along with the ability to toggle using a lightmap at all, but I was hesitant to post it here because of my horrible "code". It seems to be working though so I updated the pastebin with the changes.
  • @Eastman: Looking into adapting your code for the official release.  OK to do so, just before I go any further?
  • edited August 2015
    @ChrisIceBox: Not my code, I just made some modifications :) It's a mutation from the code posted previously in this thread, but I think it all originates from this Unity Answers:

    Extracting RGB component data from a textured plane positioned below a 3D terrain
  • @ChrisIceBox It's a nice idea as it's a common need for adventure games. We all tried to make something easy to use with the informations everyone gave here. If you find a nice way integrate it to AC that would be cool. And feel free to improve it if you have other ideas.
  • Yes, this can be integrated - and I have a few ideas to improve it too.  Look out for it in v1.47.
  • edited August 2015
    If only we could trust some one to make an easy tutorial to read for everyone else :)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.