Anyone manage to get texture file reads working using V-Ray's Maya plugin when using VrayMtlOSL?

298 views
Skip to first unread message

Scott Bean

unread,
Mar 17, 2016, 2:41:06 PM3/17/16
to OSL Developers
My shaders work fine, but whenever I try using texture( "myfile.png", u, v ) the result is black. I've tried loading the texture in the material editor/project, putting the texture in every folder Maya may be looking, and also tried passing in strings to the shader witth the filename like in some of the sample OSL files, but no luck.

Any help would be greatly appreciated!

Scott

Larry Gritz

unread,
Mar 17, 2016, 2:44:46 PM3/17/16
to osl...@googlegroups.com
Are there any error messages that suggest that the file is not being read?

Does it work with any other texture (or texture format)?

Can you have the renderer print the OSL/OIIO statistics? (Is there a V-Ray option for that?) And if so, do you see indications that any texture is being read?

Can you give a more complete listing of what the shader is doing?
--
Larry Gritz
l...@larrygritz.com


Scott Bean

unread,
Mar 17, 2016, 3:11:26 PM3/17/16
to OSL Developers
Not sure where to look for errors. The Maya output window shows a couple render time v-ray messages, but nothing when the shader fails to compile or any mention of missing textures or failed reads. When I do try to load an OSL with an error in it, the Maya script command line turns red and a very vague error message about the shader failing to compile appears in the script editor.

In the render settings for V-Ray->Settings->System there's a "Log message level" dropdown, and an "abort rendering on missing asset" but seems to keep rendering even with a non-existant texture path.

My tool is generating some complex shaders, but for this texture test, this simple shader's texture(..) is returning black.

#include "stdosl.h"

surface test()
{
Ci = emission() * texture( "diffuse.png", u, v ); 

Scott Bean

unread,
Mar 17, 2016, 3:14:52 PM3/17/16
to OSL Developers
Here's the help on their log feature which doesn't seem to be even logging compile errors or failed texture reads. Hopefully someone from Chaos pops in. I'm golden if I can get this working.

Log message level – Determines which messages, if any, are going to be displayed in the Output Window.

Scott Bean

unread,
Mar 17, 2016, 3:30:21 PM3/17/16
to OSL Developers
I was using IPR mode, when final rendering there's more stats output to the maya output window, but nothing about missing textures. I also found the "vray4maya_log.txt" log file in \users\<name>\appdata\local\temp which seems to be the same details posted to the maya output window.

Scott Bean

unread,
Mar 17, 2016, 3:33:50 PM3/17/16
to OSL Developers
Also since they don't expose or include their own version of "stdosl.h", this texture(..) call could be empty and returning 0 for all I know 0_o

fusc...@gmail.com

unread,
Mar 17, 2016, 3:38:23 PM3/17/16
to OSL Developers
On Thursday, March 17, 2016 at 8:41:06 PM UTC+2, Scott Bean wrote:
My shaders work fine, but whenever I try using texture( "myfile.png", u, v ) the result is black. I've tried loading the texture in the material editor/project, putting the texture in every folder Maya may be looking, and also tried passing in strings to the shader witth the filename like in some of the sample OSL files, but no luck.

Any help would be greatly appreciated!

Hi,

The feature that makes it possible to sample textures using direct string paths is disabled in V-Ray at the moment.
To read textures you need to provide string input parameters in the shader and then connect a Maya or 3dsMax file reading texture node to this input.
Are you using a constant strings or are you generating the strings in the shader using string operations and the values of some inputs parameters?

Best regards,
Teodor

Scott Bean

unread,
Mar 17, 2016, 3:56:37 PM3/17/16
to OSL Developers
Was worried that was the case. Ya I tried that a few times, added an string input to the shader and clicked on the little checkered link next to the exposed shader attribute, chose a "maya 2d texture file" node, directed it to a png image and nothing, no errors, just black.

I assigned a new OSL vray material to my mesh using the toolbar menu, should I be adding a full maya network and connecting the file texture in the graph to the OSL material or something? I had tried something like that but the OSL node wasn't exposing any of my exposed shader attributes.

Gonna fiddle around some more.
Message has been deleted

Scott Bean

unread,
Mar 17, 2016, 5:38:53 PM3/17/16
to OSL Developers
Ok got it working, there were a couple "gotchas" to look out for. First, when I change the file or anything in Hypershade, nothing was changing in IPR mode in the viewport, but the second I final render the scene, the IPR scene updates. Hoping there is an option to auto-update the IPR scene when a new texture is loaded. Second, I switched to trying to use a string with [[string widget = "filename"]] to have it show up as a string in my shader attributes window, but not specifying a widget shows it as a color, which I then link in normally in Hypershade.

I'm auto-generating my shaders using NodeFlex ( my programmable node-based shader tool ) so it would have been really nice to be able to just bake in texture names within the shader and hit the "Recreate Attributes" button to reload the shader and see my changes, but having to manually hook up textures in Hypershade and render in production mode is a bit of a hassle, might just stick with auto-generating a preview vray vrscene and rendering it with the standalone renderer.

Thanks for the help guys,

Scott

fusc...@gmail.com

unread,
Mar 18, 2016, 1:26:13 PM3/18/16
to OSL Developers
Hi,


On Thursday, March 17, 2016 at 11:38:53 PM UTC+2, Scott Bean wrote:
First, when I change the file or anything in Hypershade, nothing was changing in IPR mode in the viewport, but the second I final render the scene, the IPR scene updates.

Yes, this is a known issue. We'll get to it someday.

 
Second, I switched to trying to use a string with [[string widget = "filename"]] to have it show up as a string in my shader attributes window, but not specifying a widget shows it as a color, which I then link in normally in Hypershade.

We don't support the widget hints, too :(
 
I'm auto-generating my shaders using NodeFlex ( my programmable node-based shader tool ) so it would have been really nice to be able to just bake in texture names within the shader and hit the "Recreate Attributes" button to reload the shader and see my changes, but having to manually hook up textures in Hypershade and render in production mode is a bit of a hassle, might just stick with auto-generating a preview vray vrscene and rendering it with the standalone renderer.

You can generate vrscene files containing whole shading networks and then load them in Maya using the vrmat material.

Best regards,
Teodor
 

Scott Bean

unread,
Mar 18, 2016, 2:28:10 PM3/18/16
to OSL Developers
Thanks for the insight. Got another one for you ( possible bug )

I'm playing around with bump mapping, refraction( MyNormal, ... ) works as expected with a custom bumped normal, but reflection( MyNormal ) ignores my normal completely, and seems to force the use of the global N. I can even call reflection( normal( 0, 0, 0 ) ) and it still uses the internal N normal.

This a known bug?

fusc...@gmail.com

unread,
Mar 21, 2016, 11:20:35 AM3/21/16
to OSL Developers


On Friday, March 18, 2016 at 8:28:10 PM UTC+2, Scott Bean wrote:
This a known bug?

Is wasn't, but now it is. :)
I've logged it in our issues tracker.

/Teodor

Scott Bean

unread,
Mar 21, 2016, 6:39:46 PM3/21/16
to OSL Developers
Thanks Teodor!
Reply all
Reply to author
Forward
0 new messages