shader

QML apply a texture to a Mesh

筅森魡賤 提交于 2019-12-11 04:42:08
问题 I am trying to apply an image texture to a Mesh in QML (Qt 5.6.2). I started from the sample "Shadow Map QML" and I want to texture the GroundPlane. Material and Effect qml classes are applied to that GroundPlane mesh but I can't see how to apply an image texture. In QML, there is TextureImage, ShaderEffect but nothing about how they can be applied to a Mesh. Any ideas? EDIT: Qt 5.6.2 is not the good version to work with to use Qt3D as the first "fully supported release of a stable Qt 3D

Make a sprite white in XNA 4.0 w/ simple shader (alpha issues)

こ雲淡風輕ζ 提交于 2019-12-11 04:27:56
问题 Using the simple shader at Tint Sprite White and the sample code at Sprite Effects Sample, I've loaded the .fx file for the shader into the sample project and replaced one of the sample effects in one of the Draw() calls to use the whitening effect. What I get is a big white square with the same dimensions as the texture itself. I obviously want only the regions of the texture where the alpha is not 0 to be made white. The shader appears to be working, as I altered the default white color to

Single-pass wireframe issue

拟墨画扇 提交于 2019-12-11 04:16:22
问题 I am trying to implement single-pass wireframe, but I have got couple of issues in the process. Question #1 For some reasons I get only wireframe without (like with glPolygoneMode - lines) filled geometry after my geometry shader worked. ) But if I disable the geometry shader I get my geometry: What I really like to achieve is both geometry and its wireframe. Question #2 Actually, my primitives are triangle strips. I use them to avoid using on quads to improve performance. How can I skip

Drawing circles on a sphere

别说谁变了你拦得住时间么 提交于 2019-12-11 04:07:09
问题 I'm trying to draw lots of circles on a sphere using shaders. The basic alogrith is like this: calculate the distance from the fragment (using it's texture coordinates) to the location of the circle's center (the circle's center is also specified in texture coordinates) calculate the angle from the fragent to the center of the circle. based on the angle, access a texture (which has 360 pixels in it and the red channel specifies a radius distance) and retrieve the radius for the given angle if

Is there a time border for OpenGL Compute Shaders?

那年仲夏 提交于 2019-12-11 03:44:53
问题 I am using the OpenGL Compute Shaders to do some calculation on data. Everything works fine except that it does not seem to be possible to run one shader much more than 10 seconds. I measure the time with glBeginQuery(...) and glEndQuery(...) . The shader runs between 1 ms and 10 seconds good. I just add some data without any shader invocations to increase the time the shader needs. But I can not add more Data when the shader needs a bit more than 10 seconds. Then, the program freezes and I

Unity Shader 屏幕后处理灰度

主宰稳场 提交于 2019-12-11 03:30:43
原理: 移除场景中除了黑白灰以外所有的颜色,让整个图像灰度化(Grayscale)。很简单的实现方式是,取所有的颜色分量,将它们平均化,但是但人眼会对绿色更加敏感一些,而对蓝色不那么敏感,所以为了获取物理上更精确的效果,我们需要使用加权的(Weighted)通道: 脚本如下: public Shader shader ; //相应的shader private Material mat = null ; //相应的材料 public Material material { get { mat = CheckShaderAndCreateMaterial ( shader , mat ) ; return mat ; } } void OnRenderImage ( RenderTexture src , RenderTexture dest ) { if ( material != null ) { Graphics . Blit ( src , dest , material ) ; } else { Graphics . Blit ( src , dest ) ; } } Shader实现如下: Properties { _MainTex ( "Base (RGB)" , 2 D ) = "white" { } //渲染纹理 } SubShader { Pass { ZTest

How to use a huge array in HLSL (error X4505)

瘦欲@ 提交于 2019-12-11 03:27:10
问题 When I try to compile I get the error: X4505: sum of temp register and indexable temp registers exceeds limit of 4096. However my shader does work in FX Composer . The reason it crashes is probably because I use a very large array since I'm using marching cubes. const static int edgeTable[256] = ... const static int triTable[256][16] = ... How should I go about using these arrays? (D11) 回答1: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476898(v=vs.85).aspx#Shader_Constant_Buffer

Can I load a shader into My JavaScript code from an external text file?

佐手、 提交于 2019-12-11 03:26:35
问题 I learn WebGL . I see the tutorial has the code of shaders inside of JavaScript code as a usual string. For example: var VSHADER_SOURCE = 'void main(){\n' + ' gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n' + ' gl_PointSize = 10.0;\n' + '}\n'; I want to place the code of my shaders into the external text files and load them into my JavaScript code when it necessary. How can I do it right? I don't want mix the JavaScript code and shader code in the same source code file. I looked the sample

OpenGL ES 2.0 Vertex Shader Texture Reads not possible from FBO?

為{幸葍}努か 提交于 2019-12-11 02:59:51
问题 I'm currently working on a GPGPU project that uses OpenGL ES 2.0. I have a rendering pipeline that uses framebuffer objects (FBOs) as targets, i.e. the result of each rendering pass is saved in a texture which is attached to an FBO. So far, this works when using fragment shaders. For example I have to following rendering pipeline: Preprocessing (downscaling, grayscale conversion) -> Adaptive Thresholding Pass 1 -> Adapt. Thresh. Pass 2 -> Copy back to CPU However, I wanted to extend this

How to create an animated texture in SceneKit? “fallback on default program” error

泄露秘密 提交于 2019-12-11 02:54:35
问题 I would like to use an animated texture in SceneKit, I found this Using shader modifiers to animate texture in SceneKit leads to jittery textures over time , but I have got an error with the same code : C3DResourceManagerMakeProgramResident failed to compile program - fallback on default program I tried to use another file for the shader (New file > Empty > called animated.shader), and use this code instead, but I have got the same error : let fireImage = UIImage(contentsOfFile: "art