「利用者:Mx/Freestyle Internals Overview」の版間の差分

提供: wiki
移動先: 案内検索
 
(1版 をインポートしました)
 
(相違点なし)

2018年6月29日 (金) 03:42時点における最新版

Freestyle Internals Overview

File directories

release/scripts/freestyle/                               where sample style module files are stored
source/blender/makesdna/ data structure to load and save configurations
source/blender/freestyle/ core engine
app_blender/
geometry/
image/
python/
rendering/
scene_graph/
stroke/
system/
view_map/
winged_edge/

Constants

DNA_scene_types.h

R_EDGE_FRS       render Freestyle strokes toggle button (in 'Output' panel)
B_FRS_ADD_MODULE composite strokes in current render layer (in 'Render Layers' panel)


butspace.h

B_FRS_SELECT_RENDER_LAYER       render layer selection list
B_FRS_ADD_MODULE adding new module to render layer configuration
B_FRS_SELECT_MODULE_FILE select module

Interface

FRS_freestyle.h

// (re)initialize Freestyle when .blend file read
void FRS_initialize();

// cleans up Freestyle resources before program quits
void FRS_exit();
	
// composites Freestyle stroke for the specified Render target
void FRS_add_Freestyle(Render* re);

// panel configuration
void FRS_select_layer( SceneRenderLayer* srl ); 
void FRS_add_module();
void FRS_delete_module(void *module_index_ptr, void *unused);
void FRS_move_up_module(void *module_index_ptr, void *unused);
void FRS_move_down_module(void *module_index_ptr, void *unused);
void FRS_set_module_path(void *module_index_ptr, void *unused);

FRS_freestyle_config.h

void FRS_add_freestyle_config( SceneRenderLayer* srl );
void FRS_free_freestyle_config( SceneRenderLayer* srl );

Configuration information is stored in SceneRenderLayer(DNA_scene_types.h) structure for loading/saving.

DNA_freestyle_types.h

typedef struct FreestyleModuleConfig {
	struct FreestyleModuleConfig *next, *prev;
	
	char module_path[256];
	short is_displayed;
	short pad[3];
	
} FreestyleModuleConfig;
typedef struct FreestyleConfig {
	ListBase modules;
	
	int flags;
	float sphere_radius;
	float dkr_epsilon;
	int pad;
	
} FreestyleConfig;

Pipeline

initialization:

  1. toggle 'Freestyle' button on
  2. for each render layer where you want Freestyle strokes rendered, toggle 'FrSt' on
  3. configure each render layer's configuration


when clicking "Render" do_render_3d (pipeline.c)

if 'Freestyle' button pressed and internal renderer selected
	strokes added (calling FRS_add_Freestyle)


FRS_add_Freestyle (FRS_freestyle.cpp)

init view and camera (based on information from the scene)
	used during for view map calculation
	stored in:
		- freestyle_viewpoint[3]: camera position
		- freestyle_mv[4][4]: modelview matrix
		- freestyle_proj[4][4]: projection matrix
		- freestyle_viewport[4]: viewport


for each render layers
	if (		render layer is enabled
		and	'FrSt' layer option toggled on 
		and	render layer has at least one enabled style module
	    )
	{
		prepare rendering
			clear canvas
			load mesh
			add style modules
			set parameters
			compute view map

		render strokes in independent image
		composite strokes image into render layer 
	}

Freestyle engine implementation (TODO)

View map calculation

Python API implementation (TODO)

Directors