Hello all!
I've noticed that in Houdini 13, within the directlighting VOP node, the outer code reads:
import directlighting;
Rather than the old way of specifying the whole function.
This is good.
But how do I import functions? Whenever I place “import directlighting;” in the outer code of any of my nodes, I get the following error:
Failed to import function ‘directlighting’. (30,1:21)
In addition, I get an identical error when trying to import it within a header. Importing it in a header is what I actually want to do: my main aim is to call directlighting() from within a header.
What do I need to do to get imports working?
Thanks!
The New "import" keyword in H13
6105 11 1-
- abvariant
- Member
- 13 posts
- Joined: Jan. 2014
- Offline
-
- wolfwood
- Member
- 4271 posts
- Joined: July 2005
- Offline
-
- abvariant
- Member
- 13 posts
- Joined: Jan. 2014
- Offline
Hi there Wolfwood,
Well I have a VOP node that I've made, that I use within a material builder in the SHOP. I've created it as a vex builder operator. Purely as a test, I'm trying to import it within that. I suppose that would work? Directlighting is a surface shader itself isn't it.
Are you also implying that as a header itself doesn't have any context per se, I won't be able to import anything into it? I am ultimately using the header in a shading context…
Well I have a VOP node that I've made, that I use within a material builder in the SHOP. I've created it as a vex builder operator. Purely as a test, I'm trying to import it within that. I suppose that would work? Directlighting is a surface shader itself isn't it.
Are you also implying that as a header itself doesn't have any context per se, I won't be able to import anything into it? I am ultimately using the header in a shading context…
-
- wolfwood
- Member
- 4271 posts
- Joined: July 2005
- Offline
Hmm. Seems like it should work. Can you post a simple hip file?
The issue I was referring to is if you had wired it into a displacement shader, you'd get an error like this-
Warning: Errors or warnings encountered during VEX compile:
/shop/vopmaterial1: Failed to import function ‘directlighting’ for context ‘displace’. Only available in the ‘surface’ context. (21,1:21).
The issue I was referring to is if you had wired it into a displacement shader, you'd get an error like this-
Warning: Errors or warnings encountered during VEX compile:
/shop/vopmaterial1: Failed to import function ‘directlighting’ for context ‘displace’. Only available in the ‘surface’ context. (21,1:21).
if(coffees<2,round(float),float)
-
- abvariant
- Member
- 13 posts
- Joined: Jan. 2014
- Offline
-
- abvariant
- Member
- 13 posts
- Joined: Jan. 2014
- Offline
So when building a test scene from scratch, the error about the “import” keyword never appears but it seems to think the directlighting() call is undefined, despite the fact that I have imported it:
op
shop/vopmaterial1:32:5-18: Error 1066: Call to undefined function directlighting(string; bsdf; string; void; string; void; string; void; string; int; string; float; string; string; string; int; string; int; string; int; string; string; string; int; string; vector; string; vector; string; vector; string; float; string; int; string; vector). Candidates are: void directlighting(; … )
op
shop/vopmaterial1:34:13-18: Error 1031: Invalid implicit cast from vector to void.
op
shop/vopmaterial1:35:12-17: Error 1031: Invalid implicit cast from vector to void.
op
shop/vopmaterial1:36:12-17: Error 1031: Invalid implicit cast from vector to void.
op
shop/vopmaterial1:51:21-26: Warning 2018: Using uninitialized variable: direct
mantra: Could not find VEX shader ‘op
shop/vopmaterial1’ (either .vfl or .vex)
Despite this, I've attached the file I used. The otl i created should be embedded. I've duplicated the directlighting node.
This time round it's like the “import” line is just being ignored…
op
![](/static/djangobb_forum/img/smilies/hmm.png)
op
![](/static/djangobb_forum/img/smilies/hmm.png)
op
![](/static/djangobb_forum/img/smilies/hmm.png)
op
![](/static/djangobb_forum/img/smilies/hmm.png)
op
![](/static/djangobb_forum/img/smilies/hmm.png)
mantra: Could not find VEX shader ‘op
![](/static/djangobb_forum/img/smilies/hmm.png)
Despite this, I've attached the file I used. The otl i created should be embedded. I've duplicated the directlighting node.
This time round it's like the “import” line is just being ignored…
-
- wolfwood
- Member
- 4271 posts
- Joined: July 2005
- Offline
Well well.
The code generated by the built-in VOP results in-
// Code produced by: directlighting1
directlighting(
“inF”, f,
“inOf”, { 1, 1, 1 },
“inP”, vector(),
“inI”, vector(),
vs the same asset that has been copied to a different type name.
// Code produced by: importTest1
directlighting(
“inF”, f,
“inOf”, vector(),
“inP”, vector(),
“inI”, vector(),
Notice the inOf.
What I don't get is if the asset was copied directly why it would behave differently.
The code generated by the built-in VOP results in-
// Code produced by: directlighting1
directlighting(
“inF”, f,
“inOf”, { 1, 1, 1 },
“inP”, vector(),
“inI”, vector(),
vs the same asset that has been copied to a different type name.
// Code produced by: importTest1
directlighting(
“inF”, f,
“inOf”, vector(),
“inP”, vector(),
“inI”, vector(),
Notice the inOf.
What I don't get is if the asset was copied directly why it would behave differently.
if(coffees<2,round(float),float)
-
- abvariant
- Member
- 13 posts
- Joined: Jan. 2014
- Offline
Ah interesting.
So the importTest node was actually create from scratch manually. I duplicated the code, params and node details from the directlighting node. So the importTest isn't a direct copt of directlighting.
Seems I missed off that default value for inOf.
ops:
Still, it doesn't seem to be complaining about it. Just that the function doesn't exist.
So the importTest node was actually create from scratch manually. I duplicated the code, params and node details from the directlighting node. So the importTest isn't a direct copt of directlighting.
Seems I missed off that default value for inOf.
![](/static/djangobb_forum/img/smilies/yikes.png)
Still, it doesn't seem to be complaining about it. Just that the function doesn't exist.
-
- wolfwood
- Member
- 4271 posts
- Joined: July 2005
- Offline
-
- abvariant
- Member
- 13 posts
- Joined: Jan. 2014
- Offline
-
- wolfwood
- Member
- 4271 posts
- Joined: July 2005
- Offline
abvariant
Thanks, I'll try a more recent version and see where that gets me.
Just to verify, did this actually work for you or not?
Taking you scene, once I fixed the importTest VOP, so that it had a hidden Of parameter defaulted to 1, like the directlighting VOP, it then worked. No compiler errors and rendered a white sphere.
if(coffees<2,round(float),float)
-
- abvariant
- Member
- 13 posts
- Joined: Jan. 2014
- Offline
-
- Quick Links