Force USD Preview Surface in OpenGL Viewer with 19.5

   3918   6   3
User Avatar
Member
123 posts
Joined: 9月 2018
Offline
Hello everyone,

In Houdini 19.0 if I had a MaterialX and a USD Preview Surface Shader both connected to a collect VOP then Houdinis OpenGL Viewport would display the Preview Surface. This is great because the automatic Material preview translation from more "complex" materials often doesn't display nicely.
In 19.5 however it will always display the translated MaterialX shader.
Is there any way of forcing the viewport to choose the Preview Shader instead? Disabling "Auto Generate Preview Surface Shaders" doesn't help, unfortunately...
The "mtlxstandard surface to UsdPreviewSurface" VOP does seem to indicate that there is a way to force the Preview surface instead.


In my opinion, if this was an intentional change, then I would prefer the previous behavior. It seems to have gotten better at translating MaterialX Shaders to Viewport Shaders, but sometimes you want to use different textures that play nice in the Viewport, or use more basic materials.
Also, what does the "Auto Generate Preview Surface Shaders" checkbox do if it still displays viewport shaders even if disabled?

Maybe somebody can shine some light on this.
User Avatar
Member
8742 posts
Joined: 7月 2007
Online
I'd also like to know that
the mtlx display in OGL seems quite buggy to me, trying super simple mtlxnoise2d seems to work in float mode, but it's black in color mode and while in vector3 mode produces colors they are completely different from Karma colors

small observations
- select your material in SG Tree and look at SG Details
- Auto Generate Preview Surface Shaders seems to work and indeed generates new shaders and connect to outputs:surface
but OGL doesn't use it, seems to prefer outputs:mtlx:surface
- using Edit Properties to Block outputs:mtlx:surface unfortunately removes it from Karma render also since they are both using it
- however OGL still seems to have cached shader somewhere so you have to cook different stage and then return to main one to see the Block change being reflected
- so as a workaround you could potentially have OGL branch where you block all output:mtlx:surface outputs, but due to sticky OGL cache it may be very error prone and obviously it'd be an ugly workaround anyway

anyway, I don't have a solution but would also like to know how to configure any delegate to use certain material outputs namespace
Edited by tamte - 2022年8月21日 14:14:20
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
7999 posts
Joined: 9月 2011
Offline
I don't think there's a way to do it without using different prims with different purpose. It's up to the renderer to pick which shader it's compatible with. The whole point of materialX support in GL is that it's supposed to be more representative of the final render. There are still some gaps in supported nodes and some nodes produce different results, but they have been fairly quick to fix the differences I've reported. There are some limitations due to OpenGL optimizations that make some features not possible to support such as using object space in shaders--geometries may or may not be combined into a single world space geometry to reduce draw call overhead.
User Avatar
Member
123 posts
Joined: 9月 2018
Offline
It's good to hear that SideFX keeps improving the mtlx viewport display. I still remember when I first started to move to Houdini from C4D and I always assumed my shaders weren't working because I couldn't see the noises in the viewport. C4D was always quite good at displaying even layered noises in the viewport.
Great that Houdini is going that way.

That being said, I would still say that there is merit in having some way of deciding which renderer chooses which material. Especially since Karma can already render Vex, MtlX, and USD Preview Shaders. Until then I probably need to send in some examples of the viewport display behaving weirdly.
User Avatar
スタッフ
4508 posts
Joined: 7月 2005
Offline
In 19.5.353 there is an environment variable, HOUDINI_GL_USE_MATERIALX (defaults to 1) which can be set to 0 to completely disable the use of MaterialX shaders by Houdini GL. Eventually we hope that hydra will support having a render delegate be asble to requests multiple types of shaders. This way, if a given Mtlx network contains an Mtlx node type unknown to HGL, we can fall back to the preview surface shader.

But also we strongly encourage everyone to submit bugs if Houdini GL has any trouble rendering any of your Mtlx materials. We would like to make these work whenever possible.
User Avatar
Member
7 posts
Joined: 4月 2014
Offline
mtucker
In 19.5.353 there is an environment variable, HOUDINI_GL_USE_MATERIALX (defaults to 1) which can be set to 0 to completely disable the use of MaterialX shaders by Houdini GL.

Thanks, helped a lot 😊
User Avatar
Member
130 posts
Joined: 10月 2020
Offline
just found this and immediately remembered you

Attachments:
Screenshot_16.png (25.2 KB)

https://www.youtube.com/channel/UC4NQi8wpYUbR9wLolfHrZVA [www.youtube.com]
  • Quick Links