Page MenuHome

Fix T40712: Duplicators don't generate orco and UV coordinates in Cycles viewport preview.
ClosedPublic

Authored by Lukas Tönne (lukastoenne) on Jun 20 2014, 6:47 PM.

Details

Summary

The threaded depsgraph update changes included a cleanup of the global
is_rendering flag, which was replaced by a general EvalContext being
passed to dupli functions.

Problem is that the global flag was true for viewport duplis before
(ugly hack), which was used as a check for generating dupli orco/UV from
mesh data layers. The new flag is stricter and only true for actual
renders, which disables these attributes and breaks the Cycles
Texture Coordinates and UVMap nodes.

The solution is to extend the simple for_render boolean to an enum:

  • VIEWPORT: OpenGL viewport drawing (dupli tex coords omitted)
  • PREVIEW: Viewport preview render (simplified modifiers)
  • RENDER: Full render with all details and attributes

The patch seems to work correctly, but there are some smelly parts:
In particular modifiers seem to totally ignore the EvaluationContext!
Instead they generally execute without render params from the depsgraph
(BKE_object_handle_update_ex) and are built with render settings
explicitly. This area needs really careful review for the depsgraph
overhaul, but for now it works, somehow ...

Diff Detail

Branch
dupli_eval_context

Event Timeline

Thank you Lukas for all the hard work you put into Blender!

One note from a user's perspective: It would be nice if the dupli coords would also be drawn in the viewport OpenGL render. Or does that come with too much of a performance hit?

Note: second issue noted in T39286 should be checked. Currently it looks like the patch does not yet generate PREVIEW particle duplis for BI viewport, which would solve that bug.

Lukas Tönne (lukastoenne) updated this revision to Unknown Object (????).Jul 2 2014, 3:02 PM

Set the appropriate DAG eval mode in the eval context for BlenderInternal rendering.

This solves some issues with evaluations in viewport preview renders, notably particle
drawing percentage.

Generally seems fine, would just try to avoid constant changes to reduce entropy of script breakage.

source/blender/blenkernel/BKE_depsgraph.h
66

Can we make it:

DAG_EVAL_VIEWPORT = 0
DAG_EVAL_PREVIEW = 1
DAG_EVAL_RENDER = 2

so no constant changes happens in py api?

source/blender/blenkernel/BKE_depsgraph.h
66

Yes, can do that ... unlikely it would be an issue, only used for dupli eval mode and fixed int ids are usually avoided in bpy (are they even possible?). Anyway, will change this and commit.