Long waited feature: Render Baking

Here's the full release log with example file.
http://www.blender3d.org/cms/Render_Baking.827.0.html

For people who don't read docs; just press ALT+CTRL+B on a Mesh
with texture faces!

Todos:
- maybe some filter options extra?
- Make normal maps in Tangent space
This commit is contained in:
2006-11-19 14:12:56 +00:00
parent 204f6066a9
commit c47fa4d0ec
15 changed files with 571 additions and 64 deletions

View File

@@ -60,6 +60,7 @@ void sort_faces(void);
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
@@ -75,6 +76,7 @@ void sort_faces(void);
#include "BIF_editmesh.h"
#include "BIF_graphics.h"
#include "BIF_interface.h"
#include "BIF_mywindow.h"
#include "BIF_screen.h"
#include "BIF_space.h"
@@ -91,6 +93,9 @@ void sort_faces(void);
#include "BIF_meshtools.h" /* include ourself for prototypes */
#include "RE_pipeline.h"
#include "RE_shader_ext.h"
/* * ********************** no editmode!!! *********** */
@@ -852,3 +857,45 @@ EditVert *editmesh_get_x_mirror_vert(Object *ob, float *co)
return NULL;
}
/* ****************** render BAKING ********************** */
/* all selected meshes with UV maps are rendered for current scene visibility */
void objects_bake_render(void)
{
short event;
event= pupmenu("Bake Selected Meshes %t|Full Render %x1|Ambient Occlusion %x2|Normals %x3");
if(event>0) {
Render *re= RE_NewRender("_Bake View_");
if(event==1) event= RE_BAKE_ALL;
else if(event==2) event= RE_BAKE_AO;
else event= RE_BAKE_NORMALS;
if(event==RE_BAKE_AO) {
if((G.scene->r.mode & R_RAYTRACE)==0 || G.scene->world==NULL
|| (G.scene->world->mode & WO_AMB_OCC)==0) {
error("No AO set up");
return;
}
}
waitcursor(1);
RE_timecursor_cb(re, set_timecursor);
RE_test_break_cb(re, blender_test_break);
G.afbreek= 0; /* blender_test_break uses this global */
RE_Database_Baking(re, G.scene, event);
RE_bake_shade_all_selected(re, event);
RE_Database_Free(re);
waitcursor(0);
allqueue(REDRAWIMAGE, 0);
allqueue(REDRAWVIEW3D, 0);
}
}