Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

GPU Instancing lightmap-static-only objects?

Discussion in '2017.2 Beta' started by Prodigga, Jul 31, 2017.

  1. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Hey there

    Our objects are lightmapped, but they need to move around slightly. We can set them to lightmap static only (Not Batching Static), so this way they are lightmapped but can still be moved around. So far so good! Unfortunately now they won't be dynamically batched. The Frame Debugger says the reason batching is broken is because 'Object is lightmapped'. However...

    I have noticed a lot of my objects fall on to the same lightmap textures. Almost all of their properties are the same, except for one - the lightmap UV offset.

    GPU Instancing allows us to supply per-instance data. (Adding Per-Instance Data)

    Would it at all be possible to mark the UV offsets as 'Per-Instance Data' ?

    This gif shows the only property changing is the lightmap ST.



    I thought maybe this would be a fairly simple use case to support, but simply wasn't supported because it is a unique use case (How often is it that a lightmapped object is dynamic? :) )
     
  2. zeroyao

    zeroyao

    Unity Technologies

    Joined:
    Mar 28, 2013
    Posts:
    169
    Hi @Prodigga,
    This is the exact stuff we are working on right now (not as easy as it looks). We are trying our best to make it into the next build, but we don't know yet (depending on many stuff internally). That means unfortunately it won't be in 2017.2.
     
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631
    For the record, I do it all the time.

    (And I am very pissed off that for some reason I'm unable to move my dynamic lightmapped objects in the scene view while in play mode)
     
  4. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    @zeroyao thanks for the update! This will open up some interesting doors. I'll keep an eye out in 2017.3! ;)
     
  5. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    While your at it can we make an option for light mapped static sprites?