Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Combining lightmaps, compute shaders

Discussion in 'Shaders' started by newerish, May 23, 2024.

  1. newerish

    newerish

    Joined:
    Sep 13, 2019
    Posts:
    26
    Hi,

    Background:
    I want to dynamically change the color and intensity of emissive materials and lights (but not their transform) and update their lightmaps . Assuming that I know what light sources are modifiable, I bake their individual lightmaps in Editor and store in Resources. In the Play mode, I load those lightmaps and combine them based on the weight of each light source and pass the result as the active lightmap.

    My solution:
    I assume the fastest way will be to use compute shaders, with lightmaps as two Texture2D[] (color and direction) and a float and color arrays containing the weights. But, I have zero experience in compute shaders and minimal experience with shaders in general.

    Is this the way to go? Should I invest in this direction or is there a simpler way? Please note that the solution will only apply to a single project template, platform and pipeline (Win64, NVidia, local, standalone, HDRP), so I'm not worried about shader compatibilities atm, but I do care about its future independent operability (so I don't want to rely on 3rd party tools like Enlighten).

    Cheers,