Jump to content

Previewing A Shader While Writing


Recommended Posts

I'm learning to code vex shaders. How to preview the code most efficiently, I'd like it to update as soon as it's compiled.

I'm proceeding as follows:

-write vfl file

-compile with vcc to /houdini/vex/surface

-preview with generic surface shop

now when I recompile a shader it doesn't update in shop preview window, which forces me to use mantra as previewer which is not so convenient.

As I'm a total noob in this field, could you describe the most common way of working on (non vop) shaders?

Link to comment
Share on other sites

I used Cutter for a while but now i am writting directly into the type properties.

Step 1 : File menu / New operator type for example surface shader operator

I usually install the library to /home/houdini8.x/ and create a new otl for every shader

Step 2 : In the opening operator type properties window click accept

Step 3 : Go to shops and add your shader to the scene

rightclick on the shader and select type properties

go to the vexcode tab

Step 4 : edit your shader

with testcompile you can check if the shader compiles without errors

with apply you apply your changes and your shaderball/ objects instantly use the changed shader.

with accept you accept your changes and close the window

With alt+e you can open an external editor to edit your code if you dont like the inbuilt one

I hope this helps a bit

Sven

Link to comment
Share on other sites

Thank you very much!

In the meantime I got another solution:

Ptakun encouraged me to use inline vop which also works great.

With this new operator I'm confused how to expose parameters in UI?

Get properties from vex code is checked, when i write : #pragma export freq(2)

It founds an error, i tried vcc -u option but what to do with additional .ds file?

It's not well documented, could you give me some more hints?

Link to comment
Share on other sites

I am not 100 % shure if youre talking about inline vop or a complete shader now :blink:

for inline vop just add a parameter vop wire it with the inline vop and prefix the parameter name with $ for example $parm1.

for a regular shader pragmas give the compiler only additional information and are optional but you have to declare your parameter elsewhere.

example :

#pragma label testparm "My parm" // display the label My parm for the parameter testparm
#pragma hint  mycol color // tell the compiler that mycol is a color and not a simple vector
#pragma group mygroup testparm mycol // tell the compiler to group testparm and mycol into one tab

surface mysurface(float testparm=2;
							vector mycol={1,1,1}; 
							)  // declare a parameter testparm of type float with a default of 2
{
	  // Whatever your shader does
}

Link to comment
Share on other sites

Thank you for a hint Thomas, I'm coming to conquer hscript:)

Sven, sorry for not being clear enough. I was talking about complete shader.

I got it working now. The problem was that parameters didn't appear in UI, because I did not declare them in the shader name line, I was writing:

surface mysurface()

instead of

surface mysurface(vector diff=1; vector amb=1; etc)

Now everything is ok.

I don't understand dialog script .ds files yet, are they responsible for UI? Do I need to care about them while writing a shader as new surface operator?

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...