+3
Planned

Lightmap node

derrickbarth 10 years ago updated by Freya Holmér (Developer) 9 years ago 9

Officially requesting a "Lightmap node".


This arose from my request on the polycount forum, here:

http://www.polycount.com/forum/showpost.php?p=1952617&postcount=385


And is somewhat related to another user's request:

https://shaderforge.userecho.com/topic/272616-cheaper-light-mode-specifically-for-lightmaps/


Basically, I would like to be able to set the lighting mode to unlit, and then still be able to use lightmaps in my shader.  These would be exposed via a Lightmap node, which can be added to the node network.

Answer

Answer
Planned

This shouldn't be too hard to implement, but it will most likely wait until post release :)

Answer
Planned

This shouldn't be too hard to implement, but it will most likely wait until post release :)

Hey there, I know it's been a while but I just wanted to see if this was still in the works?  Also my original request specified the lightmap being a node... it doesn't have to be (at first), just being able to check the Lightmaps support while also using Unlit/Custom would be great.

Having a lightmap node would still be fantastic though for doing custom manipulations on the lightmap right in the shader.
I'm in the process of rewriting some large parts of SF, more specifically its dependency system. In doing so, it'll be much easier to expose nodes such as lightmap / light probes etc.

There are some design issues though, since lightmaps behave differently depending on which type it is, and it needs to be done properly in the node as well. (For instance, directional lightmaps have a light direction saved in the lightmap data)

I'm not sure when it will be done, I'm in the process of preparing things for Unite, and a few other things, so, it'll take quite some time
Hey there, 
I was wondering is there was any imrpovement on this case ?

Thx :-)
Not yet! Right now I'm too busy with preparing for GDC I'm afraid, and after that I need to do Unity 5 specific implementations in SF, among a bunch of other things. It'll take time I'm afraid
and  do you know an easy way to fix this directly in the code ? (I am not a shader coder myself, but if you have a clue, I can ask around me :-))
Not really, it's rather complicated! (Which is why it isn't a node yet)
Joachim, please forgive my ignorance here but isn't it as simple as:
float3 node_# = DecodeLightmap(tex2D(unity_Lightmap, i.texcoord))  ?

Or maybe you don't have available interpolators at this point to pass the texcoord in?
That's the naive solution, yes. It would work in a specific case, but it wouldn't solve all cases. You need to branch based on:

1. Whether or not lightmapping is enabled on the object
2. If you're using deferred or forward
3. Which lightmap type you're using. Single vs Dual vs Directional
4. And, for me, whether or not you're using Unity 5