shader

Temporal filtering on depth image

前提是你 提交于 2021-02-11 15:08:36
问题 I'm reading the following paper and I'm trying to implement it, but it seems I'm not understanding fully the paper. https://vcg.informatik.uni-rostock.de/~malub/publications/2016_depthenhance/16_ARLS_depthenhancement.pdf I have calculated optical flow and some history of the depth images, and took the a linear average over the history samples as shown in the shader code. What I get is an image that has holes however the original one doesn't have any holes. Current filtered image Shader

Unity Shader - How to efficiently recolor specific coordinates?

做~自己de王妃 提交于 2021-02-08 13:23:50
问题 First, please allow me to explain what I've got and then I'll go over what I'm trying to figure out next. What I've got I've got a textured custom mesh with some edges that exactly align with integer world coordinates in Unity. To the mesh I've added my own crude yet effective custom surface shader that looks like this: Shader "Custom/GridHighlightShader" { Properties { [HideInInspector]_SelectionColor("SelectionColor", Color) = (0.1,0.1,0.1,1) [HideInInspector]_MovementColor("MovementColor",

Texture does not fit in the square - OpenGL

老子叫甜甜 提交于 2021-02-08 08:32:51
问题 I am trying to create a square and put a red circle middle of it. As you can see in the simple vert I map (-1, 1) range to (0,1) range: coord = position.xy*0.5 + vec2(0.5,0.5); If you look at the simple.frag, there is this line: if(abs(length(coord - vec2(0.5,0.5))) < 0.3) Thus I am expecting red circle at the middle of square. However this happens: The center of circle is beyond of (0.5, 0.5). If I change that line to this: if(abs(length(coord - vec2(0.0,0.0))) < 0.3) Output is: The center

Texture does not fit in the square - OpenGL

不羁的心 提交于 2021-02-08 08:32:25
问题 I am trying to create a square and put a red circle middle of it. As you can see in the simple vert I map (-1, 1) range to (0,1) range: coord = position.xy*0.5 + vec2(0.5,0.5); If you look at the simple.frag, there is this line: if(abs(length(coord - vec2(0.5,0.5))) < 0.3) Thus I am expecting red circle at the middle of square. However this happens: The center of circle is beyond of (0.5, 0.5). If I change that line to this: if(abs(length(coord - vec2(0.0,0.0))) < 0.3) Output is: The center

Using OpenGL shaders for math calculation (C++)

只愿长相守 提交于 2021-02-08 06:35:35
问题 I have a matrix (for example 100x100 dimantion): I need to do calculation with each element ( matrix[i,j]*tt/8+5 for example) I have huge matrix and I want to implement the algorithm using OpenGL shaders. I want to use shader like: uniform float val; uniform float tt; void main() { gl_Position.x = val*tt/8+5 } How I can implement the program? How I can get matrix after calculation(I do not want to show any windows\pictures? 回答1: It is possible if you create a fake window frame buffer. See my

Browser for CSS shaders? [closed]

陌路散爱 提交于 2021-02-07 14:23:21
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Improve this question Is there a browser which supports CSS shaders? 回答1: At the time of this writing, CSS Custom Filters, formerly known as CSS Shaders, are not available in any browser. They were an experimental feature available in WebKit Nightly and Chrome (under a flag) for a

D3D11: variable number of lights in HLSL

戏子无情 提交于 2021-02-07 08:17:22
问题 I'm working on a game engine in C++ and Direct3D11 and I want now to add a variable number lights to the scene. Up to date, I managed to add and render simple lights of a count that was already known and coded in the shader programs. In shader.fx: static const int LightsCount= 4; struct NF3D_LIGHT { // Members... }; cbuffer Light : register(b5) { NF3D_LIGHT light[LightsCount]; }; ... // And the pixel shader function: float4 PS(PS_INPUT input) : SV_Target { for(int i = 0; i < LightsCount; i++)

D3D11: variable number of lights in HLSL

你离开我真会死。 提交于 2021-02-07 08:16:35
问题 I'm working on a game engine in C++ and Direct3D11 and I want now to add a variable number lights to the scene. Up to date, I managed to add and render simple lights of a count that was already known and coded in the shader programs. In shader.fx: static const int LightsCount= 4; struct NF3D_LIGHT { // Members... }; cbuffer Light : register(b5) { NF3D_LIGHT light[LightsCount]; }; ... // And the pixel shader function: float4 PS(PS_INPUT input) : SV_Target { for(int i = 0; i < LightsCount; i++)

OpenGL shaders don't compile

北慕城南 提交于 2021-02-02 09:21:20
问题 The shaders in my OpenGL project don't compile. I have Ubuntu 16.04 LTS, using CLion. Didn't find any solution, that's why asking here. Here is my errorlist: ATTENTION: default value of option force_s3tc_enable overridden by environment. ERROR::SHADER::VERTEX::COMPILATION_FAILED 0:1(1): error: syntax error, unexpected $end ERROR::SHADER::FRAGMENT::COMPILATION_FAILED 0:1(1): error: syntax error, unexpected $end ERROR::SHADER::PROGRAM::LINKING_FAILED error: linking with uncompiled shadererror:

Get a vignette effect by shaders

旧巷老猫 提交于 2021-01-29 11:16:15
问题 Im trying to create a vignette effect for my app. I've been searching a lot for help achieving this but was unable to find anything. I recently found this tutorial. And i tried to implement it in my app with this code: public int[] drawBitmap(Bitmap originalBitmap){ Bitmap mask; Paint paint = new Paint(); mask = convertToAlphaMask(BitmapFactory.decodeResource(context.getResources(), R.drawable.spot_mask)); Shader shader = createShader(mask); paint.setShader(shader); Bitmap tempBit = Bitmap