Shader Nodes, Inputs for LightMapping node? (Solved)

I’m using the shader editor and I need to add some extra functionality to the Lighting.j3md.

So, I added the LightMappingNode and I’m not entirely sure what inputs it should be given. Here’s a screenshot of what I have right now:

I suppose the texCoord is the texture coordinate for the model? I get that from the CommonVert thingy.
And the color is fairly obvious I guess. But the lightMap?

LightMap should be fed with a gray scaled texture that represent light data.

BUt you realize this is not the Lighting.j3md, right?
if you want to use light mapping you can use stock lighting.j3md, it already supports it.

Yes but I need lighting AND some extra functionality.

it’s gonna be complicated, Lighting has not yet been translated to shader nodes. Also the editor is really buggy in 3.0 so you’d better modify the shader directly IMO

Hm ok, I guess I’ll make a copy of the Lighting.j3md and try to play with it. Thanks.


If anyone else would like to add team-colors or tintable textures with lighting, here’s what I did:

I coped the Lighting.j3md, as well as the accompanying Lighting.frag and Lighting.vert files (to assets/MatDefs dir) and added two parameters:

//the texture within which the alpha component determines the amount of tint on that area.
Texture2D TintMap

//what color to use as the tint color
Color TintColor

I also added them to the Defines section, and then I do this in the fragment shader, on line 174:

  vec4 diffuseColor = texture2D(m_DiffuseMap, newTexCoord);

  //are we using a TINTMAP alpha value to tint this with a TintColor?
  #ifdef TINTMAP
    vec4 tintColor = texture2D(m_TintMap, newTexCoord);

    //invert the tintColor alpha
    float tintAmount = 1.0 - tintColor.a;

    //get tint amount
    vec4 tint = m_TintColor;
    tint.r *= tintAmount;
    tint.g *= tintAmount;
    tint.b *= tintAmount;

    diffuseColor.r = mix(diffuseColor.r, tint.r, tintAmount);
    diffuseColor.g = mix(diffuseColor.g, tint.g, tintAmount);
    diffuseColor.b = mix(diffuseColor.b, tint.b, tintAmount);
  vec4 diffuseColor = vec4(1.0);