Questions tagged [c++]

General-purpose programming language used widely in game development and CPU-intensive tasks.

49 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
0 answers
603 views

How to account for self intersection with large ray tracing scenes?

I'm working on a hybrid real time ray tracing project and trying to tackle the problem of self-intersection with larger scenes due to loss of float accuracy. The logic I'm trying to use is based on ...
5 votes
0 answers
333 views

Computation of conservative AABB for clipped triangle

I'm currently trying to implement a fast algorithm for KD-Tree construction using SAH, as described in this paper: On building fast KD-trees for ray tracing, and on doing that in O(N log N) I found ...
4 votes
0 answers
348 views

Incorrect instanced rendering

Previously, to render a bunch of quads, I was simply using a few uniforms (one for a model matrix and another for the texture layer ID). However, I'd rather not have to loop through each quad and set ...
3 votes
0 answers
119 views

Global root signature crash

I have a problem with RTPSO creation. Using local root signatures for each of rgs (ray generation shader), chs (closest hit), miss is working correctly. However, for performance sake, I want to use ...
3 votes
0 answers
705 views

ray-triangle intersection precision - c++

I'm building a software renderer but I think there might be some problem with my ray-triangle intersection accuracy. I implemented the algorithm referring to ...
  • 293
3 votes
0 answers
528 views

Problem with specular BRDF (Monte Carlo & Path Tracing)

Above on the left is my attempt and on the right is what I'm aiming for.As you can see my sphere with the specular brdf has a weird dark ring In my radiance function I am recursing through the ...
  • 31
3 votes
0 answers
960 views

Represent vector with arrow

Another code review question. I am trying to draw an arrow to represent a vector. I have started with an unit arrow with vertices defined as follows: ...
  • 243
2 votes
0 answers
78 views

Atmospheric scattering band/seperation artifact

I am currently experimenting with some atmospheric scattering in glsl in my OpenGL engine. I am experiencing a strange phenomena where a strange band / separation artifact appears along the middle of ...
2 votes
0 answers
47 views

multiple Quaternion slerp inverse to calculate relative coordinates

I am creating a 3D spherical curved display (only a part of a sphere). The camera usually is inside of this sphere. This display has texture coordinates. The image below shows the display with its ...
  • 586
2 votes
0 answers
555 views

HalfEdge data structure in openmesh, create_face function explanation

Does anyone have experience with open-mesh or computational geometry and can kindly explain what exactly happens in the function below? ...
2 votes
0 answers
141 views

Image Laplacian incomprehension

I am reading and trying to implement a research paper. It uses openGL to define which part of an image to use in order to reconstitute a big image composited of several images. In order to do so, I ...
1 vote
0 answers
42 views

parallelizing a software rasterizer algorithm using opencl

I've written a small software rasterizer using OpenCL and would like to optimize and parallelize it more, currently I'm scanning the whole screen and see if the triangle overlaps with the pixels.. I ...
1 vote
0 answers
61 views

Perlin noise is mysteriously ignored when the pattern is rotated 45 degrees

I am creating different coloring patterns for my CPU raytracer, such as checker, gradient, ring, stripe pattern etc. The problems started when I tried to create a perturbation pattern (of a subpattern)...
  • 121
1 vote
0 answers
128 views

What is the projection matrix of reverse (Byzantine) perspective?

I would like to construct a projection matrix for reverse perspective. I'm using OpenGL and tried to modify concepts from this excelent tutorial. I came up with: $$ \begin{bmatrix} 2\frac{(near-M)}{...
  • 11
1 vote
0 answers
133 views

How do I produce a metallic surface in ray tracing?

I can't manage to produce a metallic looking sphere despite trying many things. I have the basics working, i.e shadows, refraction etc. but I'm not sure what combination of these will allow me to ...
  • 11
1 vote
0 answers
62 views

Implementing the derivation of the Smith Shadowing function for arbitrary distributions

I'm trying to implement the derivation of the masking function G_1 by Smith. The appendix of Walter et al 1, Hammons presentation 2 and this research paper 3 talk in detail about it and I feel as I do ...
1 vote
0 answers
29 views

Projecting a point on a Freefrom surface

My first issue is getting a set of planes and a set of points as input, an find the projection of the those points on the nearest plane. That was pretty easy, where i just calculate the normal of the ...
  • 121
1 vote
0 answers
39 views

Mitsuba builds targets with scons but throws "undefined symbol" error when trying to render scene

I am trying to implement a custom add-on for Mitsuba, but when I use the Heightfield I have defined in another function call(WaveBrdfAccel) in main.cpp it compiles without any problems but when I try ...
1 vote
0 answers
52 views

Help with efficient quadtree vertices indexing to avoid redundancy

I am creating a quad tree from ground zero, because I am going to collapse it from bottom up I am refining it with a certain LoD level. I am using glm for mathematics and opengl for rendering. ...
1 vote
0 answers
70 views

Handling varying texture sizes in an array texture

Say we've idetified that we have a varying number of textures that are upper capped by 2 parametrs. thus we allocate the maximum amount of memory needed to store all textures as follows: ...
  • 1,518
1 vote
0 answers
113 views

Adding Ozone to my sky simulation

I implemented a simulation for the colour of the sky a while ago by following the scratch a pixel tutorial: https://www.scratchapixel.com/lessons/procedural-generation-virtual-worlds/simulating-sky I ...
  • 11
1 vote
0 answers
901 views

360 degrees rotation around x axis

How do we rotate the camera around x axis 360 degrees, without having to flip the axis, meaning without having the strange flip after we go over +-90 degrees on <...
  • 31
0 votes
0 answers
11 views

Get Z/depth buffer from GPU for any (most) games

I would like to get a depth buffer from a running game on my GPU. I don't even know where to start with this, or if it is possible at all, which is why i need some input and am hoping someone can ...
  • 1
0 votes
0 answers
16 views

Mesh operations using lasso and uniform sampling

In mesh mixer, I can draw a lasso the mesh, let's say it's a spline. I want to 1. draw on selected area 2. uniformly sample the vertices inside that region, and extract their faces/vertices as a patch....
0 votes
0 answers
30 views

Screen space to texture space transformation

I've built a deferred renderer that is able to do deferred decals, now I want to be able to bake that into textures. I have a texture (so screen space) that holds a deferred screen space decal that ...
0 votes
0 answers
33 views

show different texture in the rectangular block in a grid

I am trying to do a probabilistic simulation on a 20X20 grid. The simulation will generate numbers say 2, 3 or 4 and grid location say [5][4]. I will convert the ...
0 votes
0 answers
32 views

How do I make "attribute vec0.5" in GLSL. Sorry if it confuses

Is it possible, in OpenGL (specifically in WebGL), to use a single value from buffer for multiple shader iterations? Like to put the same element from buffer into shader attribute multiple times? Like:...
0 votes
0 answers
50 views

How to make sure that triangles share edges (also not overlap each other) when rendering a quadrilateral?

Here is my simple scanline-based triangle rasterizer using pure integer arithmetic. I adapted the code from this Stack Overflow answer The below code attempts to render a coloured quadrilateral by ...
0 votes
0 answers
38 views

Improving dual contouring convergence

I have my own implementation of dual contouring. Right now I am getting the following output: This is decent, but I am trying to get a better result (i.e. try to reduce the low level voxel noise as ...
  • 1,518
0 votes
0 answers
70 views

How to delete a face using open mesh?

Pretty much the title I am trying to delete a few faces of a mesh using open mesh, like this: ...
  • 1,518
0 votes
1 answer
60 views

Question about using glVertexAttribArray

After defining an attribute pointer, why can't I just reuse it? I have a VAO bound so shouldn't it just accept the AttributePointer I defined with the last VAO? ...
0 votes
0 answers
58 views

ray triangle mesh intersection triangles inverted

I'm trying to render a dodecahedron triangle mesh and the triangles seem flipped or mirrored somehow. The first picture is what I should be getting, the second picture is what I'm getting and the last ...
  • 1
0 votes
0 answers
50 views

16 bit SNORM format not correctly storing Z component?

I generate a normal GBuffer in my engine, and I store it using a R16G16B16A16_SNORM format like this: ...
  • 115
0 votes
0 answers
205 views

Weird PIX behavior with DXC

Recently I've switched from FXC to DXC to compile shader model 6.0. It compiles well without errors (and runs well) but I can't debug shaders because on my netbook PIX says "failed to load PDB ...
  • 1
0 votes
0 answers
44 views

Under what conditions does a mesh operation cause the mesh become non-manifold and how to avoid it?

I'm implementing some mesh operations (e.g. edge collapse, edge split, edge flip etc) and need to ensure applying such operations does not cause the mesh to become non-manifold. However, I'm not sure ...
  • 241
0 votes
0 answers
284 views

Using multiple textures in a shader

Background: I am extracting the textures for a model with Assimp and sampling those textures in the fragment shader. I have multiple uniform sampler2D textureN ...
0 votes
2 answers
296 views

Efficiently transferring only needed parts of the vertex data to the GPU (C++/OpenGL)

I have a situation, where I have an array of vertices on the CPU side, for which, besides rendering-relevant data, like their position, I have a lot of other data at each vertex. All vertex data is ...
user avatar
0 votes
0 answers
124 views

How to deallocate memory for vertex buffer objects

I have a class that handles loading buffers for a mesh: ...
0 votes
0 answers
75 views

Different OpenGL behaviour on Windows and Ubuntu

While porting this project with slightly modified code to Linux I ran into some weird behaviour. On Windows it runs just fine (https://youtu.be/xH6Dc6xOuow). But on Ubuntu it shows some weird ...
0 votes
0 answers
214 views

Queue from a family queue that supports presentation doesn't work [Vulkan]

I'm following this tutorial on Vulkan and I tried to see if it actually worked with different queues for drawing and presenting the image of the triangle. My GPU supports presentation with every queue ...
  • 9
0 votes
0 answers
53 views

Write CPP program, DFA and NFA diagram for DFA accepting string with length 5 and starting at 0 , ending at 1 input(0, 1)

I am having trouble in making this program and DFA:- Write CPP program, DFA and NFA diagram for DFA accepting string with length 5 and starting at 0 , ending at 1 input(0, 1).
0 votes
0 answers
58 views

Loop subdivision, certain areas converging towards degenerate geometry

I coded loop subdivision and ran it on a cube with triangle faces. I noticed this: I am using doubles to represent my vertex positions, I am not 100% sure these are caused by floating point ...
  • 1,518
0 votes
0 answers
82 views

void* D3D11_MAPPED_SUBRESOURCE::pData to OLE_COLOR* possible?

I have found the following from this link enter link description here pData Type: void* Pointer to the data. When ID3D11DeviceContext::Map provides the pointer, the runtime ensures that ...
0 votes
0 answers
190 views

Non linear transformation of vector graphic

I want to do a non-linear transformation of a svg in python. My specific problem is to transform a rectangular svg image into a frustum like image, for which i have a mathematical equation of the form ...
0 votes
0 answers
157 views

After making any 3D model using Opengl how to export it's data in .dae file?

I'm trying to make simple 3d modeling program in c++ with Opengl. So I don't know how to transfer/convert/export or save data of 3D model in .dae file. NOTE:- 3d model is made using Opengl ...
0 votes
0 answers
50 views

How to ensure that the raytrcing coordinate system is teh same as the projection one?

I have 2 shading models right now, one is using voxels the other one is the standard projection absed renderization method. Putting them side by side I have noticed that no matter what I do one is ...
  • 1,518
0 votes
0 answers
907 views

How to properly release directx com objects

This one I am not getting even one bit. I started learning directx11 and using the basic dx initialization i tried a experiment by allowing an option to destroy the window and creating it again ...
0 votes
0 answers
131 views

Finding Segments in Continuous line

I'm trying to break a continuous line segment into multiple, straight segments. I've tried using the Hough transform but have found it unreliable for getting the line segments I'm looking for and ...
0 votes
0 answers
113 views

Selecting pixels within a circle having a decimal (non integer) radius

I want to select a pixel within a circle of a certain radius. But the radius is expressed in a decimal form (0.12). What does it mean to have a radius equal to 0.12? And concretely how to pick a pixel ...
  • 111