Dev:2.8/Source/Viewport/DrawModes

提供: wiki
移動先: 案内検索

Every engine will provide a set of Draw modes. In the 3d view the user can select one of these drawing modes. the associated render engine will then be used to render the 3d view.

F12 rendering
Draw modes other than OB_RENDER are not supported for F12 rendering


Implementation

For every draw mode a draw_engine is registered

void DRW_engines_register(void)
{
	RE_engines_register(NULL, &DRW_engine_viewport_eevee_type);
	RE_engines_register(NULL, &DRW_engine_viewport_workbench_type);
	
	DRW_engine_register(&draw_engine_workbench_solid_flat); 

        ...
}

In the RNA/DNA there is a field called drawtype which holds the main shading type (OB_WIRES, OB_SOLID, OB_MATCAP, OB_TEXTURE, OB_SHADED, OB_RENDER) there is also a drawsubtype per drawtype (when needed) to hold a chosen subtype.

drawtype_wires(All wires, Front wires)
drawtype_solid(Flat, Studio, Scene lighting)
drawtype_texture(Flat, Studio, Scene lighting)


In draw_manager.c#drw_engines_enable_from_engine the correct draw_engine for the selected drawtype will be chosen.

static void drw_engines_enable_from_engine(RenderEngineType *engine_type, int draw_mode,
                                           int draw_mode_wireframe, int draw_mode_solid, int draw_mode_texture)
{
	switch (draw_mode) {
		case OB_SOLID:
			if (draw_mode_solid == OB_LIGHTING_FLAT) {
				use_drw_engine(&draw_engine_workbench_solid_flat);

			} else if (draw_mode_solid == OB_LIGHTING_STUDIO) {
				use_drw_engine(&draw_engine_workbench_solid_studio);

			} else if (draw_mode_solid == OB_LIGHTING_SCENE) {
				use_drw_engine(&draw_engine_eevee_solid_scene);

			}
			break;

                    ...

		default:
		case OB_RENDER:
			if (engine_type->draw_engine != NULL) {
				use_drw_engine(engine_type->draw_engine);
			} 
			break;
	}
}
draw_mode_material
draw_mode_material will be added when needed. During the code quest we will not be focusing on material draw modes


Supported Draw Modes

The next draw modes will be made available


Wireframe All

drawtype: OB_WIRES
drawtype_wires: OB_WIRES_ALL

This draw mode is provided by the Workbench engine. It will draw all the wireframes of the scene.


Wireframe Front

drawtype: OB_WIRES
drawtype_wires: OB_WIRES_FRONT

This draw mode is provided by the Workbench engine. It will draw all front wires of the scene.


Solid Flat Lighting

drawtype: OB_SOLID
drawtype_solid: OB_LIGHTING_FLAT

This draw mode is provided by the Workbench engine. It will draw all objects in a flat color like a silhouette.


Solid Studio Lighting

drawtype: OB_SOLID
drawtype_solid: OB_LIGHTING_STUDIO

This draw mode is provided by the Workbench engine. It will draw all objects in a single color, but uses an HDRI for lighting. Shadows (option) will be provided with the HDRI (single directional light)

Solid Scene Lighting

drawtype: OB_SOLID
drawtype_solid: OB_LIGHTING_SCENE

This draw mode will be provided by the Eevee engine.

Textured Flat Lighting

drawtype: OB_TEXTURE
drawtype_texture: OB_LIGHTING_FLAT

This draw mode is provided by the Workbench engine. It will draw all objects in a flat color like a silhouette.


Textured Studio Lighting

drawtype: OB_TEXTURE
drawtype_texture: OB_LIGHTING_STUDIO

This draw mode is provided by the Workbench engine. It will draw all objects in a single color, but uses an HDRI for lighting. Shadows (option) will be provided with the HDRI (single directional light)


Textured Scene Lighting

drawtype: OB_TEXTURE
drawtype_texture: OB_LIGHTING_SCENE

This draw mode will be provided by the Eevee engine.


Material Flat Lighting

drawtype: OB_MATERIAL
drawtype_material: OB_LIGHTING_FLAT

This draw mode will be provided by the Eevee engine.


Material Studio Lighting

drawtype: OB_MATERIAL
drawtype_material: OB_LIGHTING_STUDIO

This draw mode will be provided by the Eevee engine.


Material Scene Lighting

drawtype: OB_MATERIAL
drawtype_material: OB_LIGHTING_SCENE

This draw mode will be provided by the Eevee engine.


MatCap

drawtype: OB_MATCAP

This draw mode will be provided by the Workbench engine.


Rendered

drawtype: OB_RENDER

This draw mode will be provided by the Scene render engine (Cycles, Eevee)

Code Quest

during the code quest the workbench project will have a priority on the next Drawing modes

  • Wireframe All
  • Wireframe Front
  • Solid Flat Lighting
  • Solid Studio Lighting
  • Textured Flat Lighting
  • Textured Studio Lighting
  • MatCap
  • Rendered