Cycles: Support bump mapping in GLSL viewport
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 20 May 2016 12:16:54 +0000 (14:16 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sun, 22 May 2016 13:12:14 +0000 (15:12 +0200)
commit120492ace9150913f106f329942684c583a6f697
tree117c2be4b67cfc5caa50b6a54f65ec3bf0387863
parent6115267a845a49bdf9a5d4c701fcf5b995fc499a
Cycles: Support bump mapping in GLSL viewport

This commit implements Bump node in GLSL, making it possible to
see previews of bump mapping in viewport without need to render.
Nothing really fancy going on here, just uses internal dFdx/dFdy
functions to get derivatives of the surface and map itself.
Quite basic but seems to behave correct-ish.

This commit also makes Displacement material output to affect
viewport shading by re-linking unconnected Normal input to a
node which was used for displacement output (via Bump node).

Intention of all this is to make it really easy to do bump map
painting with Cycles as an active render engine.

Reviewers: campbellbarton, mont29, brecht, psy-fi

Reviewed By: brecht

Subscribers: Blendify, eyecandy

Differential Revision: https://developer.blender.org/D2014
source/blender/gpu/shaders/gpu_shader_material.glsl
source/blender/nodes/shader/node_shader_tree.c
source/blender/nodes/shader/nodes/node_shader_bump.c