Jump to content

Current Position to Shader Position ?


Recommended Posts

default space in surface shader context like is camera space

so space:current means camera space

also all Global Variables are in camera space, so P is already in camera space

if you want your P in world space, just connect it to Transform VOP and set From Space to space:current and To Space to space:world, etc.

Link to comment
Share on other sites

@animThat is what I'm trying to figure out; my guess is yes, shader space is UV tangent space. I'm attempting to convert this code into SHOP. 
 

color baseColor= color (0.56,0.6,0.41); 

float baseColorFreq = 2; 

float label = 0.5;
}
/* Transform P from "current" to "shader" */ 

point Pshad = transform("shader", P) * baseColorFreq + label;

2018-09-30_23-39-41.thumb.png.37760172d6dc86d578f93b5d43ab23c6.png

Although the grid which this shader is applied on, still remains white; rather then the BaseColor parameter which is 0.6,0.65,0.12 ? 

Shader Space is BxDF, I assume the Transform VOP must be set `out` to `space:light` unless I can convert to BxDF ?

Edited by CinnamonMetal
Link to comment
Share on other sites

I don't think it's very important, but it's definitely not UV tangent space, seems like it's a traditional coordinate system defined by the shader, I don't think Mantra has that, but you can use any object as such coordinate system if you need to share it among all objects using that shader, or if it works for you use 'object' or 'world' or define 'rest' attrib and use that directly as Pshad 

what's important though is to connect your VOPs correctly, Pshad is not a parameter, it's simply the output value of add1, the input to transform1 is supposed to be P from Global Variables, and you have to multiply with baseColorFreq not baseColor as you are computing Pshad, which is a coordinate that you will use later to sample some 3d procedural pattern which you will multiply with actual baseColor if you want. In other words baseColorFreq is the float multiplier or scale of your space and can be thought as a frequency of the pattern, baseColor is actual color

Edited by anim
Link to comment
Share on other sites

Are you saying to create a parameter with the name as @P and plug it into the `from` of the transform VOP, or simply set the `fromSpace` within the transform VOP to @P ?

After I add the Label and the multiple, I then would multiply pShad with the baseColor and plug that into the color of pbrDiffuse ?

 

specnotvisible.png

Edited by CinnamonMetal
Link to comment
Share on other sites

From my understanding the Rest VOP prevents swimming, correct ?

Whether @animor someone else; this is the first step I'm trying to achieve. 

I want to multiply the shading point by the parameter baseColorFreq. Then I want to add the parameter label to this transformation so that you can use the same shader to create unique patterns; although I'm not getting a color on my grid, therefore I'm completely stuck ?

 

ColorGrid.png

 

BTW @anim reputation is approved by the devil. 

 

f4680153-5a7e-4fc1-9767-37bd86c7a61b.png

:o

Edited by CinnamonMetal
Link to comment
Share on other sites

which patterns are you trying to create?

rest or P or uv can act as coordinate input for the pattern, whether you take the coordinate value as it is or transform to different space depends on what you need

rest is usually static position value in local object space, it will prevent swimming as long as the values don't change during the animation, transforming it to different space however may itself introduce swimming if that space is changing in relation to space you are transforming from, so I wouldn't recommend combining rest with transform, just use rest, or for already static geo just transform P to object space

to actually get your pattern to show plug your coordinate (P, rest, uv) to some pattern generator like noise or other and then multiply with color and connect to diffuse

Link to comment
Share on other sites

from what I see you are adding 2 after you multiply with the color

and 2 is way over one and since one is white x + 2 is most likely white if x was somewhere around -1..1 so I wouldn't be surprised if you are seeing white

also rest can have any values so it's also possible to have way negative values, that after multiplying with positive color is still negative and +2 can still be <0 and you may be seeing black

so there is no telling from the screenshot if the values are expected or not, just fit to the whole range in MPlay or RenderView to see if you are getting any values or not, and it's better to preview just output of certain nodes to directly inspect their values

Edited by anim
Link to comment
Share on other sites

@animHow do I fit to the whole range in MPlay or Renderview ?

The original code;

point Pshad = transform("shader", P) * baseColorFreq + label;

Therefore if point is the point position named Pshad and transform is the rest position within Houdini vops, and I have to multiple the baseColorFreq by the rest position followed by adding that to the label, I should be getting not white but a color ? :unsure: 

If I disabled the multiple or add vops, I'm still only getting white ?

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