Jump to content

Search the Community

Showing results for tags 'glsl'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Lounge/General chat
    • Education
    • Jobs
  • Houdini
    • General Houdini Questions
    • Effects
    • Modeling
    • Animation & Rigging
    • Lighting & Rendering
    • Compositing
    • Games
  • Coders Corner
    • HDK : Houdini Development Kit
    • Scripting
    • Shaders
  • Art and Challenges
    • Finished Work
    • Work in Progress
    • VFX Challenge
    • Effects Challenge Archive
  • Systems and Other Applications
    • Other 3d Packages
    • Operating Systems
    • Hardware
    • Pipeline
  • od|force
    • Feedback, Suggestions, Bugs

Found 3 results

  1. GLSL shader questions

    Hello, I would like to experiment with GLSL shaders in Houdini viewport a bit, but I had very little success yet As a simple thing I would like to create a "matcap" shader, I have this shader in mantra and it works well, but it is quite simple logic in it and I would like to try it out in GLSL as well. I tried two approaches for creating glsl shaders: New Operator Type - SHOP Type - GLSL Shader This approach does not give me any results, the default shader has quite complex code and in the viewport I can see only white color. I tried to modify couple of variables in the code to at least change color from white to red, but unsuccessfully Reference ogl_glsl_shader parameter on a shader pointing to shader.prog file which references to shader.frag and shader.vert This gives me results in the viewport and works quite well, however I do not know how to reference node's parameter value to the GLSL variables. I created those files based on examples in $HFS/houdini/glsl //fragment shader in vec2 matUv; out vec4 color; uniform sampler2D tex; void main() { vec3 base = texture2D( tex, matUv ).rgb; color = vec4( base, 1. ); } First question: how can I reference parameter on the node to the tex variable in opengl? When googling I found some examples which implied that only creating string parameter tex should work, but when running their example files I never got any result in the viewport. Second question: is this the correct workflow? How could I achieve the same thing with New Operator Type workflow? Do you have some simple examples of those nodes with basic shading? E.g. sampling a texture, using constant color... Thanks for any clarification, Juraj
  2. I'm attempting to write a custom GLSL shader for the viewport to aid in the development of a game that will have a toon shaded style (following some ideas from this Guilty Gear Xrd talk from GDC). I want to end up with the same shader applied in the viewport as the shader that will be used in the game to make the modeling and texturing pipeline easier. I'm new to GLSL and learning by experimenting as I go. I've been able to hardcode a simple directional light in the fragment shader that is relative to the viewport by using a vec3: if (dot(nN, lightDirection) < 0) { lspec = vec3(1.0); } else { lspec = vec3(0.0); } (I'm using lspec to test the formula at this point, because it's on the top layer.) The next step is to pull the lightDirection from a Houdini light instead of hard coding it. This is where I'm running into some problems. There are two sources of documentation I've found: http://www.sidefx.com/docs/houdini15.0/shade/opengl http://www.sidefx.com/docs/hdk15.0/_h_d_k__viewport_g_l3.html The first says to use light uniform blocks like this: layout(std140) uniform light0 { vec3 pos; vec3 dir; vec3 atten; vec3 amb; vec3 spec; vec3 diff; float coscutoff; bool point; } lightSource0; When I use this, and try to get lightSource0.pos, the model goes black and has no lighting applied. I'd like to query this variable to debug it, but I'm not sure how to do that within GLSL itself. The second source of documentation uses a slightly different variable: layout(std140) uniform glH_Light0 { vec3 pos; // light position, world space vec3 dir; // light direction, world space vec3 atten; // attenuation - .x: d^2, .y: d, .z: const vec3 amb; // ambient color component vec3 spec; // specular component vec3 diff; // diffuse component float coscutoff; // cosine(cutoff) to compare to dot(dir,P-pos) bool point; // point light (true), spot light (false) } lightSource0; When I use this code, the shader fails to compile and says "ERROR: Multiple definitions of interface block 'glH_Light0' differ in name/type/order/qualification of members". Because of this error, I think that the glH_Light0 name is the correct one to use, but I'm not implementing this correctly. I've looked for more documentation on this, but have come up dry. Does anyone know how to properly reference lights in GLSL? I appreciate any help or insights.
  3. vertex UV in GLSL

    This seems like a very basic question and is related to GLSL, so I don't know if this is the right corner of the forum. I have a simple working GLSL shader that pulls in the uv attribute. This is the Vertex Shader: #version 150 in vec3 P; in vec3 N; in vec2 uv; out vec3 vPos; out vec3 vN; out vec2 uvCoords; uniform mat4 glH_ObjectMatrix; uniform mat4 glH_ViewMatrix; uniform mat4 glH_ProjectMatrix; uniform mat3 glH_NormalMatrix; void main() { vPos = vec3(glH_ViewMatrix * glH_ObjectMatrix * vec4(P, 1.0)); vN = normalize (glH_NormalMatrix * N); uvCoords = uv; gl_Position = glH_ProjectMatrix * vec4(vPos, 1.0); } Fragment shader: #version 150 uniform sampler2D t_diffmap; in vec3 vN; in vec2 uvCoords; out vec4 color; void main() { vec3 diff; diff = texture(t_diffmap, uvCoords).rgb; color = vec4(diff,1.0); } Now, this works with point UVs. If my UVs are of vertex type, this does not work any more (the shader shows a single color only). Since 99% of my meshes will be vertex UV, I am seriously wondering how I get access to them in the GLSL shader... Any help is appreciated! Thanks in advance Johann