shader

Unity #pragma shader_feature说明

社会主义新天地 提交于 2019-12-19 03:38:59
shader_feature 作用 根据编译选项产生shader变体 避免分支语句导致的性能下降 主要用于材质选项上 unity打包时如果发现没有材质引用shader_feature产生的变体,不会打包该变体 来源: CSDN 作者: 菜鸡尹 链接: https://blog.csdn.net/huahuakucha/article/details/103604531

OpenGL Compute Shader SSBO

不问归期 提交于 2019-12-18 17:12:21
问题 I want a compute shader that writes 1's in the output buffer. I compile the shader and attach it to the program without problem, then I call glDispatchCompute() function and I wait until compute shader ends. But when I see the array, there are only 0's. Can anyone tell me where is the mistake? This is my compute shader code: #version 430 core layout (local_size_x = 2) in; layout(std430, binding=0) writeonly buffer Pos{ float Position[]; }; void main(){ Position[gl_GlobalInvocationID.x] = 1.0f

billboarding vertices in the vertex shader

前提是你 提交于 2019-12-18 16:58:36
问题 Code demonstrating issue (comment/uncomment out the gl_Position lines in the vertex shader) var scene; var book; var shaderMaterial; var renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setClearColor(0x000000); document.body.appendChild(renderer.domElement); var camera = new THREE.PerspectiveCamera(55, 1, 0.1, 40000); window.onresize = function () { renderer.setSize(window.innerWidth, window.innerHeight); camera.aspect = window.innerWidth / window.innerHeight; camera

Fast Gaussian blur at pause [closed]

点点圈 提交于 2019-12-18 16:55:49
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . In cocos2d-x I need to implement fast gaussian blur and here is how it should looks like( I just found some game on the App Store with already done such blur, in unity): So, it's nice fadeIn - fadeOut blur when user pauses the game. GPUImage already has a fast blur I need, but I can't find solution for cocos2d-x

How to implement this rotating spiral in WebGL? [closed]

一世执手 提交于 2019-12-18 15:53:03
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . Could somebody try to implement given animation into WebGL shader example? It would be great for people learing WebGL like myself. Source: http://dvdp.tumblr.com/post/2664387637/110109 回答1: I've implemented your

Unity3D, round the edges of a box, cube?

筅森魡賤 提交于 2019-12-18 13:29:54
问题 What's the usual way to round the edges on a cube, a rectangular object as in the examples? The ideal result would look pretty much exactly like these images. (Naturally, you could literally use a mesh that has carefully rounded edges and corners, but it takes many tris to achieve that.) Note, of course for a NON -shader approach... Add two small flat boxes and simply make that new normal halfway, i.e., 45 degrees, between the two sides: That would be drawn perfectly round ... GDG below has

How to Solve Rendering Artifact in Blinn/Loop's Resolution Independent Curve Rendering?

ぐ巨炮叔叔 提交于 2019-12-18 12:38:49
问题 In implementing Blinn/Loop's algorithm on curve rendering, I realize there is a special case on Loop Curve Type. As described in their paper (subsection 4.4, page 6-7), they said the curve should be divided into two but I'm really confused how to obtain the intersection point. Here's my rendering result: As stated in the paper, this artifact occurs when either td/sd or te/se lie in between value [0, 1]. My source code: ... case CURVE_TYPE_LOOP: td = d2 + sqrt(4.0 * d1 * d3 - 3.0 * d2 *d2); sd

Metal Shader with SceneKit SCNProgram

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 12:00:52
问题 I'm looking for just a working Metal shader that works in SceneKit with SCNProgram. Can someone show me the correct method declarations/how to hook this up? let program = SCNProgram() program.vertexFunctionName = "myVertex" program.fragmentFunctionName = "myFragment" material.program = program and then the shader //MyShader.metal vertex something myVertex(something) { return something; } fragment float4 myFragment(something) { return something } I'm just looking for the most basic example

Metal Shader with SceneKit SCNProgram

强颜欢笑 提交于 2019-12-18 12:00:49
问题 I'm looking for just a working Metal shader that works in SceneKit with SCNProgram. Can someone show me the correct method declarations/how to hook this up? let program = SCNProgram() program.vertexFunctionName = "myVertex" program.fragmentFunctionName = "myFragment" material.program = program and then the shader //MyShader.metal vertex something myVertex(something) { return something; } fragment float4 myFragment(something) { return something } I'm just looking for the most basic example

What are shaders in OpenGL and what do we need them for?

拥有回忆 提交于 2019-12-18 10:53:22
问题 I'm not native English speaker and when I'm trying to get through openGL wiki and tutorials on www.learnopengl.com, it never ends up understandable by intuition how whole concept works. Can someone maybe explain me in more abstract way how it works? What are vertex shader and fragment shader and what do we use them for? 回答1: The OpenGL wiki gives a good definition: A Shader is a user-defined program designed to run on some stage of a graphics processor. In the past, graphics cards were non