Commit Graph

57 Commits

Author SHA1 Message Date
d4fe34b1c0 A bit of a code cleanup in GLSL shader 2014-09-02 15:58:38 +06:00
ac1ddb6e64 Support window coordinates in cycles nodes. 2014-09-02 11:49:14 +02:00
bf0f3a04cc Fix second part of T41068 -- reflection mapping was wrong
Few things:
- reflect() takes arguments in this order: N, I, it was swapped
  in the previous code for some reason.

- Normal and view vectors are to be normalized. For the view
  vector we're now using shade_view() in order to deal with the
  ortho camera. However, Cycles does not support ortho camera
  for reflection, but this is easy to do in a separate commit.

- Reflection vector is to be in the world space. Kudos to
  Antony Riakiotakis for figuring this out!
2014-09-02 15:41:50 +06:00
08c1408f82 Fix T41068: 3D viewport shading - Material or Window vs. Rendered
Checked with Brecht, Cycles indeed expects generated to be in 0..1 space
instead of -1..1 as it is in BI.
2014-08-22 16:14:08 +06:00
b07ea2fc15 Fix T41456: soft light texture blend mode zero effect
Soft light and Linear light blend modes weren't implemented in glsl

Reviewers: psy-fi

Maniphest Tasks: T41456

Differential Revision: https://developer.blender.org/D744
2014-08-18 19:14:51 +02:00
1161b00c76 Fix T40658: UV map node not working for GLSL materials. 2014-07-19 14:59:41 +02:00
a5a869c579 Fix 2 GLSL errors, with Cycles Hair BSDF. 2014-06-20 09:36:25 +02:00
6cd5954246 Implement GLSL code for XYZ nodes. 2014-06-13 23:23:55 +02:00
9b3efa912a Fix T40478: wrong cycles fresnel with GLSL materials in the viewport. 2014-06-04 19:42:47 +02:00
8008d9bdfd Fix T40078: GLSL Lamp with OnlyShadow makes weird colors in object.
To prevent only shadow lamps from producing negative colors, shr->diff
and shr->spec should've been clamped to positive values after lamp loop.
2014-05-30 17:11:41 +09:00
3fbc984b06 Nodes: add absolute value operation to all math nodes
Reviewed By: dingto, brecht

Differential Revision: https://developer.blender.org/D507
2014-05-07 16:43:59 +02:00
1dcf956849 Fix for wrong behavior of 'darken' blend mode with factor.
The formula was not consistent across Blender and behaved strangely, now it is
a simple linear blend between color1 and min(color1, color2).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D489
2014-04-29 14:03:09 +02:00
87628cc5fb Fix GLSL after 7765b73f6d (Transparent Depth). 2014-04-21 16:32:08 +02:00
3ed49a810d Make matcaps suck less
This commit does various changes for matcaps:

One is taking advantage of drawing with pbvh (which would only happen
with dyntopo previously) and drawing with partial redraw during
sculpting.

The second one is support for masks. To make this work in the special
case of multires, which uses flat shading, I use the only available flat
shaded builtins in OpenGL 2.0 which are color and secondary color.

Abusing colors in that way is also essential for flat shading to work if
we are to use pbvh draw in multires, since it is the color that is being
interpolated flatly, not the normal (which can only interpolated
smoothly). The pbvh drawing code for multires used last triangle
element's normal to compute the shading which would only produce smooth
results. This could change if we did the shading in the vertex shader
for flat shaded primitives, but this is more complex and makes it harder
to have one shader to rule the mole.

Also increased the brightness of the default diffuse color for
sculpting. This should be useful since artists like to tweak the
lighting settings and it will give them the full dynamic range of the
lights, but also it helps with correct brightness of sculpted matcaps.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D435
2014-04-01 19:27:13 +03:00
9630fa7c7e Fix T38973: GLSL error, when using Cycles Light Path node. 2014-03-06 09:06:20 +01:00
6e8321f2c0 Fix GLSL compatible_pow to give 1.0 for 0 ^ 0 2014-01-14 22:58:07 +04:00
ab9822eff8 Blender Internal: Add "Lamp Data" shader node that allows shaders to acquire information such as light vector from specified Lamp.
For now this provides the following outputs:

- Color
- Light Vector
- Distance
- Shadow
- Visibility Factor

Note: Color output is multiplied by the lamp energy.  Multiplication of
color*max(dot(light_vector,normal_vector),0)*shadow*visibility_factor
produces the exact same result as the Lambert shader.

Many thanks to Brecht for code review and discussion!
2013-11-25 22:19:47 +09:00
178bd849bf Blender Internal: Revert own previous commit for "Camera Data" node, correct GLSL code for view vector output of "Geometry" node.
Revert 0c7d2de382. The "Camera Data" node actually gives the location
of the point in camera coordinate system.  To obtain actual camera data,
we can use "Geometry" node instead.

Also modify the "Geometry" node, to produce correct view vector output
in orthographic GLSL preview.
2013-11-25 02:21:06 +09:00
0c7d2de382 Blender Internal: Fix shader node "Camera Data" that doesn't consider orthographic view.
Note that Cycles still needs to fix.
2013-11-24 18:56:19 +09:00
bd5da19d86 Cycles: Add a "Normal" input socket to the Layer Weight node + GLSL drawing code.
Patch by lichtwerk (Philipp Oeser).

Differential Revision: http://developer.blender.org/D28
2013-11-22 00:33:28 +01:00
98bf859efc Blender Internal: Add shader nodes "Separate HSV" and "Combine HSV", same as Cycles' ones. 2013-11-21 12:43:38 +09:00
ba7fd8cd5c Change the behavior of AO pass in Blender internal's shader/render node tree so that it becomes (1.0, 1.0, 1.0) when AO is disabled.
For materials using AO pass, this makes the material preview and the GLSL
preview more accurate, but shouldn't affect final rendering in most cases
because we usually enable AO when using the AO pass in node tree.

Thanks to Brecht for code review.
2013-11-12 10:59:40 +00:00
cc7b2a0b04 Cycles / Fresnel Node:
* Add a "Normal" Input to the Fresnel node.
* Fix for the Fresnel GLSL code (normalize the Incoming vector).

Patch #37384 by Philipp Oeser (lichtwerk) , thanks!
2013-11-09 13:14:00 +00:00
ae25238f41 Fix #36882: cycles gamma node not working with glsl materials. 2013-09-30 12:11:27 +00:00
cdc2cf4fd3 FIX: [#27536] GLSL object space normal maps have wrong shading
Added object and world space for normal map in GLSL view.
2013-09-20 11:55:43 +00:00
Lukas Toenne
8953141a53 Fix #36734 Matcap displays solid black.
GLSL typo in r60151 caused this.
2013-09-16 11:40:04 +00:00
3306afac87 Cycles Hair: Two basic bair shaders added
A new hair bsdf node, with two closure options, is added. These closures allow the generation of the reflective and transmission components of hair. The node allows control of the highlight colour, roughness and angular shift.

Llimitations include:
-No glint or fresnel adjustments.
-The 'offset' is un-used when triangle primitives are used.
2013-09-15 23:58:00 +00:00
d6b96563bc Fix broken GLSL shader after recent changes. 2013-09-05 00:37:10 +00:00
b314209356 Cycles: add a sharpness input to the Cubic SSS falloff. When set to 1 this will
give a result more similar to the Compatible falloff option. The scale is x2
though to keep the perceived scatter radius roughly the same while changing the
sharpness. Difference with compatible will be mainly on non-flat geometry.
2013-09-03 22:39:17 +00:00
553dd71efb Fix GLSL not showing shading properly on the backside of faces. Now it flips
the normal towards the viewer, seems to give consistent results with blender
internal, cycles, normal maps, etc.

Started from patch #32761 by Vitor Balbio, but changed it to do normal flipping
earlier so it solves all cases.
2013-06-24 13:46:34 +00:00
e66f3eb499 Cycles: GLSL materials now can use multiple UV maps with the attribute node. 2013-06-05 15:54:39 +00:00
9fca5f47bc Fix #35617: cycles GLSL object texture coordinates were wrong. 2013-06-04 15:49:34 +00:00
601b8c1041 Fix #35505: cycles object space normal mapping did not match blender internal.
Now it uses the same (strange) YZ flipping convention.
2013-05-27 17:48:02 +00:00
1140051e56 Fix for [#35490] Initial cube is green, turn off matcap and it is correct color
* Own error from r56980, "smooth" is an Interpolation qualifier in GLSL, so use another variable name to avoid the error.
2013-05-24 12:25:18 +00:00
99b325cebf Cycles / Toon BSDF:
* Added a toon bsdf node to Cycles. This was already available as OSL only closure, but is now available inside the SVM backed as well, for CPU and GPU rendering. 
* There are 2 variations available, diffuse and glossy toon, selectable via a menu inside the node. 

Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/Shaders#Toon

Example render & blend file:
http://www.pasteall.org/pic/show.php?id=51970
http://www.pasteall.org/blend/21579
2013-05-23 17:45:20 +00:00
38dc85f296 Math Node:
* Added a Modulo operation to the math node, available in Compositor, Shader and Texture Nodes.
2013-05-20 14:38:47 +00:00
eaa6479ae3 Cycles: bump node changes to add a Distance input that controls the overall displacement
distance, and an Invert option to invert the bump effect.
2013-05-10 16:57:17 +00:00
f9592e9a6e Fix #35063: GLSL texture node Value output was not outputting alpha. 2013-04-24 15:05:43 +00:00
de9dffc61e Cycles: initial subsurface multiple scattering support. It's not working as
well as I would like, but it works, just add a subsurface scattering node and
you can use it like any other BSDF.

It is using fully raytraced sampling compatible with progressive rendering
and other more advanced rendering algorithms we might used in the future, and
it uses no extra memory so it's suitable for complex scenes.

Disadvantage is that it can be quite noisy and slow. Two limitations that will
be solved are that it does not work with bump mapping yet, and that the falloff
function used is a simple cubic function, it's not using the real BSSRDF
falloff function yet.

The node has a color input, along with a scattering radius for each RGB color
channel along with an overall scale factor for the radii.

There is also no GPU support yet, will test if I can get that working later.

Node Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/Shaders#BSSRDF

Implementation notes:
http://wiki.blender.org/index.php/Dev:2.6/Source/Render/Cycles/Subsurface_Scattering
2013-04-01 20:26:52 +00:00
e8d532f1dd style cleanup 2013-03-31 03:28:46 +00:00
afe9970d48 style cleanup 2013-03-16 14:42:05 +00:00
6786975f78 Fix #34254: cycles brightness/contrast node was missing for GLSL material view. 2013-02-15 11:46:31 +00:00
e11d22a6b7 Matcap support in 3D Viewport.
Full log is here:
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability#Matcap_in_3D_viewport

Implementation notes:

- Matcaps are an extension of Solid draw mode, and don't show in other drawmodes.
  (It's mostly intended to aid modeling/sculpt)

- By design, Matcaps are a UI feature, and only stored locally for the UI itself, and
  won't affect rendering or materials.

- Currently a set of 16 (GPL licensed) Matcaps have been compiled into Blender. 
  It doesn't take memory or cpu time, until you use it.

- Brush Icons and Matcaps use same code now, and only get generated/allocated on
  actually using it (instead of on startup).

- The current set might get new or different images still, based on user feedback.

- Matcap images are 512x512 pixels, so each image takes 1 Mb memory. Unused matcaps get 
  freed immediately. The Matcap icon previews (128x128 pixels) stay in memory.

- Loading own matcap image files will be added later. That needs design and code work 
  to get it stable and memory-friendly.

- The GLSL code uses the ID PreviewImage for matcaps. I tested it using the existing
  Material previews, which has its limits... especially for textured previews the
  normal-mapped matcap won't look good.
2013-01-22 11:18:41 +00:00
692aa18b76 Additional fix in glsl shaders: "Darken" was using different formula as render.
"Divide" still differs too for division by zero - cannot find this yet...
2012-12-21 18:10:01 +00:00
eb219852a8 Bug fix #33639
Material Texture blend modes Screen, Overlay and Multiply didn't respect
the alpha for textures... an error I could trace back to 2004 even.

Obviously the fix should be done, but it might change the appearance of
renders somewhat. Will keep an eye open if this is worth ugly 
version-patching.

Now: image textures with alpha, will only apply the blend modes
respecting the alpha values.
2012-12-21 10:15:12 +00:00
64467e3ffa Fixes related to #33087:
* Fix GLSL memory leak in the (vector) math node.
* Fix GLSL math node pow behavior for negative values, same as was done for C.
2012-11-06 19:58:48 +00:00
2ba840652d Cycles: improve Anisotropic BSDF node, changing the Roughness U/V inputs to
Roughness, Anisotropy and Rotation. Also a fix for automatic tangents and
OSL attribute handling.

Meaning of new sockets explained in the documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/Shaders#Anisotropic
2012-11-04 22:31:32 +00:00
f3ece5a108 style cleanup: trailing tabs & expand some non prefix tabs into spaces. 2012-10-21 05:46:41 +00:00
f7a584b841 Fix #32903: bring cycles glsl up to date with latest changes. 2012-10-18 12:37:51 +00:00
adea12cb01 Cycles: merge of changes from tomato branch.
Regular rendering now works tiled, and supports save buffers to save memory
during render and cache render results.

Brick texture node by Thomas.
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/Textures#Brick_Texture

Image texture Blended Box Mapping.
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/Textures#Image_Texture
http://mango.blender.org/production/blended_box/

Various bug fixes by Sergey and Campbell.
* Fix for reading freed memory in some node setups.
* Fix incorrect memory read when synchronizing mesh motion.
* Fix crash appearing when direct light usage is different on different layers.
* Fix for vector pass gives wrong result in some circumstances.
* Fix for wrong resolution used for rendering Render Layer node.
* Option to cancel rendering when doing initial synchronization.
* No more texture limit when using CPU render.
* Many fixes for new tiled rendering.
2012-09-04 13:29:07 +00:00