shader

pixijs shader 案例

╄→гoц情女王★ 提交于 2019-12-05 01:52:50
pixijs shader 案例 const app = new PIXI.Application({ transparent: true }); document.body.appendChild(app.view); // Create background image const background = PIXI.Sprite.from('/moban/bg_grass.jpg'); background.width = app.screen.width; background.height = app.screen.height; app.stage.addChild(background); // Stop application wait for load to finish app.stop(); app.loader.add('shader', '/moban/shader.frag') .load(onLoaded); let filter; // Handle the load completed function onLoaded(loader, res) { // Create the new filter, arguments: (vertexShader, framentSource) filter = new PIXI.Filter(null,

pixijs shader 扫光加强版

为君一笑 提交于 2019-12-05 00:18:45
pixijs shader 扫光加强版 const app = new PIXI.Application({ transparent: true }); document.body.appendChild(app.view); // Create background image const background = PIXI.Sprite.from('/moban/bg_grass.jpg'); background.width = app.screen.width; background.height = app.screen.height; app.stage.addChild(background); // Stop application wait for load to finish app.stop(); app.loader.add('shader', '/moban/shader.frag') .load(onLoaded); let filter; // Handle the load completed function onLoaded(loader, res) { // Create the new filter, arguments: (vertexShader, framentSource) filter = new PIXI.Filter(null,

pixijs shader 制作百叶窗效果

我的未来我决定 提交于 2019-12-05 00:07:27
pixijs shader 制作百叶窗效果 直接贴代码了 const app = new PIXI.Application({ transparent: true }); document.body.appendChild(app.view); // Create background image const background = PIXI.Sprite.from('/moban/bg_grass.jpg'); background.width = app.screen.width; background.height = app.screen.height; app.stage.addChild(background); // Stop application wait for load to finish app.stop(); app.loader.add('shader', '/moban/shader.frag') .load(onLoaded); let filter; // Handle the load completed function onLoaded(loader, res) { // Create the new filter, arguments: (vertexShader, framentSource) filter = new PIXI

Three.js - shader code for halo effect, normals need transformation

安稳与你 提交于 2019-12-05 00:02:47
问题 I am attempting to create a shader to produce a glowing halo effect in Three.js. My current attempt is live here: http://stemkoski.github.io/Three.js/Shader-Halo.html The shader code is currently: <script id="vertexShader" type="x-shader/x-vertex"> varying vec3 vNormal; void main() { vNormal = normalize( normalMatrix * normal ); gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); } </script> <script id="fragmentShader" type="x-shader/x-vertex"> varying vec3 vNormal; void

pixijs shader教程

こ雲淡風輕ζ 提交于 2019-12-04 23:09:04
pixijs 写shader 底层都封装好了 只要改改片段着色器就行了 const app = new PIXI.Application(); document.body.appendChild(app.view); // Create background image const background = PIXI.Sprite.from('examples/assets/bg_grass.jpg'); background.width = app.screen.width; background.height = app.screen.height; app.stage.addChild(background); // Stop application wait for load to finish app.stop(); app.loader.add('shader', 'examples/assets/pixi-filters/shader.frag') .load(onLoaded); let filter; // Handle the load completed function onLoaded(loader, res) { // Create the new filter, arguments: (vertexShader, framentSource)

WebGL and HTML shader-type

一笑奈何 提交于 2019-12-04 23:06:11
I declare my GLSL ES shader program within a HTML file, using this code: <script id="shader-fs" type="x-shader/x-fragment">..shader-code..</script> as seen in the learning WebGL examples. Everything works fine, but I dont understand why I should use the type attribute of the script tag. I want to know where the "x-shader/x-fragment" value is specified. Who does that.. the W3C, the Khronos Group or the browser developers? Can anybody help me? Tahnk you. There is no official organization who specified that GLSL code should be put within a <script> tag of type "x-shader/x-fragment" . The only

openGL: lines with shaders

霸气de小男生 提交于 2019-12-04 22:49:39
How would I create a line (possibly colored) with shaders? I'm using programmable pipeline and I'm a beginner with openGL. I can't find an example on how to draw lines with shaders.. I suppose I have to load a VAO (vertices array object) into the shader, but then what? What functions should I use and how? First, set use the shaderprogram. Then draw lines using glDrawArrays (or Elements if your data is indexed) with mode=GL_LINES or one of the other line drawing modes. Here's a code example for 2D lines with different color in each end. If shading mode is set to smooth, OpenGL will interpolate

OpenGL bool uniform?

谁说胖子不能爱 提交于 2019-12-04 22:16:02
I'm trying to send a boolean to an OpenGL glsl shader. Currently I have this in the shader: uniform bool foo; And I use this to set it: glUniform1i(glGetUniformLocation(shader, "foo"), true); There doesn't seem to be a glUniform1b , so I'm setting it as an integer. This seems to work fine. Is there any problem with this approach? Is it portable, or could it break on other graphics cards / drivers? I'm using OpenGL 4.3 at the moment. § 4.1 Basic Types The OpenGL Shading Language supports the following basic data types, grouped as follows: bool a conditional type, taking on values of true or

GLSL Shader to convert six textures to Equirectangular projection

倖福魔咒の 提交于 2019-12-04 20:42:46
I want to create an equirectangular projection from six quadratic textures, similar to converting a cubic projection image to an equirectangular image, but with the separate faces as textures instead of one texture in cubic projection. I'd like to do this on the graphics card for performance reasons, and therefore want to use a GLSL Shader. I've found a Shader that converts a cubic texture to an equirectangular one: link Step 1: Copy your six textures into a cube map texture. You can do this by binding the textures to FBOs and using glBlitFramebuffer() . Step 2: Run the following fragment

Can't link shaders to program object in OpenGL, can't debug

对着背影说爱祢 提交于 2019-12-04 20:27:45
I attach a vertex and fragment shader to a program object, then attempt to link the said program. GL_LINK_STATUS returns false. I check the info log, it's a bunch of gibberish characters. I check GL_INFO_LOG_LENGTH, it's 0. How do I debug this situation? //this is the end of my LoadBasicShaders function glAttachShader(program, vertShader); glAttachShader(program, fragShader); glLinkProgram(program); GLint status; glGetProgramiv(program, GL_LINK_STATUS, &status); if (status == GL_FALSE) { GLint logLength = 0; glGetProgramiv(program, GL_INFO_LOG_LENGTH, &logLength); std::vector<GLchar> log