MultiUV coords, PBR and Area lights

The paper cited in much of the PBR intro talks about area lights. Not just baked Environment maps. Looking at the shaders i would guess this is not currently supported.

This is not a huge addition IMO and am thinking of putting this in. I guess this would use special lights? Or perhaps i would need to make sure i understand the light code well.

The other thing we would love to have is different UV texture coordinates for different maps (Metalicy, Roughness etc). Again i understand currently you can’t do this. But again this doesn’t look like a huge change. The best would be being able to link them in a Materials file. However obviously shaders would use a few texture coordinates internally.

Thoughts, feedback?

Of course most of this is a shader and i could just do my own custom material. But it seems that these are things others would really like too.

I’ve done both extra UVs and area lights. I’m not sure about integrating area lights into the lighting shader though, probably some extra branching. My area lights have no specular though, doing that in a method tailored to my situation.

I havn’t done any testing on the performance but it’s gonna be slower.

As for UV, I wonder if maybe you could set a uv number for each map? Move texcoords into an array, have m_normalMapCoordNumber and so on, default them to 1 unless otherwise set? Dunno if that would affect performance at all.

here again my plans are : make the pbr shader based on shader nodes.
This way you can do things like : pack roughness, matallic and ao for example in a single texture and just feed the pbr node with the correct channel.
You could also do the extra uv stuff pretty easily.Though IMO packing textures is a better way to go. But why not.
Then for area lights… well… yes let’s do this :stuck_out_tongue:

5 Likes

Amazing !

And that answers the other question in the other thread.

Yea moving to nodes seems the way to go. Everything uses nodes these days and it works pretty well.

As for area lights, would we add something to the current lights or have entierly new lights that only work properly with PBR? That is to say, do lights have a set of “attributes” like vertex that other shaders would just ignore? /me goes looks at the source.

I’m guessing you’ll need to use the .w part of the vec4 lightDirection that is currently differenciating between spot/point/directional and just add in the appropriate code for an area lamp to the existing shader (havn’t seen 3.1 shaders though).

This is the best area lamp I have found:

He based it on:
http://www.graphics.cornell.edu/pubs/1994/Arv94.pdf
some nice light reading :smiley:

In that answer he linked this which I’ll just put here for ease, it’s pretty cool:

http://jsfiddle.net/hh74z2ft/1/

No specular, I’ve tried using normal specular and it looks alright for certain situations.

EDIT: I’m still on 3.0, so the whole light culling thing would need to be visited too for this type of light