Jump to content

Having problems with VEX code.


simonj

Recommended Posts

So I'm trying to get into VEX coded shaders, since I like code more than VOPs, anyway. I'm trying to do this really simple constant shader. But it wont work. Step by step:

1:

File > New operator type > VEX Type - Surface Shader Operator.

2:

New window pops up, navigating to the "Code" tab and typing this:

surface
simpleconstant()
{
vector col={1,0,0};
Cf=col;
}

3:

Going to the Shop network view, adding my newly created Surface shade.

4:

Selecting the node, pressing shift-c to make a material out of it, and adding it to an object in my scene.

5:

Render with Mantra 10, Micropolygon Rendering

Expected result is a box which is red.

The result I get is a grey, standard shaded box. (And it's not red in the viewport either, but that has something to do with OGL parameters, right?)

What am I doing wrong?

Oh, and I'm using Houdini 10.0 Build 401.

Thanks for any answers

Edited by simonj
Link to comment
Share on other sites

There have to be some small mistake. All steps seems to be fine. Maybe attach your scene for debugging.

I swear, before I made this post I tried doing the same procedure 5-6 times, double checking each step.

Now when you answered I went back to recreate the scene for debugging, and guess what? It worked.

I don't know what I did different, I was following the steps I wrote here which I wrote when trying to figure out what I did wrong :D

Anyway, thanks for your time. I'm hoping this doesn't happen again :)

Link to comment
Share on other sites

Alright, so it seems I'm not in the clear yet.

This is veeery wierd.

If I do this:

1: Open Houdini into a fresh document

2: Add a box

3: Create a new VEX Surface Shader Operator and assigning it to the box by the steps 1-4 in my original post

4: Add a renderer and a camera

5: Render

I get a red box, as expected.

However, if I make a new VEX Surface Shader Operator, still by the steps 1-4, it will not work. It is as if it never gets compiled, but it's saved to the otl and I can use it without warnings, it just doesn't work.

I've attached a file consisting of one hip file and one otl file, the otl contains two materials, one constant red (which works perfectly fine for me), and one blue, which doesn't work at all.

Can anyone test this and see if the same problems occur?

Thanks!

sj_materials.zip

Link to comment
Share on other sites

Well, it works again, at least here. I inspected your otl file, and it seems to be fine as well. What OS you're using? Maybe some tmp/permissions/whatever issue?

Are you saying, you're making two shops in the same way, and the second time always fails?

You know,you can write shaders externally in your favorite text editor and compile it to otl with vcc?

Edited by SYmek
Link to comment
Share on other sites

Well, if I relaunch Houdini and load in the file I posted here it works for me to.

I'm on Mac OS X 10.5.7

But, if I try to change the materials to say green {0,1,0}, press apply and accept, it doesn't change color to green. So I suspect that there's something wrong with compiling. It is as if I can compile once, and never again in the same session..

I'll look into compiling with the vcc from text files, just have look up some tutorials/instructions on how to do that.

Thanks for your help again! :)

Edited by simonj
Link to comment
Share on other sites

for shader writing I HIGHLY recommend cutter www.fundza.com written by Malcolm Kessen Its an incredible tool written in java so you can run it on your favorite OS. it includes nice features like saving templates, and setting up the environmet in cutter so that with a simple key combo you can compile, otl, and drop in path. just to start...

It also is very tied in with renderman if you also create RSL shaders. includes functioality for many 3D script languages and renderers and to many featues to list here, the site also include a wealth of tutorials. i use it on a daily basis and have for several years now.

BTW theres no cost to download.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...