shader

Synchronisation in OpenGL (part 1.1)

 ̄綄美尐妖づ 提交于 2019-12-20 03:47:11
问题 My questions pertain to the use of a single OpenGL 4.5 context without any direct memory mapping or explicit synchronisation (hypothetically), with both rendering shaders (invoked with glDrawArrays() ) and compute shaders (invoked with glDispatchCompute() ). Question 1.1: Are all changes to rendering state – such as with glUseProgram() , glEnable() / glDisable() , glStencilFunc() , glStencilOp() , glClearColor() , glStencilMask() , glClearStencil() , glBlendFunc() , glColorMask() , etc. –

What is the fastest shadowing algorithm (CPU only)?

旧城冷巷雨未停 提交于 2019-12-20 03:16:31
问题 Suppose I have a 3D model: The model is given in the form of vertices, faces (all triangles) and normal vectors. The model may have holes and/or transparent parts. For an arbitrarily placed light source at infinity, I have to determine: [ required ] which triangles are (partially) shadowed by other triangles Then, for the partially shadowed triangles: [ bonus ] what fraction of the area of the triangle is shadowed [ superbonus ] come up with a new mesh that describe the shape of the shadows

What is the fastest shadowing algorithm (CPU only)?

时光毁灭记忆、已成空白 提交于 2019-12-20 03:16:19
问题 Suppose I have a 3D model: The model is given in the form of vertices, faces (all triangles) and normal vectors. The model may have holes and/or transparent parts. For an arbitrarily placed light source at infinity, I have to determine: [ required ] which triangles are (partially) shadowed by other triangles Then, for the partially shadowed triangles: [ bonus ] what fraction of the area of the triangle is shadowed [ superbonus ] come up with a new mesh that describe the shape of the shadows

Reading a shader from a .txt file using a structure

删除回忆录丶 提交于 2019-12-20 03:10:16
问题 I've started learning how to use OpenGL and I absolutely hate having my shaders declared as global variables before my main(). I thought it would be cool to make a structure or class that would read the shader from a file in my project directory. The file reading works perfectly fine, but for some reason it won't actually output an image like it would if I had the shader declared before main. Here is my example. Shader Reading Structure: #include "allHeader.h" struct shaderReader {

HLSL 3 Can a Pixel Shader be declared alone?

我的梦境 提交于 2019-12-20 01:45:23
问题 I've been asked to split the question below into multiple questions: HLSL and Pix number of questions This is asking the first question, can I in HLSL 3 run a pixel shader without a vertex shader. In HLSL 2 I notice you can but I can't seem to find a way in 3? The shader will compile fine, I will then however get this error from Visual Studio when calling SpriteBatch Draw(). "Cannot mix shader model 3.0 with earlier shader models. If either the vertex shader or pixel shader is compiled as 3.0

error X3000: Illegal character in shader file

给你一囗甜甜゛ 提交于 2019-12-19 18:17:29
问题 I pasted a line of shader code from SO and now my project refuses to work. I removed the tainted line of code. I've re-written the shader multiple times from scratch using VS, Notepad and Notepad++ as suggested on the Unity forums. I've used the hex editor view in Notepad++ to rule out the first two bytes aren't 0xFE 0xFF as suggested on this gamedev question. I really can't figure this one out. I'm grateful for any suggestions you might have. cbuffer CB_PER_FRAME : register(b0) { column

why Particle system with shader doesn't work? three.js

…衆ロ難τιáo~ 提交于 2019-12-19 10:32:18
问题 Hi can anyone help me whith this? I have this shader, it works with THREE.Mesh but doesn't with THREE.Particlesystem? I want each particle to have a portion of a given map(texture) and change their positions accordingly, something like this http://www.chromeexperiments.com/detail/webcam-displacement/?f=webgl <script id="vs" type="x-shader/x-vertex"> uniform sampler2D map; varying vec2 vUv; void main() { vUv = uv; vec4 color = texture2D( map, vUv ); float value = ( color.r + color.g + color.b

Ambient occlusion in threejs

岁酱吖の 提交于 2019-12-19 05:24:05
问题 I've just finished porting of my first cloth simulation from opengl to webgl using three.js (can be seen here). The thing is it looks a bit dull, and I want to add (as i hope i remember correctly from my computer graphics classes) ambient occlusion, to make the cloth nicely shaded on collision with ball. My knowledge about shaders is now on very low level, so I'd be very thankful for any resources on this topic helpful with three.js development (tutorials, book titles etc), because googles

glCreateShader and glCreateProgram fail on android

做~自己de王妃 提交于 2019-12-19 05:18:49
问题 I'm having a very difficult problem creating a shader program on android. when I call glCreateShader or glCreateProgram each always returns 0. I've covered all my bases with regards to troubleshooting: I checked to make sure I had an ogl context (I do, i tested this by clearing the frame buffer with various colors, which worked). I tried glGetError but it returned nothing (GL_NO_ERROR) I'm not an opengl or android expert so I don't know of any thing else that could be causing this. I've been

How to use a timer inside a vertex shader to animate point sizes in OpenGL

随声附和 提交于 2019-12-19 04:22:25
问题 I'm trying to implement a point cloud where the different points shall vary in size based on an uncertainty value associated with them. Let's say, if this value is zero, the size should be constant, if it's approaching 1, the radius of those points should vary more and more. First, the points should gain in size and after reaching a maximum, they should decrease until a minimum, and so on. A function to describe this phenomenon could be: pointSize = x +/- c * pointUncertainty, where x =