shader

Android绘图之LinearGradient线性渐变(9)

烂漫一生 提交于 2019-12-02 21:34:57
Android 绘图学习 android绘图之Paint(1) android绘图之Canvas基础(2) Android绘图之Path(3) Android绘图之drawText绘制文本相关(4) Android绘图之Canvas概念理解(5) Android绘图之Canvas变换(6) Android绘图之Canvas状态保存和恢复(7) Android绘图之PathEffect (8) Android绘图之LinearGradient线性渐变(9) Android绘图之SweepGradient(10) Android绘图之RadialGradient 放射渐变(11) Android绘制之BitmapShader(12) Android绘图之ComposeShader,PorterDuff.mode及Xfermode(13) Android绘图之drawText,getTextBounds,measureText,FontMetrics,基线(14) Android绘图之贝塞尔曲线简介(15) Android绘图之PathMeasure(16) Android 动态修改渐变 GradientDrawable 1 linearGradient简介 linearGradient线性渐变,会用到Paint的setShader,Shader 被称为着色器

THREE.js blur the frame buffer

妖精的绣舞 提交于 2019-12-02 21:30:21
I need to blur the frame buffer and I don't know how to get the frame buffer using THREE.js. I want to blur the whole frame buffer rather than blur each textures in the scene. So I guess I should read the frame buffer and then blur, rather than doing this in shaders. Here's what I have tried: Call when init: var renderTarget = new THREE.WebGLRenderTarget(512, 512, { wrapS: THREE.RepeatWrapping, wrapT: THREE.RepeatWrapping, minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat, type: THREE.FloatType, stencilBuffer: false, depthBuffer: true }); renderTarget

Unity Shader highlighting overlaps

↘锁芯ラ 提交于 2019-12-02 20:51:50
I am trying to write a shader for unity that will highlight the overlapping fragments of meshes. It should work for one object overlapping itself as well as multiple objects. The result should look like an attached image. First I tried to accomplish this with collision detection but I think that the best way is writing a shader. I'm not very familiar with shaders so if anyone could help me I would be grateful. I think that it can be done by using stencil shaders like here http://docs.unity3d.com/Manual/SL-Stencil.html but this shaders only render intersection of two objects without rendering

How does the default GLSL shaders look like? for version 330

一笑奈何 提交于 2019-12-02 20:15:53
What do the default vertex, fragment and geometry GLSL shaders look like for version #330? I'll be using #version 330 GLSL Version 3.30 NVIDIA via Cg compiler, because that is what my graphics card supports. With default shaders, I mean shaders that do the same exact thing as the graphics card would do when the shader program is turned off. I can't find a good example for #version 330 . Been googling all day. Not sure if the term default shader is called something else like trivial or basic and if that is why I can't find it. Any recommendations for a book with version 330 or link to an easy

Three.js的绘制流程(三)----地形

蓝咒 提交于 2019-12-02 19:43:32
最简单的地形是单一的平面, 这个通过 var geo = new THREE.PlaneGeometry(2, 2, 256, 256) 几何体构建, 可以设定平面的切分块的数量。 var pmesh = new THREE.Mesh(geo, material); 可以为平面提供纹理, 从而是地面看起来更真实一些,而纹理坐标在geo中已经自动设定好了。 因此只需要写材质就可以了。 这里使用ShaderMaterial 用于材质。 顶点shader: varying vec2 vUV; //从定点shader 传递到 片段shader的纹理坐标 void main() { vUV = uv; //uv 是默认存在的顶点属性, 用于做纹理坐标 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1);// projectionMatrix 默认存在的投影矩阵 modelViewMatrix默认模型视图矩阵 position定点坐标 } 片段shader: uniform sampler2D texture_grass;//纹理 varying vec2 vUV; void main() { gl_FragColor = texture2D(texture_grass, vUV); } 材质则是: var

OpenGL ES write depth data to color

a 夏天 提交于 2019-12-02 19:21:07
问题 I'm trying to implement DepthBuffer-like functionality using OpenGL ES on Android. In other words I'm trying to get the 3D point on surface that is rendered on point [x, y] on the user device. In order to make that I need to be able to read the distance of the fragment at that given point. Answer in different circumstances: When using normal OpenGL you could achieve this by creating FrameBuffer and then attach either RenderBuffer or Texture with depth component to it. Both of those approaches

Custom Texture Shader in Three.js

社会主义新天地 提交于 2019-12-02 17:40:52
I'm just looking to create a very simple Fragment Shader that draws a specified texture to the mesh. I've looked at a handful of custom fragment shaders that accomplished the same and built my own shaders and supporting JS code around it. However, it's just not working. Here's a working abstraction of the code I'm trying to run: Vertex Shader <script id="vertexShader" type="x-shader/x-vertex"> varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0); } </script> Fragment Shader <script id="fragmentShader" type="x-shader/x-fragment">

RGB filters for different forms of color blindness

给你一囗甜甜゛ 提交于 2019-12-02 17:18:00
My father is color blind and given that I work in games where the visuals are important, I've always wanted to write a filter for screen shots (or even some type of shader) that emulated different forms of color blindness. I've seen plenty of references but never have been able to track down algorithms. Any algorithms would be appreciated. Mark Ransom My Google search came up with this one, which appears to be exactly what you're looking for. Eight different versions of color blindness are simulated by multiplying each of the R,G,B values by 3 different percentages and adding them together.

Linking with uncompiled shader in Ubuntu

不打扰是莪最后的温柔 提交于 2019-12-02 16:39:56
问题 I need to load a *.glsl to draw something. My environment is Ubuntu 13.04, hence it doesn't exist GLuint InitShader (GLuint, GLuint). It is my config for object creation, pre-link step and linking. Unfortunately, it still occurs the error, which is linking with uncompiled shader. What's wrong with me? glewExperimental = GL_TRUE; glewInit (); glGenVertexArrays (1, &_vao_vertex_array[_vao_index++]); glBindVertexArray (_vao_vertex_array [_vao_index - 1]); GLuint buffer; glGenBuffers (1, &buffer)

Android 使用Universal Image Loader绘制带圆角的图片(一)

删除回忆录丶 提交于 2019-12-02 15:35:04
Android 使用Universal Image Loader绘制带圆角的图片(一) 绘制带圆角的控件难吗?貌似不难。对于一个普通layout或者widget,要绘制圆角,只要把 background设置成下面这样的drawable就行了。 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <!-- 填充的颜色 --> <solid android:color="@color/pure_white" /> <!-- 设置按钮的四个角为弧形 --> <!-- android:radius 弧形的半径 --> <corners android:radius="@dimen/small_corner_radius" /> </shape> 但是,对于图片控件ImageView,这种方法却会没有效果。要想知道原因,就得看android源码。首先看看ImageView是如何设置Bitmap的。 public void setImageBitmap(Bitmap bm) { // if this is used frequently, may handle bitmaps