Questions tagged [shading]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
38 views

Ray tracing of a diffuse material sphere doesn't work, the sphere just shades black

I made this ray tracer in javascript to run on html with imageData. I have been using the book "Ray Tracing in One Weekend" as a reference (https://raytracing.github.io/books/...
user avatar
1 vote
1 answer
71 views

OpenGL old-style diffuse shading producing unexpected effects

Question: What is going wrong with the shape of the contours of constant illumination in the below picture ? Detail: Although Lambertian shading might be ill-regarded because it exposes the hard edges ...
user avatar
  • 177
2 votes
1 answer
124 views

Specular reflection with different viewing direction where reflection direction and viewing direction coincide

Suppose $P_1$ and $P_2$ two different points on surface. And let $l$: be the light source direction, $n$: normal vector $r$: specular reflection direction $v$: viewing direction . In case 1 (at $P_1$...
user avatar
1 vote
2 answers
86 views

Is it possible to change pixel brightness programmatically?

So, I've been learning 3D rendering for more than a year now, and I've read a lot about various rendering techniques and theories, such as PBR, deferred shading, real-time raytracing, BRDF, all that ...
user avatar
1 vote
1 answer
63 views

Help understanding tangent from dot product and max distance from component wise vector multiplication

I am looking through this code and seeing two things which confuse me (well, the whole functions does) in the top functions. First, dir * p where ...
user avatar
0 votes
0 answers
56 views

Dark line artifact along edges of the shaded mesh

I have implemented an algorithm to calculate vertex normals by taking the normalized average of all its adjacent triangles. I have subdivided a cube two times with catmull clark and checked the ...
user avatar
0 votes
2 answers
213 views

Gouraud Shading interpolates color across a triangle using vertex normals. Phong Shading interpolates normals. How are their end-results different?

I am struggling to understand as to why fundamentally triangles shaded through Gouraud shading and ones shaded through Phong shading look different. From my understanding, Gouraud Shading, takes the ...
user avatar
  • 155
2 votes
1 answer
140 views

How exactly does Gouraud shading apply color across a polygon? Does it do it by pixel or is it some other method?

I'm a super beginner to GFX. So far I've learned about 3 shading models when rendering meshes The first is Flat Shading. I seem to understand this, from my understanding, you take the normal of the ...
user avatar
  • 155
0 votes
2 answers
349 views

How to calculate vertex normals on a mesh with non-planar polygons

If I have a mesh consisting of polygons that are not necessarily triangles and not necessarily planar. As answered in the previous question I asked, there's no correct answer to calculating normals ...
user avatar
1 vote
1 answer
84 views

Why do 3d modeling packages use a single normal per polygon and how is this viable for smooth shading

If we have a quad that is non-planar. Why do most 3d modeling packages choose to use a single normal for the quad (Specifically for Blender3d by using cross product of two edge's vectors that do not ...
user avatar
2 votes
1 answer
53 views

Determining the function of a radial gradient fill with midpoint

Recently I have been trying to create a shader that imitates a shader within Affinity Photo. It is used in the radial gradient fill and essentially you set your endpoint colors and then set the ...
user avatar
  • 143
0 votes
1 answer
83 views

What effects are used to light this scene?

I am interested how that image on the right of the slider (just albedo) can produce such a realistic looking scene as the scene on the left. What effects (at a minimum) does this scene seem to be ...
user avatar
0 votes
0 answers
82 views

Help me understand the derivation of this tangent space to object space matrix

I was trying to follow this http://foundationsofgameenginedev.com/FGED2-sample.pdf But had problem understanding formula 7.33. $$p_i-p_j=(u_i-u_j)\mathrm{t}+(v_i-v_j)\mathrm{b}$$ * $p_i,p_j$ being ...
user avatar
  • 111
0 votes
1 answer
95 views

Stylized math like rendering?

How can I render plots and graphics that mimic how mathematicians draw diagrams? For example Look at this shirt: The diagrams represent 2D and 3D shapes, however they have characteristics of human ...
user avatar
  • 1,447
0 votes
0 answers
26 views

Changing shader color

I have the following .fx file for my shader: ...
user avatar
0 votes
2 answers
158 views

Lambertian shading illuminates all the front of a sphere

I've sucessfully implemented a ray tracer from scratch in C and it's marvelous: The surface normal on this sphere is taken by computing the intersection point, A, and treating this as a euclidean ...
user avatar
0 votes
1 answer
226 views

Phong model: why no multiplication by N dot L in specular term?

Classical Phong reflection model, as described on wikipedia, computes diffuse and specular light as follows: ...
user avatar
  • 3
1 vote
1 answer
279 views

OpenGL Render front and back faces with different shading for 3d modeller

I'm working on a simple 3d modeller and I would like to render the back facing triangles a bit darker, to easier differentiate between front and back faces. Like you can see in most modelling ...
user avatar
1 vote
1 answer
64 views

Do we have OpenGL shaders write out the intermediate *.o-esque file on first compile so that we can skip compiling them in run-time every single time?

Shaders get compiled during runtime every single time an app starts. I understand the reasoning for this is that there are so many GPU architectures out there that it does not make sense to ship pre-...
user avatar
  • 113
0 votes
1 answer
303 views

How to read illum value from mtl file using Assimp library?

I am loading an OBJ file using the ASSIMP library. Following is the MTL file associated with the obj file. ...
user avatar
2 votes
1 answer
65 views

Point light illuminating only half of a scene

A point light is illuminating only a half of a scene in my small 3D renderer. It happens on every scene I've tried (conference room, cornell box, etc). How do I go about debugging this? What could ...
user avatar
3 votes
0 answers
111 views

Irradiance field approximation with black probes

I'm posting here after some time searching the Internet and reading presentations and papers, to find out the best options to solve the problem I have. I'm implementing irradiance field with ...
user avatar
  • 31
2 votes
1 answer
554 views

Difference betwen Rendering Equation, Lighting model, Ray Tracing, Global Illumination and Shadows?

What is the difference between all these techniques? I know what a lightning model does, eg Phong, Flat, Gouraud. As far as I know both Ray Tracing and Global Illumination are just lighting models ...
user avatar
  • 145
3 votes
1 answer
90 views

What's the justification of multiplying colors together?

In Phong shading model (and other shading models as well), the light color is multiplied together with the surface color component-wise. I want to know the justification for this. Is this some what ...
user avatar
  • 131
1 vote
1 answer
911 views

What is the algorithm used for phong shading normal interpolation?

Let's suppose we have an object consisting of only 3d points, and triangle faces that each take a subset of these 3d points. How can I interpolate the normal vectors to get that Phong smooth shading? ...
user avatar
  • 284
0 votes
0 answers
1k views

Color shading and light calculation for ray tracing

I am currently building a ray tracer and I came across a problem and confusion regarding the light calculations. For lighting, I am using the following mathematical model: Where ...
user avatar
4 votes
1 answer
91 views

How to approximate the heightmap of processed wood?

In the above image, you can see that there is some slight variation of the height of each wood plank. These variations do NOT come from the wood texture itself, but from the way it was cut, i.e if a ...
user avatar
  • 1,447
1 vote
2 answers
306 views

How are colors really mixed?

I'm kind of stuck on this one. When following a conventional, high-level shading tutorial, you'll come across these images that are like ambient + diffuse + specular = result, but I can tell that it's ...
user avatar
  • 284
5 votes
0 answers
222 views

Why is Forward Rendering/Shading named this way?

Forward rendering is the 'classic' approach to the rendering pipeline. Nowadays it is mostly replaced by a more flexible, deferred rendering approach. I did some research and had trouble finding ...
user avatar
  • 151
2 votes
2 answers
250 views

Physically Based Shading for Diffuse surfaces

So I am currently in the process of implementing Physically based Shading in my pathtracer using microfacet models and I'm quite stuck at comprehending light interaction with diffuse surfaces. First ...
user avatar
3 votes
1 answer
2k views

How is lighting done in Rasterization based pipeline?

So I wanted to know how do Game Engines like Unity3D and Unreal do lighting. I'm familiar with Ray-tracing, pathtracing based renderers etc. But not much with rasterization based engines. I do know a ...
user avatar
2 votes
2 answers
2k views

3ds max: Z-fighting when working with Large Objects

I had a z-fighting/z-clipping issue with a scene containing some very large objects yesterday in 3ds max. It can be seen in the image below: For some reason downscaling the scene significantly (a ...
user avatar
3 votes
1 answer
348 views

Smooth shading on sphere approximation

In what way is a "cheat" when using smooth shading on a sphere approximation? I'm not understanding how it's a cheat to use smooth shading on this? Other questions that are lead after this may be: ...
user avatar
  • 171
0 votes
1 answer
257 views

How are normals assigned to vertices in different types of shading?

I'm new to this forum and topic but wanted to figure out specifically how are normals assigned to vertices in flat shading, gouraud shading, and phong shading? Is there a difference between any?
user avatar
  • 171
6 votes
1 answer
191 views

"Artist Friendly Metallic Fresnel" reversible?

While implementing the "Artist Friendly Metallic Fresnel" paper by Ole Gulbrandsen (http://jcgt.org/published/0003/04/03/paper.pdf), I read that it is fully reversible: (section 2.3.2): for all r,g ...
user avatar
  • 138
1 vote
1 answer
645 views

Project vertex onto plane

What I have: a plane given by its normal$\ n $ and a point on the plane$\ p $. a 3D-point$\ v $. a direction$\ d$. What I need: the projection of$\ v$ along$\ d$ onto the plane. How can I ...
user avatar
4 votes
1 answer
2k views

How to compute normal of surface from implicit equation for ray-marching?

I want to represent ovaloids with ray-marching. I have ovaloids defined with an implicit equation. For instance, we can consider the equation of an ellipsoid given as: $$ \frac{x^2}{a^2} + \frac{y^2}...
user avatar
  • 143
6 votes
2 answers
394 views

PBR missing rim darkening on non metallic rough surfaces

If you have a dielectric (non metallic) sphere with a large roughness value (say, 0.95), and put it in a lighting environment that has a constant onmidirectional lighting value (such as 0.5) Cook-...
user avatar
  • 7,331
1 vote
1 answer
84 views

What does "region to be shaded" mean in the PCF paper?

I am reading the percentage closer filtering (PCF) paper by Reeves, W. et al. (https://graphics.pixar.com/library/ShadowMaps/paper.pdf). At at section 3.2, it mentioned that "each shading calculation ...
user avatar
  • 405
0 votes
1 answer
513 views

How to use shadow mapping and deferred rendering to create a large amount of lights?

Ok so I am trying to understand how to combine these 2 techniques and I am failing. The main goal is to reach the O(lights+fragments) complexity of deferred rendering, instead of O(lights*fragments) ...
user avatar
  • 1,447
2 votes
0 answers
83 views

How can you efficiently get the last element occluding light when rendering shadows?

A long time ago I made an application that used volumetric rendering and I developed some shadowing equations that I felt very happy with, since they have pretty good results. For these equations to ...
user avatar
  • 1,447
3 votes
2 answers
247 views

Inconsistent shading in pathtraced image

I am currently building a pathtracer, which has support for vertex normals and face normals. There seems to be an issue when it comes to rendering objects with triangles exported from Blender. ...
user avatar
2 votes
1 answer
514 views

Combine material coefficients and textures in Phong Shading

I'm trying to implement a simple Phong shader that supports non-physically-based materials and textures. Even though the material has a texture for each light component I still want the respective ...
user avatar
6 votes
1 answer
1k views

Microfacet shading for diffuse materials

I recently replaced the Lambertian BRDF in my path-tracer with Oren-Nayar, under the assumption that I could adjust it to use the GGX distribution model with appropriate masking/shadowing. PBR ...
user avatar
3 votes
1 answer
149 views

Paper for the approximation formula provided by Brian Karis

In these slides, specifically page 11, the following formula is reported: $$ \frac{1}{N} \sum_{k=1}^N \frac{L_i(l_k)f(l_k,v)\cos(\theta_{l_k})}{p(l_k,v)} \approx \left( \frac{1}{N} \sum_{k=1}^N L_i(...
user avatar
1 vote
1 answer
361 views

Light coordinate in Phong shading and Normal interpolation

I'm currently making a small 3D renderer and I got stuck in Phong shading. My questions are: Into which space should the light coordinate be converted? I have my light position at world coordinates (...
user avatar
3 votes
1 answer
2k views

How to dynamically calculate texture coordinates in a vertex shader with OpenGL?

I modified my code, and tried to pass a set of integers specifying the face of a cube (top, bottom left...) to the vertex shader in order to draw multiple instances of a cube face. I did this by ...
user avatar
  • 1,447
1 vote
0 answers
67 views

General interpolation practices

Say my animation scenario contains one mesh interpolating into another (possibly approximating over other meshes), using Bezier curves. I know that for smooth surfaces, where normals can be ...
user avatar
2 votes
0 answers
101 views

Interpolating normals during animation

I'm doing linear tweening of a cyllinder to a cone of equal radius and height in OpenGL. I know parametric equations of both of them, so I derived vertex normals accordingly. Now, I know, that proper ...
user avatar
6 votes
1 answer
2k views

What's the difference between geometric surface normal and shading surface normal?

In my opinion, geometric surface normal is the cross product of triangle edge vectors, and shading surface normal is the interpolation of the predefined normals at the three vertexes. I used Mitsuba ...
user avatar
  • 551