Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1224)

Issue 5440091: Normal Node for Cycles (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 5 months ago by dfelinto
Modified:
12 years, 5 months ago
Reviewers:
brechtvl, zanqdo, bf-codereview
Base URL:
https://svn.blender.org/svnroot/bf-blender/trunk/blender/
Visibility:
Public.

Description

Hi Brecht, I wanted to tackle a more complicated node and gave Normal Node a try. (and failed *cough* ;) I created a new NodeNormal for storage of the Normal, and whatever I put as default in the node_shader_normal.c::node_shader_init_normal() is passed to the shader correctly. The problem now is to hook up the interface normal values to the cycles storage node. Maybe I don't need a storage node and could use the bNodeSocketValueVector directly in blender_shader.cpp. I don't know if it's possible (and the way to go). Another idea was to create a custom get function in the RNA def_normal for the direction and point this to the bNodeSocketValueVector. Again, I don't know if is the correct way or even possible. FInal Notes: --------- My ultimate goal was to port the RGBCurves node to cycles, so I decided to start with a 'similar' but simpler one. I used the SkyTexture for some of the Also, I was testing with a sample file created before I added the storage node in node_shader_init_normal. That was crashing on blender_shader.cpp (get_float3(b_normal_node.direction());) and I couldn't figure out why. Luckily I had the insight of remove the node and create it again :) Thanks for any feedback and review. OSL comes once those problems are sorted out. #committed on 42669

Patch Set 1 #

Patch Set 2 : Final Patch, removing DNA and RNA as per Lukas orientation. Notes in code coming next #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+139 lines, -3 lines) Patch
intern/cycles/app/cycles_xml.cpp View 1 1 chunk +3 lines, -0 lines 0 comments Download
intern/cycles/blender/blender_shader.cpp View 1 2 chunks +11 lines, -1 line 1 comment Download
intern/cycles/kernel/CMakeLists.txt View 1 1 chunk +1 line, -0 lines 0 comments Download
intern/cycles/kernel/osl/nodes/CMakeLists.txt View 1 1 chunk +1 line, -0 lines 0 comments Download
intern/cycles/kernel/osl/nodes/node_normal.osl View 1 1 chunk +32 lines, -0 lines 4 comments Download
intern/cycles/kernel/svm/svm.h View 1 2 chunks +4 lines, -0 lines 0 comments Download
intern/cycles/kernel/svm/svm_normal.h View 1 1 chunk +42 lines, -0 lines 3 comments Download
intern/cycles/kernel/svm/svm_types.h View 1 1 chunk +2 lines, -1 line 0 comments Download
intern/cycles/render/nodes.h View 1 1 chunk +7 lines, -0 lines 0 comments Download
intern/cycles/render/nodes.cpp View 1 1 chunk +35 lines, -0 lines 2 comments Download
source/blender/nodes/shader/nodes/node_shader_normal.c View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 5
dfelinto
12 years, 5 months ago (2011-12-04 09:01:50 UTC) #1
zanqdo_gmail.com
go dalai go! just saying :D Daniel Salazar 3Developer.com On Sun, Dec 4, 2011 at ...
12 years, 5 months ago (2011-12-04 20:09:23 UTC) #2
dfelinto
Final Patch, removing DNA and RNA as per Lukas orientation. Notes in code coming next
12 years, 5 months ago (2011-12-16 00:49:14 UTC) #3
dfelinto
the patch is trunk ready imho. http://codereview.appspot.com/5440091/diff/5001/intern/cycles/blender/blender_shader.cpp File intern/cycles/blender/blender_shader.cpp (right): http://codereview.appspot.com/5440091/diff/5001/intern/cycles/blender/blender_shader.cpp#newcode208 intern/cycles/blender/blender_shader.cpp:208: node = norm; ...
12 years, 5 months ago (2011-12-16 00:55:33 UTC) #4
brechtvl
12 years, 5 months ago (2011-12-16 16:13:26 UTC) #5
Some comments, if those are fixed, LGTM.

http://codereview.appspot.com/5440091/diff/5001/intern/cycles/kernel/osl/node...
File intern/cycles/kernel/osl/nodes/node_normal.osl (right):

http://codereview.appspot.com/5440091/diff/5001/intern/cycles/kernel/osl/node...
intern/cycles/kernel/osl/nodes/node_normal.osl:27: direction =
normalize(Direction);
direction => Direction

http://codereview.appspot.com/5440091/diff/5001/intern/cycles/kernel/osl/node...
intern/cycles/kernel/osl/nodes/node_normal.osl:30: Dot = -dot(Direction,
NormalIn);
The dot product should not be negated, normals do not point inside in cycles.

http://codereview.appspot.com/5440091/diff/5001/intern/cycles/kernel/svm/svm_...
File intern/cycles/kernel/svm/svm_normal.h (right):

http://codereview.appspot.com/5440091/diff/5001/intern/cycles/kernel/svm/svm_...
intern/cycles/kernel/svm/svm_normal.h:38: stack_store_float(stack,
out_dot_offset, -dot(direction, normalize(normal)));
Same here, normal should not be negated.

http://codereview.appspot.com/5440091/diff/5001/intern/cycles/render/nodes.cpp
File intern/cycles/render/nodes.cpp (right):

http://codereview.appspot.com/5440091/diff/5001/intern/cycles/render/nodes.cp...
intern/cycles/render/nodes.cpp:743: }
No, the code used seems ok.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b