shader

Bump Mapping with javascript and glsl

拜拜、爱过 提交于 2020-08-20 06:32:28
问题 /** * A class creating buffers for a textured box to render it with WebGL */ class RasterTextureBox { /** * Creates all WebGL buffers for the textured box * 6 ------- 7 * / | / | * 3 ------- 2 | * | | | | * | 5 -----|- 4 * | / | / * 0 ------- 1 * looking in negative z axis direction * @param {WebGLContext} gl - The canvas' context * @param {Vector} minPoint - The minimal x,y,z of the box * @param {Vector} maxPoint - The maximal x,y,z of the box */ constructor(gl, minPoint, maxPoint, texture)

How to write a sceneKit shader modifier for a dissolve in effect

血红的双手。 提交于 2020-07-28 06:17:28
问题 I'd like to build a dissolve in effect for a Scenekit game. I've been looking into shader modifiers since they seem to be the most light weight and haven't had any luck in replicating this effect: Is it possible to use shader modifiers to create this effect? How would you go about implementing one? 回答1: You can get pretty close to the intended effect with a fragment shader modifier. The basic approach is as follows: Sample from a noise texture If the noise sample is below a certain threshold

How to write a sceneKit shader modifier for a dissolve in effect

ε祈祈猫儿з 提交于 2020-07-28 06:17:07
问题 I'd like to build a dissolve in effect for a Scenekit game. I've been looking into shader modifiers since they seem to be the most light weight and haven't had any luck in replicating this effect: Is it possible to use shader modifiers to create this effect? How would you go about implementing one? 回答1: You can get pretty close to the intended effect with a fragment shader modifier. The basic approach is as follows: Sample from a noise texture If the noise sample is below a certain threshold

Why my OpenGL custom shader gives me this error?

醉酒当歌 提交于 2020-07-21 09:08:27
问题 I'm using a custom shader with cocos2d 3.17 for my macOS app on XCode11 but I have some troubles. myShader.frag #ifdef GL_ES precision lowp float; #endif uniform sampler2D u_texture; varying lowp vec4 v_fragmentColor; uniform mat4 u_rotation; void main() { mat4 t1= mat4(1); mat4 t2= mat4(1); t1[3] = vec4(-0.5,-0.5,1,1); t2[3] = vec4(+0.5,+0.5,1,1); vec2 pos = (t2 * u_rotation * t1 * vec4(gl_PointCoord, 0, 1)).xy; gl_FragColor = v_fragmentColor * texture2D(u_texture, pos); } myShader.vert