Jump to content

Creating a shader with a COPs network in it


jim c

Recommended Posts

The idea is to take the default Mantra surface shader and enhance a number of the inputs, like diff intensity, spec1 and spec 2 intensity, and have them be driven by a texture map. Then, just for kicks, create a COPs network that can generate some things like noise, etc and possible affect the texture map with this. Maybe do some stuff to the diff texture map and allow for things color tuning, etc. Then read in the COPs node, instead of the original texture map. So the question is: how do I set this up to allow it to be built as a digital asset? In the vex vop, you can't have nested SHOP/SOP/COP etc networks. So is there another way to do this?

Link to comment
Share on other sites

I am building a general purpose shader modelled off of the V-Ray Material in Max, and the conclusion I've come to is to have a tab that has some basic procedural stuff like ramps/noise as I've seen done in other shaders, and then bounce into COPs if more fine tuning was needed. I imagine any procedural you want to add to the shader has to be thrown in there vs. having a map browser like Max. What WOULD be nice is if we started creating snippets of code that we could hook up to our shaders to propagate the UI on an as needed basis. IE I need another noise, hit the plus and all the menus for diffuse/refl etc. now have that map as an option to modify. I'm thinking this could be done with callbacks but I'm not that far yet.

Link to comment
Share on other sites

OK I think I have a possible solution.

1) create a subnet in the Shop context

2) add an Output Shaders Node

3) add a Surface Shader Builder node and wire into the output

4) add Displacement Shader Builder node and wire into output

5) copy/paste the relevant surface nodes from the Default Mantra Surface shader into the surface shader from (3)

6) ditto for the displacement stuff

7) add a COPs context into the subnet and add what you need there

8) reference it

9) make the subnet a Digital Asset

10) Profit!

Link to comment
Share on other sites

Sigh... this sort of works. But sometimes it gives me an error

mantra: Unable to load texture 'op:/shop/MyMat/cops/NOISE_OUT

when I reference the COP like so:

op:`opfullpath('../../cops/NOISE_OUT')`

Edited by jim c
Link to comment
Share on other sites

What WOULD be nice is if we started creating snippets of code that we could hook up to our shaders to propagate the UI on an as needed basis. IE I need another noise, hit the plus and all the menus for diffuse/refl etc. now have that map as an option to modify. I'm thinking this could be done with callbacks but I'm not that far yet.

Yeah that would be cool. Please post how you get along with that.

Link to comment
Share on other sites

Hey Jim,

So I tried what you suggested and it works quite nicely. Created a new Surface SHOP type, dropped a COP net right next to it and created a noise inside. Threw them both in a subnet and promoted the noise parameters and voila full control over the procedural being generated in COPs at the DA level. Sweet idea dude!

noiseMat.hip

noiseMat.otl

Link to comment
Share on other sites

So Jim,

I think when we see multiparm creation in vex things will get a lot easier, at least for me. Does anyone know the status of the RFE? All the threads I came across referenced it but none seem to have had an answer...

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