Posts

Showing posts with the label opengl

How to apply a glsl pixel shader to a texture?

How to apply a glsl pixel shader to a texture? I have a texture and i would like to apply to it a glsl shader. Is it possible and how to do it ? For example i want to apply this glsl shader to my texture : varying vec4 coord; uniform sampler2D texture; uniform float opacity; void main() { vec4 col = texture2D(texture, coord.xy); col.a *= opacity; gl_FragColor = col; } I also think this question is too board (and close-voted accordingly.) The short answer is: render a full-screen quad (or even better: a full-screen triangle) while applying this as the fragment shader. The vertex shader can be quite trivial. – derhass Jun 30 at 17:24 1 Answer 1 I would say create another texture empty and of similar properties of original texture. Attach this textu...

What is coresponding relation about colors and texture coordinates in 3D software?

Image
What is coresponding relation about colors and texture coordinates in 3D software? In many 3D softwares there is a panel to display texture coordinates in geometry, like this How to map the different color on geometry to texture coordinates? Where can I find information about it? 2 Answers 2 Texture coordiates go from (0,0) to (1, 1). They're 2D vectors and colors are often represented by a 3D vector (red, green, blue). What you get is your UV coordinate as a color (r : UV.x, g: UV.y , 0). Thank you for saving my time! – ooOlly Jun 30 at 9:11 In maya there is such one click solution as much as I know. But you can use the samplerInfo node and connect its uv-output to any color node, e.g. a blendColors node. Set the blender to 1 and connect the uvs to...