Shaders produce different results when OSL is enabled #43777

Closed
opened 2015-02-22 15:41:28 +01:00 by Fred Rothganger · 10 comments

System Information
Fedora Core 21
GTX580 (not in use, all CPU rendering)

Blender Version
Broken: 2.73a bbf09d9
(Has been broken in a number of previous versions, at least since 2.69)

Description of error
The attached Leaves.blend is part of a tree. Set viewport shading to "Rendered". At a distance (as posed in the file) the foliage looks darker (more correct) with the "Open Shading Language" box unchecked in Render settings. With OSL checked, everything comes out brighter. When zoomed in, they look about the same, suggesting some pixel quantizing is part of the effect. Looking very close, you see that the edges of the leaves are brighter in the OSL enabled state.

It may be that trimming back the alpha mask will correct this. Tried cleaning it up a little, but no improvement yet. However, the surprising part here is that enabling OSL makes a difference. Tried to simplify this down to just the Mix Shader, but the problem is not so evident as when the "fac" input is provided by the mask file. There is some noticeable difference when fac is fixed at 0.5.

**System Information** Fedora Core 21 GTX580 (not in use, all CPU rendering) **Blender Version** Broken: 2.73a bbf09d9 (Has been broken in a number of previous versions, at least since 2.69) **Description of error** The attached [Leaves.blend](https://archive.blender.org/developer/F145269/Leaves.blend) is part of a tree. Set viewport shading to "Rendered". At a distance (as posed in the file) the foliage looks darker (more correct) with the "Open Shading Language" box unchecked in Render settings. With OSL checked, everything comes out brighter. When zoomed in, they look about the same, suggesting some pixel quantizing is part of the effect. Looking very close, you see that the edges of the leaves are brighter in the OSL enabled state. It may be that trimming back the alpha mask will correct this. Tried cleaning it up a little, but no improvement yet. However, the surprising part here is that enabling OSL makes a difference. Tried to simplify this down to just the Mix Shader, but the problem is not so evident as when the "fac" input is provided by the mask file. There is some noticeable difference when fac is fixed at 0.5.

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @frothga

Added subscriber: @frothga

The images were not embedded in the previous file, but they are important to reproduce the problem. Here is another attempt. Leaves.blend

The images were not embedded in the previous file, but they are important to reproduce the problem. Here is another attempt. [Leaves.blend](https://archive.blender.org/developer/F145280/Leaves.blend)

Hmm. The problem does not reproduce in the second version I uploaded. This suggests either that the trimmed version of the alpha mask actually cleaned it up, or embedding the image changes the results, or that png works correctly but not jpg. Will study this a little more, and post something this afternoon.

Hmm. The problem does not reproduce in the second version I uploaded. This suggests either that the trimmed version of the alpha mask actually cleaned it up, or embedding the image changes the results, or that png works correctly but not jpg. Will study this a little more, and post something this afternoon.

Best I can tell, the thing that makes a difference is whether the file is packed or not. Specifically, there are two variables:
Open Shading Language = enabled / disabled
blatt1_a.png = packed / unpacked

with these results
image packed

  OSL enabled -> normal color
  OSL disabled -> normal color

image unpacked

  OSL enabled -> too light, especially zoomed out (seems that edges dominate the render)
  OSL disabled -> normal color

Results appear to be the same with the JPEG version of the file. However, after packing the image, you must save and reload to see the effect.

Best I can tell, the thing that makes a difference is whether the file is packed or not. Specifically, there are two variables: Open Shading Language = enabled / disabled blatt1_a.png = packed / unpacked with these results image packed ``` OSL enabled -> normal color OSL disabled -> normal color ``` image unpacked ``` OSL enabled -> too light, especially zoomed out (seems that edges dominate the render) OSL disabled -> normal color ``` Results appear to be the same with the JPEG version of the file. However, after packing the image, you must save and reload to see the effect.

It seems that both images (the leaf and its alpha mask) must be packed.

It seems that *both* images (the leaf and its alpha mask) must be packed.
Sergey Sharybin self-assigned this 2015-02-23 10:43:47 +01:00

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

Did some investigation and wouldn't really consider this is a bug. The things are:

  • OSL does support texture mipmapping using OIIO
  • When images are packed, no OIIO is used, meaning no mipmaps could be used
  • Mipmaps could really affect on the edges in this case, because they're like blurring the texture
  • SVM does not support mipmaps at all

This explains the difference in setups you're comparing and those difference are not caused by any bug actually. Supporting mipmaps for SVM is in our TODO list. So thanks for the report, but closing as TODO now.

Did some investigation and wouldn't really consider this is a bug. The things are: - OSL does support texture mipmapping using OIIO - When images are packed, no OIIO is used, meaning no mipmaps could be used - Mipmaps could really affect on the edges in this case, because they're like blurring the texture - SVM does not support mipmaps at all This explains the difference in setups you're comparing and those difference are not caused by any bug actually. Supporting mipmaps for SVM is in our TODO list. So thanks for the report, but closing as TODO now.

This sound like a pretty good explanation for the quantizing effect. However, I only see the color problems when the images are not packed. Your explanation would lead me to the opposite expectation.

This sound like a pretty good explanation for the quantizing effect. However, I only see the color problems when the images are *not* packed. Your explanation would lead me to the opposite expectation.

Not sure why it'll lead to opposite expectation...

Bright colors are only happening when mipmaps are used. And mipmaps are only used:

  • When OSL is enabled
  • When loading happens via OIIO

When OSL is getting enabled is pretty much straightforward :) Now, when OIIO is used in any cases BUT:

  • Movie files
  • Packed images

Don't see conflicts with my previous explanation tbh but would be happy to re-phrase it if it's still not totally clear :)

Not sure why it'll lead to opposite expectation... Bright colors are only happening when mipmaps are used. And mipmaps are only used: - When OSL is enabled - When loading happens via OIIO When OSL is getting enabled is pretty much straightforward :) Now, when OIIO is used in any cases BUT: - Movie files - Packed images Don't see conflicts with my previous explanation tbh but would be happy to re-phrase it if it's still not totally clear :)
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
2 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#43777
No description provided.