Questions tagged [phong]

Phong shading is a 3D lighting model and interpolation method used in OpenGL and other 3D APIs.

Phong shading is an interpolation technique.
Phong reflection model s an empirical model of the local illumination of points on a surface.

101 questions
12
votes
2 answers

Phong shading for shiny Python 3D surface plots

I'm trying to create aesthetically pleasing 3D plots in Python with specular shading, and thus far have tried using both Matplotlib with 3D axes and surface plots from Mayavi, e.g., from the Mayavi surf examples web page: The results look good, and…
NewPythonUsers1
  • 141
  • 1
  • 3
7
votes
3 answers

Bad lighting using Phong Method

I'm trying to make a cube, which is irregularly triangulated, but virtually coplanar, shade correctly. Here is the current result I have: With wireframe: Normals calculated in my program: Normals calculated by meshlabjs.net: The lighting works…
Alexandre Severino
  • 1,563
  • 1
  • 16
  • 38
6
votes
1 answer

Concentration of potentially active microfacets in a Normal Distribution Function

I'm trying to understand the Cook-Torrance Microfacet Model and am currently stuck on the Normal Distribution function D (being either Beckmann, Blinn-Phong or GGX). Several online resources claim that D is the fraction of microfacets normals M that…
5
votes
2 answers

Specular lighting appears on both eye-facing and rear sides of object

I am writing a small test of Phong shading, and am hitting my head against a brick wall trying to get the specular component working. It appears to work correctly, except that the specular light is applied to both the front & rear of the object.…
ASpence
  • 61
  • 1
  • 6
4
votes
0 answers

OpenGL gamma correction with GL_FRAMEBUFFER_SRGB

I am writing a Blinn Phong (LearnOpenGL tutorial) lighting and trying to get gamma corrected colors as final result. Before i start digging about gamma correction, my lighting looks like this: Then i spend all day reading about sRgb colorspace, and…
yuris89
  • 63
  • 4
4
votes
0 answers

Box Scaling in JavaFX 3D improperly reflects light

My goal is to reproduce a gif in JavaFX. Everything is great, except for when changing so many box heights at once, it slows the machine down. I have decided to remedy this by scaling by the y axis instead of altering the height so they can be…
4
votes
1 answer

How to interpolate normals for Phong shading in OpenGL?

Currently, I am implementing good old Phong shading. Overall it looks quite right but there is a pattern in the normals emerging, that I cannot explain. Without a closer look, the Stanford Bunny looks quite correct, I think. But on the ears for…
Henkk
  • 609
  • 6
  • 18
4
votes
1 answer

Raytracing Shadows

So, I read about raytracing on the net and started writing a Raytracer from scratch in my spare time. I'm using C++, which I've been learning for about a month now. I have read up on the theory of raytracing on the net and so far its working quite…
Koto
  • 506
  • 2
  • 4
  • 15
3
votes
1 answer

How do I combine Phong lighting with Fresnel dielectric reflection/transmission realistically?

UPDATE: I answered my own question about what illumination model to use, but now I need to know how to calculate the Fresnel terms for reflected and transmitted rays. I have a partially-implemented C++ ray tracer. Right now Phong lighting with…
Remy
  • 401
  • 2
  • 19
3
votes
3 answers

Something with raytracing that has gone wrong

I'm trying to do a simple ray tracing assignment, in c# (ported from python). I've managed to make the sample code show the correct picture, but when I try and adapt it to my assignment something goes wrong. If I knew what was going wrong I would…
Meeces2911
  • 31
  • 2
3
votes
1 answer

What is the difference between Phong Shading and Gouraud Shading?

As I understand it, Gouraud shading calculates light color for each vertex and does interpolation on that color, whereas Phong shading interpolates the normal for each pixel and calculates light color based on that interpolated value. However, when…
v4vendeta
  • 43
  • 1
  • 5
3
votes
2 answers

Artifacts with phong shading and ray-tracing

I am currently experimenting different artifacts when implementing phong shading on my ray-tracer. The first case case happens when I implement the specular lighting calculation the way I suppose to be right: adding the contributions of the light…
user2752471
  • 444
  • 1
  • 6
  • 14
3
votes
1 answer

blinn-phong shading with numpy

I am trying to implement blinn-phong shading in numpy for educational purposes. However I am stuck at debugging what parameters are doing for several days now. My general idea was the following. Since the equation was given for a channel. I apply…
Kaan E.
  • 515
  • 4
  • 16
3
votes
1 answer

ThreeJS shaders in Unity

I'm working on a project in Unity that uses AR to place products in the real world. These products (geometry & material) are downloaded from a http server and converted into a gameobject in Unity. These products are originally created in ThreeJS…
Tostifrosti
  • 143
  • 9
3
votes
1 answer

how to light an object, phong model

I am trying to figure out how to scale a color with the lighting illumination using the phong model. For example given I = KaAx, where ka is the ambient coefficient and Ax is the ambient lighting intensity where x can be r b or g, I want to apply…
Jake
  • 2,877
  • 8
  • 43
  • 62
1
2 3 4 5 6 7