shader

Help with Pixel Shader effect for brightness and contrast

不羁岁月 提交于 2019-11-29 08:31:50
问题 What is a simple pixel shader script effect to apply brightness and contrast? I found this one, but it doesn't seem to be correct: sampler2D input : register(s0); float brightness : register(c0); float contrast : register(c1); float4 main(float2 uv : TEXCOORD) : COLOR { float4 color = tex2D(input, uv); float4 result = color; result = color + brightness; result = result * (1.0+contrast)/1.0; return result; } thanks! 回答1: Is this what you are looking for? float Brightness : register(C0); float

OpenGL ES 2.0 Rendering with a Texture

二次信任 提交于 2019-11-29 06:48:22
问题 The iPhone SDK has an example of using ES 2.0 with a set of (Vertex & Fragment) GLSL shaders to render a varying colored box. Is there an example out there on how to render a simple texture using this API? I basically want to take a quad, and draw a texture onto it. The old ES 1.1 API's don't work at all anymore, so I'm needing a bit of help getting started. Most shader references talk mainly about advanced shading topics, but I'm really unsure about how to tell the shader to use the bound

What is the relationship between gl_Color and gl_FrontColor in both vertex and fragment shaders

跟風遠走 提交于 2019-11-29 06:04:48
问题 I have pass-through vertex and fragment shaders. vertex shader void main(void) { gl_TexCoord[0] = gl_MultiTexCoord0; gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; } fragment shader void main(void) { gl_FragColor = gl_Color; } Those produce empty rendering (black not background color like glClearBuffer does). If I modify the vertex shader to set the gl_FrontColor to gl_Color it does render untouched OpenGl buffer ... with is the expected behavior of pass-through shaders. void main

Why it is necessary to set precision for the fragment shader?

跟風遠走 提交于 2019-11-29 05:44:38
I learn WebGL. Next shaders work fine: // vertex.shader // precision mediump float; attribute vec4 a_Position; attribute float a_PointSize; void main(){ gl_Position = a_Position; gl_PointSize = a_PointSize; } and // fragment.shader precision mediump float; uniform vec4 u_FragColor; void main(){ gl_FragColor = u_FragColor; } Why it is necessary to set precission for the fragment shader? Vertex shader works without this, but fragment shader doesn't work without this code row (as I see). Why the different behaviour exist? I read this before, but it didn't help me. No default precision exists for

Godot Shader文档翻译:2D着色器

痴心易碎 提交于 2019-11-29 03:17:18
译者注:直译为***画布元素着色器***下文中将意译成2D着色器 2D着色器(CanvasItem shaders) 2D着色器用于绘制Godot中的所有的2D元素,包括所有继承于CanvasItem的节点以及所有的GUI元素。 相对于3D着色器,2D着色器要简单一些,内置函数也比较少,但是2D和3D着色器的基础结构是相同的,都包顶点函数( vertex ),片元函数( fragment )及光( light )函数 渲染模式画布元素 渲染模式 描述 blend_mix Mix blend mode (alpha is transparency), default. blend_add Additive blend mode. blend_sub Subtractive blend mode. blend_mul Multiplicative blend mode. blend_premul_alpha Pre-multiplied alpha blend mode. blend_disabled Disable blending, values (including alpha) are written as-is. unshaded Result is just albedo. No lighting/shading happens in material. light

GLSL Problem: Multiple shaders in one program

妖精的绣舞 提交于 2019-11-29 02:47:42
问题 I must have misunderstood something with shaders: I thought that as you can attach multiple shaders to one program, you'd be able to simply attach more than one fragment shader, as an example: A crate texture rendered with a color modulation and refraction. But apparently this is not the case, as you can have only one main function per program. How can I work around the main function limit and allow for any dynamic combination of multiple fragment shaders which are in the same program and

进击的序列帧 一(两篇)------- 让你的序列帧立体起来!

谁都会走 提交于 2019-11-29 02:44:57
当不要脸已成习惯,当山峰也没有了棱角,当招人这么困难的时候,我还是在篇头植入的招聘。 坐标山东青岛市北,招聘日系画师,其他岗位目前公司没有说,有意思的可以入群私聊。 然后再说一下QQ群, 山东手游研发聚集地335772557 ,进群先看公告,要是抱着我要学习的心态进群的话,那你就失望了,因为是个死群。 偶尔心情好的是时候会发个技术链接。 接下来进入正题!! 这篇文章我只是写个想法,如果想360度的立体,自己根据思路自己实现一下吧,可以跟帖讨论,反正我的博客也是个坟。 先上效果图: 很多人一直都认为序列帧的用法就是一张一张的跑马灯,就像认为图片就是用来存储图像一样的认识短浅。 首先我们先来渲染序列帧图像,打开max,呀的一下就创建了一个teapot。 然后做个动画,渲染个序列帧出个图。 准备工作现在可以结束了 接下来我们进入Unity,准备工作(创建粒子系统等)就省略了 找到粒子系统的Renderer部分,勾选Custom Vertex Stream并添加Center(这个就是每粒子的世界位置) 然后创建Shader修改shader的两个struct,如下 然后在顶点函数里组建一下粒子系统的worldpos。 接下来我们就要开始计算视线与每粒子的角度问题了 首先我们计算一下入射向量 根据入射向量就可以得到弧度 atan2返回值是-pi~pi,但是我喜欢0-1,于是就有了 这样的话

Shader——自己写的一个序列帧Shader

吃可爱长大的小学妹 提交于 2019-11-29 02:44:06
说明: 今天尝试使用Shader制作一个播放序列帧的功能,主要的思想是逐帧修改图片的UV坐标。 测试图片: (1)用于测试播放顺序,以免出现顺序问题 (2)真实测试使用的图片 Shader代码如下所示 Shader "Bruce/AnimationShader" { Properties { _Color("Base Color", Color) = (1,1,1,1) _MainTex("Base(RGB)", 2D) = "white" {} _Speed("播放速度",Float)=30 _SizeX ("列数", Float) = 12 _SizeY ("行数",Float)=1 } SubShader { tags{"Queue" = "Transparent" "RenderType" = "Transparent" "IgnoreProjector" = "True"} Blend SrcAlpha OneMinusSrcAlpha Cull Off Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" float4 _Color; sampler2D _MainTex; fixed _Speed; fixed _SizeX; fixed _SizeY;

CESIUM内置shader变量和函数[转]

徘徊边缘 提交于 2019-11-29 01:58:43
cesium中内置了一些常量、变量和函数,在vs和fs中可直接使用。 内置uniform 内置uniform主要置于AutomaticUniforms类里面,该类私有未开放文档。 czm_backgroundColor An automatic GLSL uniform representing the current scene background color. Example: // GLSL declaration uniform vec4 czm_backgroundColor; // Example: If the given color's RGB matches the background color, invert it. vec4 adjustColorForContrast(vec4 color) { if (czm_backgroundColor.rgb == color.rgb) { color.rgb = vec3(1.0) - color.rgb; } return color; } czm_brdfLut An automatic GLSL uniform containing the BRDF look up texture used for image-based lighting computations. Example: // GLSL

分享一个酷炫动态登录页面html

冷暖自知 提交于 2019-11-29 01:51:23
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> 叶子 </TITLE> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <style>body { padding:0; margin:0; overflow:hidden; height: 600px; } canvas { padding:0; margin:0; } div.btnbg { position:fixed; left:0; top:0; }</style> <style> html{ width: 100%; height: 100%; overflow: hidden; font-style: sans-serif; } body{ width: 100%; height: 100%; font-family: