shader

WPF Shader Effect - antialiasing not showing

痞子三分冷 提交于 2019-12-07 19:03:32
问题 I am running to a problem where I have a WPF shader effect (modified from Rene Schulte) to simulate Dot Matrix Display (DMD). Everything works great, but all dots are aliased. See attached image. I tried many features within WPF, to bring antialiasing, nothing to do. in constructor (image within a textbox); RenderOptions.SetBitmapScalingMode(MarqueeTB, BitmapScalingMode.HighQuality); RenderOptions.SetEdgeMode(MarqueeTB, EdgeMode.Unspecified); RenderOptions.SetClearTypeHint(MarqueeTB,

SCN shader modifier in metal - pass uniform to shader

眉间皱痕 提交于 2019-12-07 15:48:41
问题 I'm trying to use shaders modifiers with Metal. I cannot figure out to declare uniforms... So far my fragment modifier is: // color changes #pragma arguments float4x4 u_color_transformation; #pragma body _output.color.rgb = vec3(1.0) - (u_color_transformation * _output.color).rgb; This outputs a purple texture, with no log.. If I just have _output.color.rgb = (u_color_transformation * _output.color).rgb , things are ok. I think I'm following the doc but maybe not! The uniform is set with:

Trouble with imageStore() (OpenGL 4.3)

Deadly 提交于 2019-12-07 12:02:49
问题 I'm trying to output some data from compute shader to a texture, but imageStore() seems to do nothing. Here's the shader: #version 430 layout(RGBA32F) uniform image2D image; layout (local_size_x = 1, local_size_y = 1) in; void main() { imageStore(image, ivec2(gl_GlobalInvocationID.xy), vec4(0.0f, 1.0f, 1.0f, 1.0f)); } and the application code is here: GLuint tex; glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, WIDTH, HEIGHT, 0, GL_RGBA, GL

Vertex shader with array inputs

不问归期 提交于 2019-12-07 11:33:44
问题 Given a vertex shader that looks something like #version 400 compatibility const int max_valence = 6; in int valence; in vec3 patch_data[1 + 2 * max_valence]; ... What is the the proper way to map the data to the correct vertex attribs? I'm trying to use a VBO, but I can't figure out how to pass that large of a value in. glVertexAttribPointer takes at most a vector of size 4. What's the correct way to get the vertex attributes into the shader? 回答1: Arrays of vertex attributes are legal in

OpenGL - Fixed pipeline shader defaults (Mimic fixed pipeline with shaders)

梦想的初衷 提交于 2019-12-07 08:59:04
问题 Can anyone provide me the shader that are similar to the Fixed function Pipeline? I need the Fragment shader default the most, because I found a similar vertex shader online. But if you have a pair that should be fine! I want to use fixed pipeline, but have the flexability of shaders, so I need similar shaders so I'll be able to mimic the functionality of the fixed pipeline. Thank you very much! I'm new here so if you need more information tell me:D This is what I would like to replicate:

Three.js using WebRTC and applying a Shader

旧时模样 提交于 2019-12-07 08:00:49
问题 I can't figure out how to apply a shader to a three.js object that has a video texture. I've been playing around with webRTC and three.js and successfully mapped a video texture onto a mesh using a standard material: var material = new THREE.MeshBasicMaterial({ color : 0xffffff, map : videoTexture }); I want to take it one step further by applying a shader (for this example a sobel shader) to this texture. My attempt is here: http://jsfiddle.net/xkpsE/1/ I'm receiving a bunch of INVALID

Add alpha to shader in Unity3D

风流意气都作罢 提交于 2019-12-07 07:58:56
问题 I don't have any idea about shader programming but right now I need to add alpha to the shader that I want to use. Actually I want to fade in and fade out my sprite but it's not in the shader that I use. Shader : Shader "Sprites/ClipArea2Sides" { Properties { _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} _Length ("Length", Range(0.0, 1.0)) = 1.0 _Width ("Width", Range(0.0, 1.0)) = 1.0 } SubShader { LOD 200 Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" =

Fast, inaccurate sin function without lookup

China☆狼群 提交于 2019-12-07 06:56:16
问题 For an ocean shader, I need a fast function that computes a very approximate value for sin(x). The only requirements are that it is periodic, and roughly resembles a sine wave. The taylor series of sin is too slow, since I'd need to compute up to the 9th power of x just to get a full period. Any suggestions? EDIT: Sorry I didn't mention, I can't use a lookup table since this is on the vertex shader. A lookup table would involve a texture sample, which on the vertex shader is slower than the

SceneKit pass uniform vector to shader modifiers

我怕爱的太早我们不能终老 提交于 2019-12-07 06:52:00
问题 I'm trying to pass a GLKVector4 to a shader that should receive it as a vec4 . I'm using a fragment shader modifier: material.shaderModifiers = [ SCNShaderModifierEntryPoint.fragment: shaderModifier ] where shaderModifier is: // color changes uniform float colorModifier; uniform vec4 colorOffset; vec4 color = _output.color; color = color + colorOffset; color = color + vec4(0.0, colorModifier, 0.0, 0.0); _output.color = color; (I'm simply adding a color offset) I've tried: material.setValue

Why does glValidateProgram fail when no VAO is bound?

孤街浪徒 提交于 2019-12-07 05:59:34
问题 I have a problem validating my shader program in LWJGL/OpenGL 3. I read the documentation, but I can't seem to find a reason why a VAO is needed when calling glValidateProgram. int program = glCreateProgram(); int vertexShader = glCreateShader(...); int fragmentShader = glCreateShader(...); // ... vertex and fragment shader loading, compiling, errorchecking ... glAttachShader(program, vertexShader); glAttachShader(program, fragmentShader); glBindAttribLocation(program, 0, "position");