shader

DirectX11 Shader Compilation Issue

孤人 提交于 2020-01-07 09:21:13
问题 I'm working on a simple DirectX application to display couple of triangles together as Tetrahedron,which Keeps crashing at start.I checked with VS2012 Debugger the error occurs at the stage where Shader is supposed to be compiled from a .fx file,So I assume it's got something to do with the shader.I have no idea what I did wrong.Below is the code of the Shader I'm Using.Assistance required. struct Light { float3 pos; float4 ambient; float4 diffuse; }; cbuffer cbPerFrame { Light light; };

Issue upgrading threejs with shaders

冷暖自知 提交于 2020-01-06 19:10:26
问题 I am working on a 3d dataviz. I need to show a world with data on it and I using the chrome experiments (chromeexperiments.com/globe) as a guide. The issue is that this visualizations are made with Threejs r40 and it is hard to find docs about it so I tried to upgrade to r71. I solved the compatibility issues rendering the world but cant make it show the atmosphere, in fact, when I try to show the atmosphere nothing is shown (is like the atmosphere is rendered black and it hides the world). I

Issue upgrading threejs with shaders

£可爱£侵袭症+ 提交于 2020-01-06 19:09:53
问题 I am working on a 3d dataviz. I need to show a world with data on it and I using the chrome experiments (chromeexperiments.com/globe) as a guide. The issue is that this visualizations are made with Threejs r40 and it is hard to find docs about it so I tried to upgrade to r71. I solved the compatibility issues rendering the world but cant make it show the atmosphere, in fact, when I try to show the atmosphere nothing is shown (is like the atmosphere is rendered black and it hides the world). I

Declaring 2d array in XNA

家住魔仙堡 提交于 2020-01-06 14:00:11
问题 6 images 800x640 need to be rendered from a point of view, and based on these images one new image 800x640, a sort of fish-eye view, should be created. At the moment the application draw each image and read the colors by calling this RenderTarget2D.GetData method and based on each pixel position it calculates new position for that final image. It works fine. but since calling RenderTarget2D.GetData reduces the performance I tried to declare a 800x640 array in shader and then render 6 images

GLSL: How to do switch-like statement

余生颓废 提交于 2020-01-06 08:57:08
问题 I would like to dynamically invoke an easing based on the data passed into the shader. So in pseudocode: var easing = easings[easingId] var value = easing(point) I'm wondering the best way to accomplish this in GLSL. I could use a switch statement in some way, or could perhaps put the easings into an array and use them like that. Or maybe there is a way to create a hashtable and use it like the above example. easingsArray = [ cubicIn, cubicOut, ... ] uniform easingId main() { easing =

THREEjs - using an animated gif as a displacement map - shaders

為{幸葍}努か 提交于 2020-01-06 04:42:12
问题 I've been working off this example http://meetar.github.io/threejs-shader-demos/llama.html that uses an animated gif as a displacement map. However, it uses THREE.js r58 and I'm using THREE.js r85 and the following code from the example doesn't work for me dispTexture = new THREE.Texture(llamacanvas); var shader = THREE.ShaderLib[ "normalmap" ]; uniforms = THREE.UniformsUtils.clone( shader.uniforms ); uniforms[ "enableDisplacement" ] = { type: 'i', value: 1 }; uniforms[ "tDisplacement" ] = {

Multisample texture sampling

杀马特。学长 韩版系。学妹 提交于 2020-01-06 03:27:24
问题 Is it true that the only way in OpenGL to sample a multisampled texture, i.e. a multisampled FBO color buffer, is by using texelFetch and specifying the sample you want using an integer index? This provides no information about the position of the sample within the pixel. Is there some reference which can provide the sub-pixel offsets for each sample? Also, what about fragments which lie on the inside of polygons? These will not use all of the multisample samples: Will all of the samples then

How to optimize a color gradient shader?

ε祈祈猫儿з 提交于 2020-01-05 14:03:11
问题 I have created this simple fragment shader for achieving a vertical color gradient effect. But I find this to be taxing for my mobile device in full screen. is there any way to optimize this? here is the link to the code http://glsl.heroku.com/e#13541.0 回答1: You could do something like this instead. vec2 position = (gl_FragCoord.xy / resolution.xy); vec4 top = vec4(1.0, 0.0, 1.0, 1.0); vec4 bottom = vec4(1.0, 1.0, 0.0, 1.0); gl_FragColor = vec4(mix(bottom, top, position.y)); Example You can

Draw a line segment in a fragment shader

牧云@^-^@ 提交于 2020-01-05 07:47:12
问题 I'm struggling to understand the following code, the idea is to draw a simple segment in a fragment shader. I tried to decompose it but I still don't get the ??? line. It would be awesome to have a nice explanation. I couldn't find anything on SO or Google. float lineSegment(vec2 p, vec2 a, vec2 b) { float thickness = 1.0/100.0; vec2 pa = p - a; vec2 ba = b - a; float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 ); // ???????? float idk = length(pa - ba*h); return smoothstep(0.0, thickness, idk

Custom Variable Declarations Using Metal With Scene Kit Shader Modifiers

假如想象 提交于 2020-01-05 04:58:53
问题 I am having difficulty passing uniforms to Scene Kit's shader modifiers. This seems to work fine when using OpenGL but not when using Metal. I have used SCNProgram successfully before but wanted to take advantage of SceneKit's tessellator instead of setting up compute shaders for tessellation. But I want to use the code I have already written in Metal rather than using OpenGL. There is unfortunately not a great deal of examples of how to do this. This Swift Playground illustrates how to do