geometry-shader

Apply color gradient to material on mesh - three.js

穿精又带淫゛_ 提交于 2019-12-20 19:52:41
问题 I have an STL file loaded into my scene with a single colour applied to a phong material I'd like a way of applying two colours to this mesh's material with a gradient effect applied on the Z axis a like the example below.Gradient Vase]1 I have a feeling I may have to introduce shaders but I've not gotten this far with three.js. 回答1: Simple gradient shader, based on uvs: var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera(60, 1, 1, 1000); camera.position.set(13, 25, 38);

Apply color gradient to material on mesh - three.js

穿精又带淫゛_ 提交于 2019-12-20 19:52:11
问题 I have an STL file loaded into my scene with a single colour applied to a phong material I'd like a way of applying two colours to this mesh's material with a gradient effect applied on the Z axis a like the example below.Gradient Vase]1 I have a feeling I may have to introduce shaders but I've not gotten this far with three.js. 回答1: Simple gradient shader, based on uvs: var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera(60, 1, 1, 1000); camera.position.set(13, 25, 38);

Receive and cast shadows (custom GEOMETRY Grass Shader) - Unity C#

ぃ、小莉子 提交于 2019-12-13 03:19:27
问题 I was following a tutorial made by Sam Wronski aka. World of Zero (Tutorial by World of Zero) where he codes a geometry shader for a point cloud grass generator. Great tutorial but I am wondering (and didn't find a proper solution after days of research) how I could implement shadows to the shader (casting and receiving shadows). I am trying to dig deeper into shaders, but this is a level to high for me yet. My question is : how can I implement shadow casting and receiving for this grass

Geometry shader doesn't do anything when fed GL_POINTS

时光怂恿深爱的人放手 提交于 2019-12-12 19:32:07
问题 I'm trying to use geometry shaders to turn points into line segments (GL_POINTS to GL_LINE_STRIP), but no line segments appear. If I change the input to GL_LINES, and just repeat the vertex, then I get the behavior I'm expecting. What's going on? Here's a complete program that demonstrates the behavior. As-is, I get nothing but a black window. Setting USE_POINTS to False gets me the rotating psychedelic flashing lines I'm expecting. #!/usr/bin/python from OpenGL.GL import * from OpenGL.GLU

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

Wide lines in geometry shader behaves oddly

▼魔方 西西 提交于 2019-12-07 05:25:05
问题 I'm trying to render arbitrary wide lines (in screen space) using a geometry shader. At first it seems all good, but on certain view position the lines are rendered incorrectly: The image on the left present the correct rendering (three lines on positive X, Y and Z axes, 2 pixel wide). When the camera moves near the origin (and indeed near the lines), the lines are rendered like the right image. The shader seems straightforward, and I don't understand what's going on my GPU: --- Vertex Shader

SceneKit - Map cube texture to box

风流意气都作罢 提交于 2019-12-05 17:47:27
I've a texture for a cube that looks like I'd like to use it on a cube in a SceneKit view. I'm using the SceneKit geometry SCNBox for that. Unfortunately, the result is that the texture is projected entirely on each face, instead of using only the corresponding part: let videoGeometry = SCNBox(width: 1, height: 1, length: 1, chamferRadius: 0) videoGeometry.firstMaterial?.isDoubleSided = true videoGeometry.firstMaterial?.diffuse.contents = UIImage(named: "test")! I know I can use shader modifiers on the geometry but I'm not sure where to get started. Since the texture is currently used six

Apply color gradient to material on mesh - three.js

亡梦爱人 提交于 2019-12-03 06:24:07
I have an STL file loaded into my scene with a single colour applied to a phong material I'd like a way of applying two colours to this mesh's material with a gradient effect applied on the Z axis a like the example below. Gradient Vase ] 1 I have a feeling I may have to introduce shaders but I've not gotten this far with three.js. Simple gradient shader, based on uvs: var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera(60, 1, 1, 1000); camera.position.set(13, 25, 38); camera.lookAt(scene.position); var renderer = new THREE.WebGLRenderer({ antialias: true }); var canvas =

How do I pass vertex color through the shader pipeline?

这一生的挚爱 提交于 2019-12-01 09:54:46
问题 I am trying to pass vertex color through the vertex, geometry and fragment shader: glBegin(GL_POINTS); glVertex3f(-2.0f, 0.0f, 0.0); glColor3f(0.0,1.0,0.0); glVertex3f(+2.0f, 0.0f, 0.0); glColor3f(0.0,0.0,1.0); glEnd(); vertex shader: # version 130 varying vec4 colorv; void main() { // pass trough: gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex; colorv = gl_Color; } geometry shader: #version 150 layout(points) in; // origo of cell layout(points, max_vertices = 1) out;

What can cause glDrawArrays to generate a GL_INVALID_OPERATION error?

纵然是瞬间 提交于 2019-11-28 18:08:32
I've been attempting to write a two-pass GPU implementation of the Marching Cubes algorithm, similar to the one detailed in the first chapter of GPU Gems 3, using OpenGL and GLSL. However, the call to glDrawArrays in my first pass consistently fails with a GL_INVALID_OPERATION . I've looked up all the documentation I can find, and found these conditions under which glDrawArrays can throw that error: GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to an enabled array or to the GL_DRAW_INDIRECT_BUFFER binding and the buffer object's data store is currently mapped. GL