Most Popular

1500 questions
5
votes
1 answer

Correct post-displacement normal calculation (Y-component and epsilon)

I often use a 2D Perlin noise texture to displace a grid in the vertex shader (e.g. terrain, ocean). However, every time I google the method to calculate post-displacement normals there is a slight difference. For example, the value to place in…
user3412
5
votes
2 answers

Where do the coefficients in the Catmull-Clark subdivision algorithm come from?

I'm learning about subdivision surface algorithms. The "Catmull-Clark" algorithm seems to be one of the most widely-used classical algorithms. The introduction of new face points and edges is straightforward, but I'm confused by the following…
eigenchris
  • 191
  • 7
5
votes
1 answer

Artifacts when gamma correcting

Doing post-process gamma correction is showing texture artifacts, here is a small example on a skybox: The first image is gamma correcting on the skybox shader and seems correct, the lower is doing it in post-process and has terrible artifacts near…
V.M.
  • 53
  • 3
5
votes
2 answers

Refraction in a Ray Tracer: What do with an intersection within the medium?

I am currently following a tutorial at Scratchapixel.com on refraction Here is the refract function: Vec3f refract(const Vec3f &I, const Vec3f &N, const float &ior) { float cosi = clamp(-1, 1, dotProduct(I, N)); float etai = 1, etat =…
Arjan Singh
  • 2,511
  • 3
  • 22
  • 38
5
votes
1 answer

How to convert decomposed transformations between different coordinate systems?

I am converting some Unity3D scenes to a proprietary json format to be used by my OpenGL renderer that uses a different coordinate system from Unity's. I have multiple sets of {translation, rotation(quat), scale} pairs that describe some node…
Fr0stBit
  • 101
  • 2
5
votes
1 answer

Trying to understand environmental cubemaps

I am trying to implement a physically based renderer, in OpenGL. I was planning to implement the Cook-Torrance BRDF. I read about radiance cubemaps (for reflections), like the one discussed here, for example. I a bit confused however. My test…
MKII
  • 153
  • 4
5
votes
1 answer

How do double-buffers work in opengl?

As I understand, the back-buffer is used for rendering the image while the front-buffer is drawn on the screen. So if you have only one image to be drawn on the screen, then you only need to swap the buffers one time because in the second swap the…
Adrian
  • 667
  • 8
  • 17
5
votes
2 answers

Get screen size and then resize image accordingly

I'm a programmer working in Java and I'm not sure if this is the right place to ask this kind of question, here it goes: In my program, I need to show an image (.jpeg .png etc.) based on the screen size, this image is used to compare to real size…
4673_j
  • 151
  • 3
5
votes
1 answer

Modern way of light sources in OpenGL?

In older versions of OpenGL there were things like: glLight(...) gl_LightSourceParameters The modern way of doing lighting is passing light source parameters manually to the shader in vao-s? Or uniforms? Why are these things decrepated? And if I…
Tudvari
  • 313
  • 1
  • 3
  • 13
5
votes
1 answer

Do GPU performance improve when rendering at native or half resolution, compared to fixed scaling?

This might be an odd question, but I was wondering if you could improve GPU performance with games, comparatively, when using doubles/halves of the native resolution, instead of an odd ratio of that. Lets compare the situation with a metaphor first.…
5
votes
1 answer

OpenGL VertexArray Data "Retention"?

After calling glVertexAttribPointer to associate data of the currently bound vertex array with data from the currently bound GL_ARRAY_BUFFER, I mentioned that I can simply delete the used buffer without it affecting the rendering. What actually…
salbeira
  • 303
  • 1
  • 5
5
votes
1 answer

Binary scene voxelization using imageStore - problem

This problem has been haunting me for some time but I was busy with other things. I can't finish my GI technique (specifically occlusion step) without solving it. I made a binary scene voxelization in a single pass. The result is stored in a…
mdkdy
  • 2,169
  • 1
  • 12
  • 19
5
votes
0 answers

Percentage-closer Soft Shadows implementation

I am trying to implement the Percentage-closer Soft Shadows (PCSS) from NVidia inside Unity but I am facing some issue and I don't know where they come from and then, I do not know how to solve them... Here is my current setup. I am using an…
MaT
  • 1,229
  • 10
  • 21
5
votes
2 answers

What is the correct way to put different textures on different parts of an object?

I tried passing a variable from the vertex shader to tell the fragment shader whether or not I wanted part of an object textured. That way I could write another shader for the other parts of the object. Unfortunately, what I have creates the…
5
votes
2 answers

Rotating object around its own center

I am trying to implement Blades of Waving Grass and I am still stuck at the point where I need to achieve texture arrangements like in the figure below (the first one). So my plan is to draw the first texture, then draw the second and rotate it by…
チーズパン
  • 27
  • 2
  • 14