PDG color wedge to GLTF

   2818   7   1
User Avatar
Member
16 posts
Joined: 2月 2015
Offline
Hi everyone,

long time reader, but now seem to be a little stuck. i am trying to wedge the basecolor of the principle shader with a color wedge. the goal is to export quite a lot of variations of an asset to a gltf. the list of colors in the wedge make it very overseeable and nicer to art direct.

i can also do this with a switch and multiple constants plugged in the basecolor, but
these values dont get exported in the gltf file. so i believe they seem to only be read from the promoted parameter properties of the shader.

also, the ramp plugged in to the shader of the background also doesnt export. is this just a limitation of gltf?

thanks in advance!

Attachments:
color_wedge.PNG (807.2 KB)

User Avatar
スタッフ
600 posts
Joined: 5月 2014
Offline
Can you attach the .hip file with your TOPs and GLTF setup -- or one that reproduces the issue you're running into?
User Avatar
Member
16 posts
Joined: 2月 2015
Offline
thanks for your fast response!
i tried to simplify the setup.

all the colors on shader 01 and sphere 01 are not being exported to the gltf, plus its difficult to have a nice overview which colors are wedged.

the values in sphere 02 and shader 02 are being exported, but only the first value of the color, as i cannot assign the wedge color to the color paramater of the shader, only to each individual color channels. maybe i am overlooking something completely when assigning those...

i would prefer the way sphere02 is setup, as the export works, plus it gives me a nice overview of which colors are used in which wedge without making another reference to some other color palette.

or maybe there is an even better way...

edit - i added the ramp too in the exmple file
Edited by doodlemaker - 2022年3月8日 10:51:50

Attachments:
color_wedge_test.hiplc (707.5 KB)

User Avatar
Member
16 posts
Joined: 2月 2015
Offline
i tried to switch shaders with a string wedge, but houdini doesnt seem to pick this up. not in the shopmaterial path nor in the SOP Render Tab material assignment.

is this expected behaviour?

Attachments:
string_wedge.PNG (389.5 KB)

User Avatar
スタッフ
600 posts
Joined: 5月 2014
Offline
Your Sphere_02 material isn't working because your color components values are all set to @color. You need to use @color.r, @color.g and @color.b instead to access each of the components of the attribute value. The expression @color is the same as @color.0 or @color.r -- it will only accesses the first component of the attribute:



With that change, the Sphere_02 material exports properly and shows up in the viewport.

Attachments:
Screenshot from 2022-03-08 10-46-29.png (21.6 KB)

User Avatar
スタッフ
600 posts
Joined: 5月 2014
Offline
In a string parameter, you need to use backticks so that Houdini can tell you're entering a string expression, not a constant string. -- `@body_shader` in your case. This is the same for any HScript expression in a string parameter: https://www.sidefx.com/docs/houdini/network/expressions.html#string-parameters [www.sidefx.com]
User Avatar
Member
16 posts
Joined: 2月 2015
Offline
Oh that’s great to hear! I was sure I was doing something wrong

Thanks for helping out!
Edited by doodlemaker - 2022年3月8日 16:57:57
User Avatar
Member
13 posts
Joined: 3月 2022
Offline
tpetrick
Your Sphere_02 material isn't working because your color components values are all set to @color. You need to use @color.r, @color.g and @color.b instead to access each of the components of the attribute value. The expression @color is the same as @color.0 or @color.r -- it will only accesses the first component of the attribute:

Image Not Found


With that change, the Sphere_02 material exports properly and shows up in the viewport.

tpetrick
In a string parameter, you need to use backticks so that Houdini can tell you're entering a string expression, not a constant string. -- `@body_shader` in your case. This is the same for any HScript expression in a string parameter: https://www.sidefx.com/docs/houdini/network/expressions.html#string-parameters [www.sidefx.com]

Thank you!
  • Quick Links