[Bf-cycles] Cycles per BSDF Bump/Normal mapping support

Agustin Benavidez agustinbenavidez at gmail.com
Tue May 29 16:41:52 CEST 2012

Hi Brecht,

I was implementing a contour/bevel shader node, and i though it could
convenient to have a input normal socket to connect the contour node there.
Messing with the code i end up implementing per bsdf bump/normal mapping.
here there are screenshots of the working patch: (the image nodes also have
initial basic normal mapping support too)


Also if you want to take a quick look at the implementation details i
attach you the patch too ( Is not meant to be for review, i still need to
clean it up and make some stuff there better)  :


*) Whats left is to define if this is the right workflow. The initial idea

N0: Normal input subgraph in the output node will define the first shader
normal (ShaderData::N)

N1: Displacement input in Output normal still makes bump mapping, it will
make displacement and bump mapping as needed, the normal generated here is
a modulation of the normal already defined in N0

- Bump Nodes in the user interface will compute the bump normal using the
ShaderData::N as base normal already defined by N0 and N1, the bump normal
output can be connected to normal input bsdf sockets, this normals will be
writen to ClosureData::N and used latter on in the bxdf sampling functions.

- For the user be able mix normals a new "mix normals" node could be added,
is not clear if it should be a new node or upgrade the vector math node
adding that option and a mix input socket.

- Image node:  still needs to let the user specify the normal
space whether is world/object/tangent space. Also a control "intensity"
could be added to attenuate the normal before output it in the normal out

*) Internal implementation details:

Bump node no longer writes directly the ShaderData::N, instead they output
the normal generated. To set the normal to ShaderData::N, there is a new
small node "SetNormal" this will be only used once in the shader graph, and
right now is used to set the normal defined by the subgraph in the input
normal of the output node.

Obviously you have something to say here. I'll wait for your advice on
this  whether improve it or reimplement it in an other way.

Thank you for you attention.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-cycles/attachments/20120529/fd486506/attachment.htm 

More information about the Bf-cycles mailing list