Problem with old GLSL Shader. [Solved]

   2330   1   1
User Avatar
Member
41 posts
Joined: Feb. 2014
Offline
Hi to all!

I recently found this amazing resource to preview matcaps materials in the viewport. But unfortunately I cant make it work.

https://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=22724 [sidefx.com]

This first problem is that the pow function is not recognized by Houdini, so what I did was to modify the code and delete everything related to the pow function. (some beautification too :wink: ):


// vertex shader
varying vec3 vPos, vN;

void main() {
vPos = vec3(gl_ModelViewMatrix * gl_Vertex);
vN = normalize (gl_NormalMatrix * gl_Normal);
gl_TexCoord = gl_MultiTexCoord0;
gl_Position = gl_ProjectionMatrix * vec4(vPos, 1.0);
}



// fragment shader
uniform sampler2D g_smpTex;
uniform int glH_MaterialPass;

varying vec3 vPos;
varying vec3 vN;

void HOUassignOutputs(vec3 emit, vec3 amb, vec3 diff, vec3 spec, float shiny, vec3 P, vec3 N, float alpha);

void main() {
vec3 c;
vec2 uv = normalize(vN) * 0.5 + 0.5;
vec3 n = normalize(vN);

if (glH_MaterialPass == 0) {
c = texture2D(g_smpTex, uv).rgb; // lookup color from normal
HOUassignOutputs(
/* emit */ c,
/* amb */ vec3(0.0),
/* diff */ vec3(0.0),
/* spec */ vec3(0.0),
/* shin */ 0.0,
/* P */ vPos,
/* N */ vN,
/* alpha */ 1.0
);
} else {
HOUassignOutputs(
/* emit */ vec3(0.0),
/* amb */ vec3(0.0),
/* diff */ vec3(0.0),
/* spec */ vec3(0.0),
/* shin */ 0.0,
/* P */ vPos,
/* N */ vec3(0.0),
/* alpha */ 1.0
);
}
}


I created another parameter for glH_MaterialPass and embedded the otl to the hipnc, just in case

But this doesn't even work for me it's just transparent. I tried to implement it again from scratch in Houdini 13 but not luck (now its Black ). I think that maybe the code its just compatible with the version they were using at that time.

So, how can I use this shader in Houdini 13? I'm using AMD by the way.

Also, the Houdini Console is reporting:

Unknown operator type: Shop/GLSL_matcap



Thanks for reading!!

Here is the new file:
Edited by - Oct. 18, 2014 21:03:48

Attachments:
glsl_matcap_170_new.hipnc (179.5 KB)

User Avatar
Member
41 posts
Joined: Feb. 2014
Offline
Solution at http://forums.odforce.net/topic/21066-problem-with-old-glsl-shader/#entry125877 [forums.odforce.net]
  • Quick Links