Osl works different in MacOs and Windows: attribute quering #51674

Closed
opened 2017-05-31 05:36:47 +02:00 by Ilja Razinkov · 14 comments

{F613610}System Information
Windows 10 and latest MacOs

Blender Version
Broken: 2.78 fb82948

  1. I use latest blender (the same daily build) on Windows and MacOs at the same time
  2. I render layer with material overload to calculate special values on image
  3. Currently i see DIFFERENT behaviour between Windows and MacOs systems in some areas of OSL shader.

Specifically quering for UVMap and Vertex Color values via getattribute("uv map name/vertextCol map name") and getmessage("trace", "uv map name/vertextCol map name") is working on MacOs and NOT working in Windows.

In Windows it produces (0,0) always. In MacOs attributes are real values from object.

The same problem exist with "geom:uv" attribute - works in MacOs build and not working in Windows build.

Basic U and V global variables works in both builds but in different ways:

  • In MacOs they respect uvmap attached.
  • In windows U and V denotes simle mapping per triangle rendered
    With this limitations it is hard to write OSL code for both platforms, see attached blend for minimal example.

P.S. Thanks for Blender, it`s great!

{[F613610](https://archive.blender.org/developer/F613610/osl_bug_uvmapignored.blend)}**System Information** Windows 10 and latest MacOs **Blender Version** Broken: 2.78 fb82948 1) I use latest blender (the same daily build) on Windows and MacOs at the same time 2) I render layer with material overload to calculate special values on image 3) Currently i see DIFFERENT behaviour between Windows and MacOs systems in some areas of OSL shader. Specifically quering for UVMap and Vertex Color values via getattribute("uv map name/vertextCol map name") and getmessage("trace", "uv map name/vertextCol map name") is working on MacOs and NOT working in Windows. In Windows it produces (0,0) always. In MacOs attributes are real values from object. The same problem exist with "geom:uv" attribute - works in MacOs build and not working in Windows build. Basic U and V global variables works in both builds but in different ways: - In MacOs they respect uvmap attached. - In windows U and V denotes simle mapping per triangle rendered With this limitations it is hard to write OSL code for both platforms, see attached blend for minimal example. P.S. Thanks for Blender, it`s great!
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @IPv6

Added subscriber: @IPv6

Added subscriber: @ArtoKitula

Added subscriber: @ArtoKitula
Member

Added subscriber: @LazyDodo

Added subscriber: @LazyDodo
Member

I noticed the weird behavior of the u and v globals as well, but just as a sanity check, are you saying this file on mac renders identical rectangles?

osl_uvtest.blend

results on windows: (osl left, texture coordinates uv right)

uv_test.png

I noticed the weird behavior of the u and v globals as well, but just as a sanity check, are you saying this file on mac renders identical rectangles? [osl_uvtest.blend](https://archive.blender.org/developer/F642647/osl_uvtest.blend) results on windows: (osl left, texture coordinates uv right) ![uv_test.png](https://archive.blender.org/developer/F642648/uv_test.png)
Author

osl_uvtest_macos.png
osl_uvtest_windows.png

Thank you for attention to this bug, i tryed to render you test file.
You file renders osl wrong in BOTH systems, though //
See attached renders.

![osl_uvtest_macos.png](https://archive.blender.org/developer/F643170/osl_uvtest_macos.png) ![osl_uvtest_windows.png](https://archive.blender.org/developer/F643172/osl_uvtest_windows.png) Thank you for attention to this bug, i tryed to render you test file. You file renders osl wrong in BOTH systems, though // See attached renders.
Author

But to be noted: in my bug i use attached UVMap, unwrapped and attached to object. And i can get it in MacOs but can`t in Windows.
I modified a bit your example to denote difference, see attachments.
Both "geom:uv" and "UVMap" attributes work fine in MacOs{F643176}

osl_uvtest_macos_upd.png

But to be noted: in my bug i use attached UVMap, unwrapped and attached to object. And i can get it in MacOs but can`t in Windows. I modified a bit your example to denote difference, see attachments. Both "geom:uv" and "UVMap" attributes work fine in MacOs{[F643176](https://archive.blender.org/developer/F643176/osl_uvtest_uvmap.blend)} ![osl_uvtest_macos_upd.png](https://archive.blender.org/developer/F643177/osl_uvtest_macos_upd.png)
Member

Added subscriber: @brecht

Added subscriber: @brecht
Member

While final image seems identical on windows, it does crash the blender at the end of the render, debug heap seems to imply it's a use after free bug, @brecht do you happen to have time to run F643176 through asan ? (and maybe comment on the other problems?)

While final image seems identical on windows, it does crash the blender at the end of the render, debug heap seems to imply it's a use after free bug, @brecht do you happen to have time to run [F643176](https://archive.blender.org/developer/F643176/osl_uvtest_uvmap.blend) through asan ? (and maybe comment on the other problems?)

The u and v shaderglobals are the barycentric coordinates within each triangle, they are not always continuous within a quad. The osl_uvtest.blend renders look correct to me. If u and v match the uv map, that must be a coincidence or some OSL shader assigned them different values, I can't imagine how those values would accidentally end up in there otherwise.

Address sanitizer on macOS didn't show me any warnings rendering osl_uvtest_uvmap.blend. I guess the first thing to check would be if OSLRenderServices::get_attribute() gets called, and if so why it fails to return a correct value.

The `u` and `v` shaderglobals are the barycentric coordinates within each triangle, they are not always continuous within a quad. The `osl_uvtest.blend` renders look correct to me. If `u` and `v` match the uv map, that must be a coincidence or some OSL shader assigned them different values, I can't imagine how those values would accidentally end up in there otherwise. Address sanitizer on macOS didn't show me any warnings rendering `osl_uvtest_uvmap.blend`. I guess the first thing to check would be if `OSLRenderServices::get_attribute()` gets called, and if so why it fails to return a correct value.
Member

I don't want to pollute this ticket too much, so i reported the crash on windows in #51967.

For this ticket i'm gonna need a better repro case. @IPv6 can you post an as simple as possible blend (preferable the uv squares scene we have been using) and results of rendering this file on mac/linux/windows so we can clearly see the differences between the platforms?

I don't want to pollute this ticket too much, so i reported the crash on windows in #51967. For this ticket i'm gonna need a better repro case. @IPv6 can you post an as simple as possible blend (preferable the uv squares scene we have been using) and results of rendering this file on mac/linux/windows so we can clearly see the differences between the platforms?
Author

In #51674#443821, @LazyDodo wrote:
For this ticket i'm gonna need a better repro case. @IPv6 can you post an as simple as possible blend (preferable the uv squares scene we have been using) and results of rendering this file on mac/linux/windows so we can clearly see the differences between the platforms?

In fact... not anymore :( After updating both system to latest builds i do not see differenses anymore, too. But there is definitely something shady under the hood (i get crashes sometimes too, and initially i can not get the same results in quite stable manner), being programmer myself suspect floating memory bug that pollutes at random places Anyway, even my full-blown blend with osl works fine on both systems right now Sorry, if it takes your time checking this ticket.

P.S. still, idea mentioned above (u, v without UVMaps is baricentric coordinates and this is OK) seems strange to me. Imho it definitely should look the same as without OSL at least, current u-v implementation just plain not usable at all.

> In #51674#443821, @LazyDodo wrote: > For this ticket i'm gonna need a better repro case. @IPv6 can you post an as simple as possible blend (preferable the uv squares scene we have been using) and results of rendering this file on mac/linux/windows so we can clearly see the differences between the platforms? In fact... not anymore :( After updating both system to latest builds i do not see differenses anymore, too. But there is definitely something shady under the hood (i get crashes sometimes too, and initially i can not get the same results in quite stable manner), being programmer myself suspect floating memory bug that pollutes at random places *Anyway, even my full-blown blend with osl works fine on both systems right now* Sorry, if it takes your time checking this ticket. P.S. still, idea mentioned above (u, v without UVMaps is baricentric coordinates and this is OK) seems strange to me. Imho it definitely should look the same as without OSL at least, current u-v implementation just plain not usable at all.
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Ray molenkamp self-assigned this 2017-07-04 15:02:49 +02:00
Member

Well if you ever do stumble on a reliable repro case, i'd be happy to look at it, for now i don't think there's anything more to be done.

Well if you ever do stumble on a reliable repro case, i'd be happy to look at it, for now i don't think there's anything more to be done.
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#51674
No description provided.