Inconsistent normal N in OSL for material output with displacement. #42051
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#42051
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Ubuntu 14.04 64, Windows 7 64, Geforce GTX 760, Compute Device CPU
Blender Version
Broken: since 2.70
Worked: 2.65-2.69 (partially)
Short description of error
When using OSL to access the surface normal N, indirect vs. direct access produces inconsistent output. The value of N - when using displacement - depends on the OSL code path and on the BSDF used. It ignores surface changes introduced by displacement when accessed indirectly, but uses the displacement normals when accessed directly. Note that versions <= 2.69 always use the normals produced by the displacement and the output does not depend on the code path. Also, N depends on the BSDF used. Using an Emission BSDF for example, completely ignores the displacement normals. For 2.72 RC the following occurs (tested with Windows and Linux builds):
Color = color(N);
works with displaced normals, while
normal x = N;
Color = color(x);
Color = color(N- [x],N- [x],N[2]);
Color = color(normal(N))
Color = color(vector(N))
uses only per face normals.
disp_normals.blend
Exact steps for others to reproduce the error
See attached images and .blend
Changed status to: 'Open'
Added subscriber: @bithunter64
Added subscriber: @Sergey
I noticed another issue, which might be related. There seems to be no displacement at all, when using compiled OSL code. I used blender/intern/cycles/kernel/shaders/node_wave_texture.osl to compare and compiled it from within Blender. The standard wave texture node works as espected, while the compiled shader code does not (for displacement). Using it for color input of a Diffuse BSDF works with both. See attached images.
Closed as duplicate of #36368
Added subscriber: @brecht
This is a limitation of the current system, and a proper solution basically needs a major overhaul of the way displacement is computing in OSL or SVM nodes. Right now the OSL system is designed to be compatible with SVM, but that relies on some special shader graph modification code which doesn't work with custom OSL nodes.
Either this system needs to be changed so custom OSL nodes can properly make use of it, or SVM needs to support OSL style automatic differentials (which is very complicated to implement). This has been on the todo list for a while, not considered a bug.