7
$\begingroup$

Is there a way to connect a low poly object with a high poly object linked from another blend file, that is only interchanged on rendering?

Example: In the viewport I have my low_cube.001. It is connected somehow to high_cube.001 in the high_cube.blend. In the viewport there will always be low_cube.001. On rendering the scene with Cycles, there should be high_cube.001 only.

Is there an "artists" way? If not, is there a way I can interchange objects with Python, somehow transfer the high poly object into the render engine?

EDIT: Regarding Python, I don't need a finished piece of code completely worked out, just some directions or ideas would be great alreay!

$\endgroup$
  • $\begingroup$ do you need to change at render time or before ? $\endgroup$ – Chebhou Mar 18 '15 at 9:34
  • $\begingroup$ Only at render time! $\endgroup$ – bortran Mar 18 '15 at 11:06
5
$\begingroup$

With a python script you could add handlers to

bpy.app.handlers.render_init API Reference
bpy.app.handlers.render_complete API Reference

and then search through all selectable objects in the 3D view replacing them with a high poly version if one is found.

bpy.context.selectable_objects API Reference
bpy.data.objects API Reference

You could find a matching object (by name in the format you described) with code similar to the example provided

def findHighPoly(obj):
    if obj.name[:3] == "low":
        for o in bpy.data.objects:
            if o.name[:4] == "high" and o.name[4:] == obj.name[3:]:
                return o
    else:
        return null

Notes:

  • bpy.context.selectable_object might not be the best fit for you.
  • It might be better (consider you'll be switching back after rendering) to store the relationships you find inside of an array.
  • If the handlers don't work, you could always make some operators along with some hotkeys to trigger the low > high poly and high > low poly transition.
$\endgroup$
  • $\begingroup$ That's a pretty good solution already and actually the way I was thinking about, However, would it be possible to interchange objects without bringing them into the viewport, like compiling BVH myself or alike? I know that's pretty sophisticated stuff, still I'd like to know if it would be possible at least in theory. $\endgroup$ – bortran Mar 18 '15 at 19:14
  • $\begingroup$ I'm not all that familiar with cycles. From what I've just looked up though, yes, it should be possible. Your best bet at that point would be to look at either the python that interfaces with cycles and see if you can sneak in something there or you'd have to modify the application code. It definitely wouldn't be pretty though. $\endgroup$ – Coburn Mar 18 '15 at 19:20
  • $\begingroup$ If you had another lead where begin looking for, that would be great. Apart from that, this works pretty well, but render_init as well as render_pre doesn't wait for python to finish it's job. That's a big bummer. But you kinda anticipated that when suggesting hotkeys, didn't you? $\endgroup$ – bortran Mar 19 '15 at 18:48
  • $\begingroup$ Yeah, I've had some problems when working with some of the other handlers in the past. Also make sure that you're using the bpy.app.handlers.persistent [ blender.org/api/blender_python_api_2_74_0/… ] if you're loading new files so it doesn't clear your handler. Otherwise it's just the nature of the handlers I guess :c $\endgroup$ – Coburn Mar 19 '15 at 18:54
8
$\begingroup$

A method often used for rigged characters is to setup two groups, one containing the low-res objects and another containing the hi-res objects.

When linking a model from another blend file you select the group and Dupli-Group will be used, with a simple switch between low and hi res being made in the Duplication settings of the object properties. This method can swap the many related objects belonging to a group all in one go.

enter image description here

You could setup a pre and post render handler to swap these groups automatically.

bpy.context.object.dupli_group = bpy.data.groups["quadbot_bridge_lo"]
bpy.context.object.dupli_group = bpy.data.groups["quadbot_bridge_hi"]

To experiment and learn how this works you could try the CGCookie FlexRig which uses this technique. This was also used in Sintel and Tears of Steal if you have a copy of those data files.

$\endgroup$
1
$\begingroup$

one way is to switch the data block this will link : V groups, V color, material, UV maps ..; but it will reserve the modifiers, constraints Loc,Rot,Scale and animation

enter image description here

$\endgroup$
  • $\begingroup$ Well, either I don't understand it correctly or that doesn't solve the problem. If I change the linked mesh data to another (highpoly) object, it's immediatly interchanged with the other object in the viewport. $\endgroup$ – bortran Mar 18 '15 at 11:08
  • $\begingroup$ @bortran yes the change is immediate , does this work for you if it's triggered on render time ? $\endgroup$ – Chebhou Mar 18 '15 at 18:11
  • $\begingroup$ Depends I guess. If I have to trigger it at render time with Python I'd rather exchange objects completely instead of relinking the mesh data. However if your way was possible without Python to exchange at render time, that would be great also, and I think a lot of people then would like to know, how it worked. $\endgroup$ – bortran Mar 18 '15 at 19:19
0
$\begingroup$

The Visibility toggles for viewport and rendering allow you to control the resolution of a model based on what you see on the screen vs. what will be rendered.

You can click on or drag across the camera and eye icons to enable/disable visibility of Modifiers.

For the Subdivision and Multi-res Modifiers, there are also controls for changing what subdivision level will be used for either of the view modes.

enter image description here

$\endgroup$
0
$\begingroup$

To add to @sambler's answer, you can also link both the high poly and low poly versions and, using a rig proxy on the low poly version, animate whatever you like. Just hide the render layer of the low poly and hide the high poly version in the viewport.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.