1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Blender: Usage of bake to texture to apply one texture to a new UV

Discussion in 'Civ4 - Modding Tutorials & Reference' started by The_Coyote, Jun 2, 2010.

  1. The_Coyote

    The_Coyote Chieftain

    Joined:
    Mar 1, 2008
    Messages:
    1,367
    Location:
    Europe
    It´s only a mini tutorial, but perhaps someone has use for this function. But because, beside some tests, i havn´t really used this option til now, consider this as introductional tutorial and not as real knowledge transfer tutorial. You have to discover for your yourself if have use for it - or not. The reason for posting it: i can imagine some cases where it can be useful (eg: you have a collection of pictures as base for your texture - but afterwards you want to optimize the uv)

    first we start with a finished model with UV and texture



    as next step we add a second uv layer to the model



    afterwards we set the new uv layer as active uv layer, while the original one is still used for rendering



    after we created the new uv, we add a new texture.



    now we simply use the bake render meshes - texture only option



    the resulting texture



    which can be saved



    and the new uv layout can be used for the model itself



    Ciao
    The_Coyote
     

    Attached Files:

  2. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,045
    Location:
    San Diego, California
    this just blew my mind. So this lets you create the texture with a draw program or what does baking actually do?
     
  3. The_Coyote

    The_Coyote Chieftain

    Joined:
    Mar 1, 2008
    Messages:
    1,367
    Location:
    Europe
    Blender creates the texture after the new uv, afterwards you can save the texture (tbh i always use bake render atm to scale my textures from the working resolution to the final resolution).

    But in this tutorial you start with an texture and and UV (imagine you have a big photo of an object). As one example, in the first step you could unwrap your model to fit the uv to a photo, afterwards you could create a second uv to have a better place usage on your uv (or change the position on the uv). Using baking you could create your final texture using bake render.

    I didn´t found real use for it so far (i don´t use photos for my textures), but i thought someone could use it. I played around a bit with this option because i thought i could be used as easy texture merge method for models and leaderheads, but wasn´t really sucessful so far (i thought i had used it one time in the past for this purpose, but wasn´t able to reproduce the steps)

    -------------------------------------------------------------------------------
    Edit: finally found the missing function, so here are some additions how to use texture baking to merge a multi texture model:

    I used Ekmeks Wu v.2 to as example - you can find the download link in Ekmeks leaderhead thread

    first, after the import of the model, i merged all body parts (and for the record, missed the eyes - so it´s only an example, no complete optimized final version). In pic1 you see the merged model and the now chaotic looking UV, the merged model has 5 materials and more than 1 texture



    As next step add a new UV layer to the merged model and make the new layer the active layer, how is decribed in the OP. The new UV layer has no unwrap information so far. And because creating the entire UV from scratch for the new UV layer isn´t that funny the entire texture baking would be without an option to copy the UV from the original layer to the new one quite senseless. Luckily Blender has this option (<- this was the missing function). Select all faces in edit mode (not sure if this is needed, but at least it doesn´t harm), press Ctrl + C and select the option shown in the pic



    Now select the original UV as source layer for the new UV layer



    Now the entire unwrap information from the model has been copied to the new layer



    after playing a bit the the UV to remove the overlapping areas and some other adjustment to fit the unwrap to the available space, the UV looked



    After adding the texture in the UV window (like described in the OP), usage of the bake texture



    resulted in this texture



    After saving the texture (as bmp, the dds was created using paint.net), i removed all old materials from the model and added a new one with the new texture. I also changed the name of the UV layer (removed the .001 from the name - i think this step is necessary). As last step i exported the leaderhead. The exported nif (not game ready!) is attached as reference.

    Also, using the nrml, env_mask, spec textures as diff texture is also possible to merge this texture from different souce models exactly the same way like described above. And of course it´s also possible to add some lights to the scene and make a full render.
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      98.5 KB
      Views:
      3,833
    • 2.jpg
      2.jpg
      File size:
      67.8 KB
      Views:
      3,834
    • 3.jpg
      3.jpg
      File size:
      26.4 KB
      Views:
      3,807
    • 4.jpg
      4.jpg
      File size:
      36.7 KB
      Views:
      3,796
    • 6.jpg
      6.jpg
      File size:
      46.9 KB
      Views:
      3,796
    • 7.jpg
      7.jpg
      File size:
      40.5 KB
      Views:
      3,824
    • Wu_tex_demo.zip
      File size:
      866.2 KB
      Views:
      75
    • 5.jpg
      5.jpg
      File size:
      95.5 KB
      Views:
      3,821
  4. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,045
    Location:
    San Diego, California
    holy :wow: I'll give this a shot. great find coyote. especially for normal + spec. so I assume that the process is the same for them except you have to choose the normal as the main texture. right?
     
  5. The_Coyote

    The_Coyote Chieftain

    Joined:
    Mar 1, 2008
    Messages:
    1,367
    Location:
    Europe
    more or less it (creating this textures) should be an additional gain of the process. After the creation of the merged diff texture (directly after you saved the texture, before you remove the old materials), exchange the diff texture in the old materials with the spec, norm, etc and repeat the texture baking. (disclaimer: i havn´t tested this so far, but iirc the texture defined in the materials is used as base for baking) After you created all textures, remove all old materials and add the new material for the new merged texture

    the norm could need a special threatment afterwards, i´m not sure if black parts are allowed in a norm texture, therefore it could be possible that this parts have to be edited afterwards.
     
  6. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,045
    Location:
    San Diego, California
    Ok, I finally tried this and its great. BUT I think you have to make sure the texture is mapped right or it wont cross over. This tut along with the map generator should help me tighten up the sizes of some of my leaderheads.
     
  7. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,045
    Location:
    San Diego, California
    Coyote,

    I'm getting something weird. The baking is working fine but when I export the model it returns to the original UV layout AND then blender forgets the baking and goes back to the original UV layout! I did separate the parts and even got rid of the original materials - do you whats the reason?
     
  8. The_Coyote

    The_Coyote Chieftain

    Joined:
    Mar 1, 2008
    Messages:
    1,367
    Location:
    Europe
    iirc i only had this issue if i didn´t removed the old texture layer and set the new layer as active and used for rendering (and not renaming the new UV layer to UVTex gave an error while exporting)

    if you did this, could you please attach the file so that i could have a look (but it will be not before the weekend that i have the time for it)
     
  9. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,045
    Location:
    San Diego, California
    Ok I'll remove the old layer. My other thought was thta maybe the other textures (NRML, SPEC, etc) were forcing it.
     

Share This Page