Questions tagged [c++]

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

50 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
0 answers
733 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 ...
Florian Schut's user avatar
5 votes
0 answers
385 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 ...
Michal Kučera's user avatar
5 votes
0 answers
360 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 ...
Darkilon's user avatar
4 votes
0 answers
1k 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: ...
Sayan Pal's user avatar
  • 263
3 votes
0 answers
165 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 ...
DirectX_Programmer's user avatar
3 votes
0 answers
821 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 ...
jinglei's user avatar
  • 293
3 votes
0 answers
559 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 ...
Aloof's user avatar
  • 31
2 votes
0 answers
82 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 ...
user10037795's user avatar
2 votes
0 answers
68 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 ...
Thomas's user avatar
  • 1,198
2 votes
0 answers
159 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)}{...
Peter's user avatar
  • 21
2 votes
0 answers
39 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 ...
Mohbenay's user avatar
  • 131
2 votes
0 answers
622 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? ...
user8469759's user avatar
2 votes
0 answers
150 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 ...
Raph Schim's user avatar
1 vote
1 answer
82 views

Vulkan Syscalls

I'm working on educating myself more about computer graphics, and the more I learn and play with the technology, the more I get frustrated by the dependencies on C++ (even though I know why it exists)....
Sienna's user avatar
  • 111
1 vote
0 answers
70 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 ...
andre_lamothe's user avatar
1 vote
0 answers
78 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)...
Ave Milia's user avatar
  • 121
1 vote
2 answers
656 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
1 vote
0 answers
213 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 ...
JerSci's user avatar
  • 11
1 vote
0 answers
70 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 ...
Clutterhead's user avatar
1 vote
0 answers
42 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 ...
entropy283's user avatar
1 vote
0 answers
60 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. ...
richard_ba's user avatar
1 vote
0 answers
99 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: ...
Makogan's user avatar
  • 1,696
1 vote
0 answers
117 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 ...
Maria's user avatar
  • 11
1 vote
0 answers
1k 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 <...
Test's user avatar
  • 31
1 vote
0 answers
123 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 ...
S.E.K.'s user avatar
  • 141
0 votes
1 answer
50 views

Vulkan memcpy from image works, but memcpy to image not working

Using Vulkan, I am reading from an image to a vector of unsigned char. It works great. ...
shawn_halayka's user avatar
0 votes
0 answers
62 views

What performance to expect from an optimised pathtracer?

I am currently writing a fairly basic pathtracer as a compute shader in C++/CUDA, which has been running on a GTX 1080, and I have noticed that when logging some statistics, I get around ~1 billion ...
Jack Freeth's user avatar
0 votes
0 answers
126 views

Path tracer -- How to debug erroneous behaviour?

Edit: I've pinpointed the problem. If I change: local_colour *= (rayPayload.color.r*mask.r + rayPayload.color.g*mask.g + rayPayload.color.b*mask.b); into ...
shawn_halayka's user avatar
0 votes
0 answers
212 views

Vulkan backward-only path tracer with caustics

TL;DR -- who has discovered, in the past, a backward-only path tracer that generates caustics not needing extra convergence of any kind? I'm collecting similar algorithms, in order to fully understand ...
shawn_halayka's user avatar
0 votes
1 answer
80 views

Triangle Rasterization Shaking Issues

I am making a Software renderer, and I noticed that there is a screen shaking like effect happening. shown in the first video: I tried doing filling without clipping against the small square, and the ...
Serilena's user avatar
0 votes
0 answers
63 views

How would you represent a mesh with tris and quads?

My understanding is that, while subdivision algorithms like Catmull-Clark can work for any polygonal mesh (including triangles) it's preferable to start with a quad mesh. Currently my rendering engine ...
Chris Gnam's user avatar
0 votes
0 answers
36 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:...
Forprix's user avatar
0 votes
0 answers
78 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 ...
Jimmy Yang's user avatar
0 votes
0 answers
93 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: ...
Makogan's user avatar
  • 1,696
0 votes
1 answer
107 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? ...
R34P3R76's user avatar
0 votes
0 answers
71 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 ...
Dodeca's user avatar
  • 1
0 votes
0 answers
73 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: ...
H3XXX's user avatar
  • 115
0 votes
0 answers
352 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 ...
Flone's user avatar
  • 1
0 votes
0 answers
48 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 ...
Amir's user avatar
  • 241
0 votes
0 answers
831 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 ...
MasterReDWinD's user avatar
0 votes
0 answers
114 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 ...
Clutterhead's user avatar
0 votes
0 answers
344 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 ...
E.s's user avatar
  • 9
0 votes
0 answers
66 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).
Priyank's user avatar
0 votes
0 answers
121 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 ...
Makogan's user avatar
  • 1,696
0 votes
0 answers
127 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 ...
Tajuddin Khandaker's user avatar
0 votes
0 answers
225 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 ...
user11799's user avatar
0 votes
0 answers
263 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 ...
Vinayak Thube's user avatar
0 votes
0 answers
51 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 ...
Makogan's user avatar
  • 1,696
0 votes
0 answers
982 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 ...
VersesDev's user avatar
  • 129
0 votes
0 answers
133 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 ...
user2108's user avatar