Questions tagged [vertex-shader]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
2answers
62 views

z ordering in directx11

Hi recently i am trying to implement z ordering system into my directx framework. So every object will have z order property(int), and this value will have higher priority than depth checking for ...
0
votes
0answers
23 views

Vertex Shading displays 4th texture but does not blend corner using it

I'm trying to create a square grid and I'm blending textures via vertex shading. The only issue is a small quad in the middle of 4 tiles, it's blending 3 textures but the 4th texture is sort of "...
0
votes
0answers
34 views

how would I render particle system in a 3D scene in Opengl 3.3

I have a scene that imports .obj (Wavefront) files and I have written the shaders for rendering them in a scene with multiple light sources. Here are my Shaders: Vertex Shader: ...
0
votes
0answers
219 views

Simple shader that scales UI image from the center

I'm having trouble making a (vertex) shader that scales UI images from the center. I can scale the image, but the image doesn't stay centered. Here is a project showing the problem Here is a ...
0
votes
1answer
431 views

How do you write an unlit shader which supports Ambient Occlusion?

For performance reasons, a scene might use Unlit shaders only. Is there an Unlit shader which supports Ambient Occlusion? What is the best way to achieve this look, for moving and static objects, ...
0
votes
0answers
71 views

How to get the coordinate in world space of points on the object?

I want to simulate the direction of the water. So I have to confirm the coordinate in world space of points on object. However, there is some error I found. When I put the object at origin (0,0,0) ...
1
vote
1answer
412 views

Morphing a 3D model into a sphere or cube using a vertex shader

I want to morph between 3d models.I found a simple OpenGL code to morphing In Graphics Shaders: Theory and Practice(page 456) but I couldn't Implement it correctly in unity. ...
0
votes
1answer
87 views

error X4016: SV_InstanceID semantic cannot be used with 10Level9 targets

I'm using a variant of the D3D12 UWP template that comes with VS2017 Community Edition and I have two related questions: When I add this italicized and bolded code to the vertex shader signature, I ...
0
votes
0answers
49 views

Why does this work in the fragment shader but not in the vertex shader?

I'm doing some model view and projection transforms in the vertex shader and I want to determine whether the current vertex will end up on the viewport or not. After searching a bit I found that ...
0
votes
1answer
760 views

Combining several passes in shader in Unity

I am very new to shaders but can't seem to find an answer to my problem. To put it simple I have created a flag shader, which can apply texture, animates and should also react to light. The problem ...
0
votes
0answers
48 views

Prevent near-plane culling in vertex shader

I am rendering a non-sphere light mesh and the standard question is how to cull: cull front faces and you loose Z-Testing benefits, cull back and you get into situations where camera is not rendering ...
1
vote
1answer
178 views

Does it make sense to do more calculations in the fragment shader if there are more vertices than pixels?

I'm very new to graphics programming, and as I understand it vertex shaders are called per vertex and fragment shaders are per pixel (ignoring anti-aliasing). When it comes to optimization all sources ...
0
votes
0answers
307 views

Drawing 2D text over 3D scene OpenGL3.3

I got a question regarding rendering a 2D text over the 3D scene in OpenGL 3.3. I followed this tutorial about how to render text in OpenGL. Although the tutorial is for C++ i ported it to Java (...
4
votes
0answers
106 views

How to implement a pannini projection in opengl?

I have read about the pannini projection, which involves (I think) projecting a scene onto a cyclinder instead of a rectangle. How can I implement this projection in a vertex shader? Blinky is using ...
1
vote
1answer
235 views

Multiple mains in vertex shader, GLSL

I have a renderer where you can define passes where you pick the shader, and a signal, each object can register a listener to that signal in order to draw himself, the problem comes when some objects ...
0
votes
1answer
59 views

Why does this floor() call appear to have no effect?

I'm trying to get an effect where my material forms a mosaic which is aligned to the material. So I slapped a simple quad in the scene with a new material on it and set a new shader to that material. ...
2
votes
2answers
4k views

What can I do with the 4th component of gl_Position?

When I set gl_Position I usually assign it such as gl_Position = vec4(in_position, 1.0) where ...
1
vote
0answers
160 views

How can I rolling plane by vertex shader?

I have plane that i wanna roll it by vertex shader like this: https://www.desmos.com/calculator/mrfrugwvm5 this is my shader: ...
2
votes
1answer
1k views

Difference between linear and logarithmic z-buffer

I've searched about this topic for awhile and i couldn't find it on google. I've come across several ways to avoid z-fighting which are linear z-buffer, logarithmic z-buffer and reversed z-buffer. I ...
0
votes
1answer
53 views

Transform vertices in a line differently?

With a GL_LINE, is there a way to have the vertex (or geometry) shader treat the first and second point differently? i.e. In a line from ...
7
votes
1answer
687 views

How can I make custom character face editor In my game In an optimal way?

In many games there Is section as customize character that you can make your own character.I always love to know how can I make something like It. Even old game have this feature? but how ? For ...
7
votes
1answer
341 views

Why does duplicating my object cause its vertex animation shader to distort it?

I used a vertex shader (based on this example) to animate a flag waving. When I have a single flag in my scene, it works correctly. When I duplicate the flag, all of the copies become wildly ...
0
votes
1answer
38 views

DirectX Assembler Stage, passing same data

I'm having problems with the Input Assembler. The first time the data is passed through the pipeline, everything is fine. But, when the index buffer (with a diffrent/higher index than before) refers ...
0
votes
1answer
113 views

Does cube map texturing works only for objects which vertices are is in [-1,1] range?

Im attempting to texture an .obj file that is not a skybox. So the question is, every tutorial about cubemap creates their hardcoded cubes with vertices ranging from [-1, 1]. Probably not, but is it ...
4
votes
2answers
1k views

color individual triangles on a mesh in Unity?

I am trying to use Unity to display a model and color some triangles on the model to high light those parts of the model. I have created a scene, with a camera, a light source and a cube. After the ...
2
votes
1answer
744 views

GLSL - skewed parallax occlusion mapping

I'm currently trying to implement Parallax Occlusion Mapping, based off a post on sunandblackcat.com With my current implementation, I have the following: ...
0
votes
1answer
846 views

Unity Vertex shader recalculate renderer bounds

I've made a simple billboard gpu instancing vertex shader that manipulates the verticies of an object based on the projection matrix. The problem is that the renderer bounds does not update to ...
0
votes
1answer
210 views

input arrays in OpenGL vertex Shader

would something like this be valid as an input to a vertex shader? layout (location = 0) in float[6] faceTextureOffsets; I know you can use things like vec3s but ...
0
votes
3answers
523 views

Difference in Shading Using Eye Space or Model Space Coordinates

While reading on shading, I came across a section in which the artist provides 2 different kinds of fragment shading: Coloring using model space and eye space. The result is as illustrated in the ...
3
votes
1answer
129 views

Why do we multiply perspective * modelview * point?

A common line in vertex shaders is: gl_Position = projection_matrix * model_view_matrix * object_space_vertex; I've seen this a lot, why isn't it written like <...
2
votes
2answers
460 views

Why does VertexPositionColor seem incompatible with Monogame?

This question is a continuation of What causes this InvalidOperationException when drawing primitives?. I've been dealing with HLSL shaders in Monogame over the past few days. It has been extremely ...
0
votes
2answers
159 views

What causes this InvalidOperationException when drawing primitives?

I'm working on implementing a 2D masking effect in my current game. To do so, I have two textures, one for the source image and one for the mask. The source image is just a regular texture, so that's ...
0
votes
1answer
393 views

Shader to render objects with distance independent size

I am trying to find a way to render certain objects in my 3d scene without the effects of the perspective projection. E.g. I want them to have the same pixel dimension independent of distance to the ...
1
vote
1answer
733 views

HLSL How to flip geometry horizontally

I want to flip my asymmetric 3d model horizontally in the vertex shader alongside an arbitrary plane parallel to the YZ plane. This should switch everything for the model from the left hand side to ...