Bump Mapping via Displacement input with OSL Doesn't Work #36368

Closed
opened 2013-08-04 00:40:35 +02:00 by Nathaniel Winckler · 7 comments

%%%--- Operating System, Graphics card ---
Mac OS 10.8.4 - AMD Radeon HD 6750M

- Blender version with error, and version that worked ---

Blender 2.68a. I don' think any other version works. I only tried it out with 2.68a and 2.67b.

- Short description of error ---

Bump mapping via the Displacement input on the Material Output node does not work with an OSL shader. Maybe it is supposed to be this way, but it just seems kind of odd.

- Steps for others to reproduce the error (preferably based on attached .blend file) ---

Turn on Open Shading Language in the Render settings. Create a simple OSL shader in Blender (I just created a diffuse(N) shader) as you can see in the attached file. Connect the BSDF output of that to the input on the Material Output node. Now connect a texture to the Displacement input on the Material Output node. No bump mapping shows up (the only reason that I can think that this wouldn't work is that the Normals are being affected by the OSL shader...but unless I'm doing something completely wrong, I can't get that to look anywhere near as nice as when I just connect something to the Displacement input). To show that Bump mapping works otherwise, disconnect the OSL shader and just connect a Diffuse Shader to the Material Output. There should be bump mapping now. (One thing to note: True Displacement works with OSL when the Experimental feature set is turned on).
%%%

%%%--- Operating System, Graphics card --- Mac OS 10.8.4 - AMD Radeon HD 6750M - Blender version with error, and version that worked --- Blender 2.68a. I don' think any other version works. I only tried it out with 2.68a and 2.67b. - Short description of error --- Bump mapping via the Displacement input on the Material Output node does not work with an OSL shader. Maybe it is supposed to be this way, but it just seems kind of odd. - Steps for others to reproduce the error (preferably based on attached .blend file) --- Turn on Open Shading Language in the Render settings. Create a simple OSL shader in Blender (I just created a diffuse(N) shader) as you can see in the attached file. Connect the BSDF output of that to the input on the Material Output node. Now connect a texture to the Displacement input on the Material Output node. No bump mapping shows up (the only reason that I can think that this wouldn't work is that the Normals are being affected by the OSL shader...but unless I'm doing something completely wrong, I can't get that to look anywhere near as nice as when I just connect something to the Displacement input). To show that Bump mapping works otherwise, disconnect the OSL shader and just connect a Diffuse Shader to the Material Output. There should be bump mapping now. (One thing to note: True Displacement works with OSL when the Experimental feature set is turned on). %%%

Changed status to: 'Open'

Changed status to: 'Open'

#42051 was marked as duplicate of this issue

#42051 was marked as duplicate of this issue

%%%Confirmed, assigning to Brecht. I quickly checked, but couldn't find the problem. %%%

%%%Confirmed, assigning to Brecht. I quickly checked, but couldn't find the problem. %%%

%%%It's a known issue actually, custom OSL shader scripts will not work with bump mapping at the moment. The reason is that the global N is no affected by bump mapping, instead we pipe the bumped normal into the Normal inputs in the existing shaders, but there's no way for custom scripts to do that.

I'll look into a solution, probably will need to split the generated OSL shader in separate bump and shading parts so we can modify N, as it's currently not possible to do that reliably from OSL code.%%%

%%%It's a known issue actually, custom OSL shader scripts will not work with bump mapping at the moment. The reason is that the global N is no affected by bump mapping, instead we pipe the bumped normal into the Normal inputs in the existing shaders, but there's no way for custom scripts to do that. I'll look into a solution, probably will need to split the generated OSL shader in separate bump and shading parts so we can modify N, as it's currently not possible to do that reliably from OSL code.%%%

%%%I'm going to move this to the todo list, this should be solved as part of a bigger displacement / bump refactor. For now the only way is to connected a Bump node to the custom OSL nodes.%%%

%%%I'm going to move this to the todo list, this should be solved as part of a bigger displacement / bump refactor. For now the only way is to connected a Bump node to the custom OSL nodes.%%%

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

Added subscribers: @bithunter64, @Sergey

Added subscribers: @bithunter64, @Sergey
Sign in to join this conversation.
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
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#36368
No description provided.