Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(294)

Issue 5545063: Vertex colour baking

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 2 months ago by adfries
Modified:
12 years, 2 months ago
Reviewers:
sergey.vfx
Base URL:
https://svn.blender.org/svnroot/bf-blender/trunk/blender/
Visibility:
Public.

Description

This patch adds the ability to bake directly to vertex colours.The advantage of this is that it doesn't require a UV map, however the quality of the bake will depend on the resolution of the mesh. See attached screenshot. Change summary: - Added a button to enable vertex colour baking in render buttons > bake panel. - Added function shade_verts to compliment shade_tface and zspan_scanconvert. It does the same sort of thing as those functions, but only calls do_bake_shade once for each vertex. - Changed bake_shade and bake_displacement to write to MCol instead of pixel buffer if MCol is present (not NULL). - Disabled code for creating zspan and image buffers when baking to vertices. - Added new table 'origindex' to VlakTableNode, on Brecht's advice. This maps from VlakRen back to the face in the source mesh. It is only populated when doing a vertex colour bake. Working: - Baking textures, displacement and normals. - Baking from selected to active. - AO (but needs lots of samples or there will be discontinuities). Partially working: - Full render, shadows (shadows cause artefacts). Not working: - Baking meshes with topology-changing modifiers (e.g. subdivision). Patch on PBO: http://projects.blender.org/tracker/index.php?func=detail&aid=29035&group_id=9&atid=127

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+245 lines, -52 lines) Patch
intern/tools/credits_svn_gen.py View 1 chunk +1 line, -1 line 0 comments Download
release/scripts/startup/bl_ui/properties_render.py View 1 chunk +6 lines, -3 lines 0 comments Download
source/blender/makesdna/DNA_scene_types.h View 1 chunk +1 line, -0 lines 0 comments Download
source/blender/makesrna/intern/rna_scene.c View 1 chunk +5 lines, -0 lines 0 comments Download
source/blender/render/intern/include/renderdatabase.h View 2 chunks +3 lines, -0 lines 0 comments Download
source/blender/render/intern/source/convertblender.c View 4 chunks +13 lines, -2 lines 0 comments Download
source/blender/render/intern/source/rendercore.c View 15 chunks +188 lines, -45 lines 0 comments Download
source/blender/render/intern/source/renderdatabase.c View 5 chunks +26 lines, -0 lines 0 comments Download
source/blender/render/intern/source/shadeinput.c View 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 2
adfries
12 years, 2 months ago (2012-01-16 06:40:41 UTC) #1
sergey.vfx
12 years, 2 months ago (2012-01-27 16:29:26 UTC) #2
Strange, most of files can't be browsed here. So will comment it in old-fashined
way.

- Not sure about all that tricks with bitmasks in RE_vlakren_get_origindex. Also
found it's crappy how origindex is calculating in init_render_mesh. It's setting
index based on counting vertices in final mesh which is totally wrong for
constructive modifiers.
I'd say that using CD_ORIGINDEX layer from renderDM will be a way to go here.
Ofcourse some modifiers doesn't support it (bevel, i.e.) but can't think about
more accurate way to find index in base mesh. So all you need is to: (1) store
origindex layer somewhere (to reduce layer lookup amount when doing actual
rendering) (2) store vertex index somewhere (so you'll know index of render
vertex in derived mesh). And then just do origindex[vertex_index], if it's
ORIGINDEX_NONE then you can't store color in vertex color, otherwise you'll use
original index with that index. The only issue here is that several vertices
would be baking to the same orig index. Maybe it can be some kind of "blending"
which will improve quality of baked "image"?
- I'd recomment to get rid of CustomData_get_render_layer_index in
get_next_bake_face. It'll save plenty of lookups through all custom layers
object has. If it'll be cached in the same way as tfaces, it'll also allow to
get rif accessing mesh from here (which doesn't seem really nice).
- Currently haven't made deep check of shade_verts(), but looks quite fine.

And some usability tips:
- I've been trying to make baker working. After ~20min i've realized there's no
vertex color layers.. Nicer warning message will be really helpful.
- Also not actually understand which layer would be used. Maybe it might be
useful to add layer "chooser" here?

Didin't check artifacts yet.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b