Home Technical Talk

Baking Directional Light Maps in Blender? Is that possible?

polycounter lvl 6
Offline / Send Message
AlexandrL polycounter lvl 6
Hi folks

I was trying to make a Directionality Lightmaps (Radiosity Normal Mapping)
Find whis topic, but unfortunately its outdated and all the images are gone :/https://polycount.com/discussion/71538/how-to-directional-lightmaps-with-3dsmax-vray

Currently this is what im doing:
Here's my 3 basis which i use to bake GI by Cycles



I was trying to pass basis througth Normal Map node, or normalize them, cause othervice results are look really wierd and depending on camera position (which should be ignored, but somwhow it affecting the scene) i start to get black areas in the viewport and on the baked maps.

Here how i try to "unpack" the light:
I assume what taking a dot product for all 3 basis, mul with all lightmaps should give me the same result as i will get with baking GI with default 0.0.1 normals on the model. But real results already show something wrong. Notice those black spot im marked. It shouldnt be there. Of course if i try to add normal map with some details it will look terrybly wrong.



What im missing? 

Replies

  • Eric Chadwick
  • Noors
    Options
    Offline / Send Message
    Noors greentooth
    I probably hadn't the slightest idea of what i was talking about back then and i don't think i messed with RNM since.
    Id say you need to convert your normal map from tangent to world space before the dot product.
    Thought i'd ask why would you want to deal with that in Blender ?
  • elios
    Options
    Offline / Send Message
    elios node
    https://forum.unity.com/threads/baking-directional-lightmaps-with-blender-cycles.397334/

    Here is a similar question with the blender setup shown, I have not tried recreating it myself and I think it is intended to be used in unity, but it might be of some help to you. 
  • AlexandrL
    Options
    Offline / Send Message
    AlexandrL polycounter lvl 6
    Noors said:
    I probably hadn't the slightest idea of what i was talking about back then and i don't think i messed with RNM since.
    Id say you need to convert your normal map from tangent to world space before the dot product.
    Hmm. I really struggle with understanding and dealing with tangents, so i just run a series of tests.
    My current test shows what i need opposite: im converting pixel normals from world space to tangent space. So basically if i calculate dot with vec3 of 0.0.1 - lightmaps looks okay*
    Same for textures. I use tangent space normals and pass them directly to dot's (after normalize the maps).

    *"okay" because unfortunately i doesnt have access to source engine (or any other using RNM) so i simply doesnt have any ground truth reference to chech how everything looks at my end.

    Btw many thanks for those color values which you post! It looks like calculating those basis vectors as they described in papers are simply doesnt work and should be done in some different ways.
    I achieve some positive results for simple plain, but adding geometry (walls, cubes, etc) - will not gonna work. With "those" colors putted to normal slot for blender diffuse shader - finally getting me somewhere.
    May i ask where you get those numbers?

    Noors said:
    Thought i'd ask why would you want to deal with that in Blender ?
    Honestly i dont have spare bucks for 3dsmax+vray or Maya (i know maya have built-in Turtle render which bake RNM). 
    If you mean in general, why blender and not lightmass - lightmass are too "static". You cant change lightmaps, cant export them for editing. Literally too many restrictions, while with your own lightmaps you can do a lot of cool tricks. 

    Current results:



  • AlexandrL
    Options
    Offline / Send Message
    AlexandrL polycounter lvl 6
    Oh crap. The colors on the https://polycount.com/discussion/71538/how-to-directional-lightmaps-with-3dsmax-vray post, are just remap to 0to1 range. I complitely missed that in description (was too tired and sleepy) and looking at 0.5 value i was immidiately thinking about remapping but i was initially calculating the values wrong somewhere and never get correct (the same results) after remapping  :# so was thinking what approach for this values are complitely different.

    Okay, things more clear now and everything kind of works, but i constantly get noticeable seams (for all basis) depending on UV:

    Not really sure is there some errors at my end, or its okay situation for RNM in general or its a problem with blender and cycles?
    I was trying to rotate islands and see what would happen and, well, for some islands orientations seams will defenitely became a bit less noticeable, but they will not dissapear complitely. 
Sign In or Register to comment.