3
$\begingroup$

The view-port lighting is very useful for me for viewing objects and I like its lighting system, which made me wanting to replicate it into my animation renders. For example, I would use this when I want to render a scene with view-port lighting results and at the same time if I want to display some features from the blender internal or cycles render engine. For view-port render there is a view-port render button - enter image description here

However, the view-port rendering does not feature features from both render engines.

  • Is there a way to replicate the view-port rendering so that an animation looks as if it is rendered with the view-port rendering button?
$\endgroup$
2
  • $\begingroup$ If you use sun lamps which don't depend on location, then zooming with the camera won't affect the lighting. $\endgroup$
    – gandalf3
    Sep 1, 2014 at 23:04
  • $\begingroup$ Is there a way to do it in a way that I can preview materials when in rendered view? (same user, different account) $\endgroup$
    – Vladimir
    Sep 4, 2014 at 15:30

1 Answer 1

5
$\begingroup$

Can you tell which part is Cycles and which is viewport render? ;)

enter image description here

Unfortunately blenders normal ball widgets don't have any way to set values numerically (yet), so you'll have to use some python to get and set the values.

  1. Get the default openGL lights from the user-preferences. To do this, run the following in the python console:

    for light in bpy.context.user_preferences.system.solid_lights:
        print(light.direction)
    

    It should print something like

    <Vector (-0.8920, 0.3000, 0.9000)>
    <Vector (0.5880, 0.4600, 0.2480)>
    <Vector (0.2160, -0.3920, -0.2160)>
    
  2. Create a material and add three normal nodes, then run

    bpy.data.materials['openGL'].node_tree.nodes['Normal.001'].outputs[0].default_value = (0.5880, 0.4600, 0.2480)
    

    Where openGL is the name of the material, Normal.001 is the name of your normal node, and (0.5880, 0.4600, 0.2480) is the direction you want to set it too. Do this three times, changing the the node and direction until your three normal nodes look like the light widgets in the user preferences.

  3. Copy/paste the diffuse colors from the user prefs into RGB nodes in your setup:

    enter image description here

    Note that you can copy/paste colors by pressing ⎈ CtrlC/⎈ CtrlV while hovering over a color field, but make sure the correct window is focused when going between multiple windows.

  4. Setup the rest of the nodes, and enjoy your path-traced openGL renders :P

$\endgroup$
7
  • $\begingroup$ I'm a little new to coding, but where you say "run the following in the python console", you are referring to the text editor or something else? I've read about python coding, but how do I run the script? $\endgroup$
    – Vladimir
    Sep 2, 2014 at 14:57
  • $\begingroup$ @Vladimir I mean the python console inside blender (It's the last one in the editor list). You could use the text editor, but it will be printed to the system console instead. $\endgroup$
    – gandalf3
    Sep 2, 2014 at 18:00
  • $\begingroup$ Sorry, I'm stuck on "2". What are the 3 normal nodes? Is there a site or tutorial that covers all this? $\endgroup$
    – Vladimir
    Sep 2, 2014 at 19:08
  • $\begingroup$ @Vladimir You have to add three normal nodes to the cycles material (Shift A > Vector > Normal) $\endgroup$
    – gandalf3
    Sep 2, 2014 at 19:10
  • $\begingroup$ Ok, thanks. Do you know something that covers of this so that I can relate to the answer? $\endgroup$
    – Vladimir
    Sep 2, 2014 at 19:20

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.