Osl works different in MacOs and Windows: attribute quering
Closed, InvalidPublic

Description

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!

Details

Type
Bug
Ilja Razinkov (IPv6) updated the task description. (Show Details)

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?

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

Aaron Carlisle (Blendify) triaged this task as Incomplete priority.Jun 26 2017, 5:37 AM


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.

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}

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 Van Lommel (brecht) do you happen to have time to run F643176 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.

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

For this ticket i'm gonna need a better repro case. @Ilja Razinkov (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?

For this ticket i'm gonna need a better repro case. @Ilja Razinkov (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.

LazyDodo (LazyDodo) closed this task as Invalid.Jul 4 2017, 3:02 PM
LazyDodo (LazyDodo) claimed this task.

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.