More awesome blender dev. It’s there at last, the bake panel has existed far too long without the shadow bake option. Thanks Cambo! The plan for the BGE game is to use dynamic shadows for the character, and bake shadows for the level.

Note the quad split option in the image above. Blender’s baking needed an option for quad splitting as well. Internally, most systems will split a quad into 2 triangles, and blender’s no exception. It checks for non-planar (bent) quads and splits them in the direction that gives the least distortion.

While good for rendering models, this causes a problem for baking because the split direction can differ from the one used to display and export. One solution is to triangulate all faces before baking and exporting, but this isn’t ideal since it would loose the edge loop topology and make models harder to edit later. To make matters more confusing, graphics card don’t all split quads the same way, but many game engines just convert to triangles when exporting.

Campbell was also kind enough to add this option to split quads in a predictable manner (0,1,2) (….) etc.



29 Responses to “Shadow Baking!”
  1. Nice :) now the other guys that get worried about performance/RT-shadow casting in the whole map will understand the process :), not every object on scene has to cast real time shadow.

    But, I’m still having some difficult to use normalmap baking, specially tangent space and edgeSplitted objects. How are you solving that??

    :)

  2. yay! thanks Campbell!

    (Nathan! we need you for tackle-hugging, where are you!)

  3. Of course, Mataii! That’s why in the post where Realtime shadows were introduced, I said that the “limit” of the shadows being cast only by Spot lamps wasn’t a drawback, but an advantage! And now, with this update, the concept of “shadow casting” seem almost covered.

  4. WOW! pushing the boundries again! Woot!!!

  5. i guess this means we’ll experience one shadow too many when the character is standing under a tree, or is there a solution to this? to somehow eliminate the RT shadow when standing in a baked one?

    anyway, i have to applaude the team for the increadibly rapid development of useful features we have seen lately. Thank you so much.

  6. @Vexelius
    Yep :), but if you only use the limits of the spotlight edge when you get close to another object it will cast shadow as the player do, so I think here is when we use the use layer button in lamp options to specify that only the main character will be affected by the spotlight.

  7. We have yet to decide what will be baked and what will be dynamic, Probably use soft raytraced shadows for tree’s so the double up dosnt look so odd.

    @dusty, just utilities, stuff you notice is missing when for game levels.

  8. nice work indeed!!! best of luck working out the “layered” shadow interactions. I’m excited to see the results

  9. Horay!

  10. randomnut says:

    AWESOME!
    this project improves easy open-source game creation so much…

    I wish i could contribute somehow, just that i know no programming and my drawing is fubar :p

    PS, wrongly layered shadows would truly be ugly…

  11. BlendRoid says:

    We didn’t have this already? I had no idea. Anyway, it’s great that we do now!

  12. @BlendRoid, baking shadows could be done by setting all materials to white, no textures then doing a “Full Render” bake, but its nicer to be able to bake shadows as a setting.
    Some of you might be interested I also added a python API for baking. for automated heightmap baking. (Available in 2.46, see scripts/bpymodules/BPyRender.py - bakeToPlane)

  13. BlendRoid says:

    @campbell: Oh, yeah, I suppose so. I just always thought there *was* an individual shadow button. Shows how much I pay attention. :D

  14. squareline says:

    @Campbell,
    Can i bake shadow for alt-d (instanced) objects?

  15. this does only bake the shadows? without lighting equations?

    i think it also would be important to have the options:

    * lighting (without shadows)
    * lighting + shadows

  16. and can baking be antialiased now?

  17. Cool! I was hoping that this feather would be added soon. Btw could you make an option so that the shadow only affects the alpha values on a pure black image? e.g. an area with no shadow would be pure black but would have an alpha value of “0″ while areas that have no light would also be pure black but they would have an alpha value of 255. I currently use this technique and it works very well. Sample file; http://www.zshare.net/download/142254823ceb8a07/

  18. It would be nice to be able to bake AO + shadows at once.
    Also it would be nice to be able to use own glsl fragment shaders.
    For now with Blender glsl shaders enabled only custom vertex shaders work, but fragment shaders don’t work anymore.
    If I enable Blender Multitexture Materials custom shaders work fine.

  19. What’s about moving trees (moving sun light). That’s impossible with baked shadows, isn’t it? It would be nice to have dynamic shadows for all objects as an option in the “graphics options” of the game later on. So that people with really fast machines can activate dynamic shadows :D

  20. Or are their possibilities for animated baked shadows (addition to my last post)?

  21. the snapshot doesn’t have shadows on the rock… would you make a new UV map and shadow bake them too?

    I also noticed that the leaves in the tree didn’t receive shadows from other leaves. I know It would take a lot of shadow maps to achieve that. especially when there are probably going to be lots of trees in the game?

    -the rock shadows probably are not important because the apricot team was only demonstrating shadow baking for the ground.
    -Creating good shadows for the tree would be an amazing feat indeed.(when there are lots of trees)

    Thats a cool feature! Now I don’t have to bake a full render for shadows. Now It’s all in the shadow bake button.
    Awesome!

  22. esto esta jevi jevi

  23. Hello, Grand apricot tree,

    1) Is this a technique specific LOD will be developed for the Shadow Baking and the Real Time Shadows in the blender game engine?

    2) Is the radiosity once amended could be used to calculate shadows and only a meshes with structures adapted polygons geometrically and exactly the silhouettes of objects that produce them, so to get shadows seconded soil and edited separately that has to mesh paint and alpha transparency?

    3) Have you really tried the recipe for the Tart apricots, apricot cream, is this a valid technique for shade brought a blender?

  24. Great!
    Now we can use shadow baking like shadowmaps.
    But I don’t know how turn visible and invisible a texture in the GE.

    Maybe is time to create an actuator for manipulate the textures from the materials, animating, moving textures x,y coordinates (a water texture for example), turn visible/invisible, etc.

  25. (Maybe is time to create an actuator for manipulate the textures from the materials, animating, moving textures x, y coordinates (a water texture for example), turn visible / invisible, etc.).

    Oh yes madman fantastic!
    Your proposal for some command with brics logics would be welcome if it is embodied in blender (long as it is)

  26. Francisco Ortiz says:

    That’s great! Baked shadows works everywhere, and bake options in Blender are really easy to use. ;)

    Nice to see it improving even more.

  27. lilehansen says:

    I get odd results… linux x64 nvidia 8800
    the spot actually cast light in real time in the editor, but its all pixelized and, no shadows… the material is default, spot is buf shadows. http://imagebin.org/21677
    Any hint ? I’m on #blenderchat if someone has an idea

  28. Franciso Ortiz: Excuse me, but, “bake options in Blender are really easy to use”? I guess I can’t agree, or I am just too dumb to use them “easily”.

    From what I can tell, you cannot bake lighting to a seperate texture channel; you have to manually create textures to bake to; you have to do that for each object seperately (try that with 1000s of objects); the baking permanently destroys your textures.

    Now if you call that “easy”, you should try other 3d packages!

  29. I don’t get how to do the lights for lightmapping

    The lightmap is really ugly compared
    to the shaded and rendered view
    http://terrymorgan.net/images/shaded_and_lightmap.jpg
    40K

    blend file
    http://terrymorgan.net/def_int3.zip
    380K
    is there something I’m doing wrong with the lights?

    I went to 1 spot light and ambient occlusion
    http://terrymorgan.net/images/def_int_amb_spot

    I looked at the snailrose bge tutorial, I don’t even see a light there, but I got the best results.

Leave a Reply