[Feature] DirLightmap Import

Hello Playcanvas,

I started this thread to have info about some graphic feature required in our first application with PlayCanvas.
We are working on a WebGL Configurator where objects, materials and colors are going to changed by the players.
Material quality is very important for us (specular and normals).

I’d like to bake lightmap in Vray rom Max, but not only the RGBM linear color Direct+GI but also the DirLightmap (otherwise normal map has no-sense). I’m not able to find any slot in the shader to load DirLightmap into material. I checked the frag shader files into github and I know that you have written DirLightmap decoding/encoding to work with Real Time Direct Baking. How can I proceed to import external DirLightmap instead?


How are you going to bake the DirLightmap in vray anyway?

It is a little tricky. You need to bake 3 times normal map directional, one for each axis (x, y, z) and then merge in a RGB map.

However any help to add external directional map? We have short submission :stuck_out_tongue:

Anybody can help me to understand how to add chunk and a texture slot into material?

This is what I need to achieve (then I was able to use slot and custom shader function). Any help please? :stuck_out_tongue:

P.S.: I splitted this thread in 3 different topic :slight_smile:

This project: http://developer.playcanvas.com/en/tutorials/tutorial-plasma-shader-chunk/ Uses a custom shader chunk for the diffuse map.

This folder lists all the chunks that we use (mostly in the StandardMaterial): https://github.com/playcanvas/engine/tree/master/src/graphics/program-lib/chunks .Use the filename + “PS” for frag shader or “VS” for vert shader to access the chunk in code.

Basically you overwrite the chunk with your own shader asset. You can either re-use standard material slots that you are not using for your textures or declare new uniforms in your chunk.

It’s worth pointing out the the shader chunk code API is not final and will almost certainly change in the future.