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
0
votes
1 answer

Got weird lighting result based on Phong model after learning LearnOpenGL chapter 13

First incorrect result Hello guys, I've been studying OpenGL on learnopengl.com and I found the result weird when I finished learning the basic lighting chapter. The result is I found specular light on the corner of the cube surface where the light…
RiverFlows
  • 31
  • 4
0
votes
0 answers

ThreeJS: Use a ShaderMaterial as an alphaMap inside a MeshPhongMaterial

Let's say we have a black and white Shader on a sphere. Is it possible to use it as an alphaMap on a MeshPhongMaterial for another sphere? Can we use a ShaderMaterial as an alphaMap of a MeshPhongMaterial, like we use a MeshPhongMaterial.map for an…
VΛVΛV
  • 93
  • 1
  • 11
0
votes
1 answer

Three js object turning black when applying Phong Shading

I have a project that basically displays 3 cubes and if i press A i alternate the material of the cubes between a MeshLambertMaterial and a MeshPhongMaterial. The problem is whenever i create the phong material and add the shadding itself the object…
0
votes
1 answer

ThreeJS Phong material is coming dark

I am loading a BM3 file which contains definitions of (geometry and) material information as below: { type: "Phong", opacity: 1, name: "", diffuseMap: 0, color: [ 0.254902, 0.2, 0.129412, ], transparent: false, …
ali
  • 529
  • 4
  • 26
0
votes
0 answers

Strange ring around specularity when shading according to Phong model

I am writing a raytracer and shading using the Phong illumination model. In this example, my material does not have any ambient term. When I render, I get the following image: As you can see, there appears to be a lighter ring around the…
Paul Hübner
  • 3
  • 1
  • 3
0
votes
1 answer

Can the Phong shading model be implemented in fixed function pipeline OpenGL?

The Phong shading technique interpolates normals at vertices to achieve a smooth shading effect. It is usually combined with the Phong illumination model, and it can be implemented in modern OpenGL. However, does fixed-function pipeline OpenGL…
Aldan Creo
  • 686
  • 1
  • 5
  • 14
0
votes
1 answer

OpenGL: Lighting without shaders

How can I make phong lighting without using a shader (university task). Can I manually calculate ambient, diffuse, specular and transfer their sum to glColor? UPD: I have a good display of the sum from ambient and diffuse. But the specular doesn't…
0
votes
0 answers

Transforming lights in glsl vertex shader with additional uniform mat4?

I'm using a scene graph for my scene. It contains lights and meshes. Meshes have local transforms, and if a node is the child of a mesh node, its own local transform gets composed with the transform of its parent. Now i am trying to implement…
The Coding Wombat
  • 805
  • 1
  • 10
  • 29
0
votes
2 answers

Why won't my normals interpolate between the vertices, thus creating a flat shading effect?

I am having some trouble with my Phong shading algorithm. It seems like the normals are off and I always get a flat shaded surface. I am implementing deferred rendering, so in my geometry pass I store the vertex' position and normal in textures. In…
Miso_Soup
  • 19
  • 5
0
votes
0 answers

Doubts about Phong shading WebGL formulas as explained in Angel Shreiner book

In the 8th pack of slides of the Angel Shreiner book "Interactive Computer Graphics" (slides available here) the suggested code for calculating lighting starts like this: vec3 pos = -(modelViewMatrix*vPosition).xyz; vec3 L = normalize(…
memememe
  • 663
  • 6
  • 21
0
votes
1 answer

"Specular" color with phong shading and raytracing overflows

I implemented phong shading on my raytracer. Unfortunatelly I am receiving a segmentation fault when running it. The likely cause is related to the "specular_color" Vec3f variable (with is an object made of three floats). When I print its values, I…
user2752471
  • 444
  • 1
  • 6
  • 14
0
votes
0 answers

Specular highlight moves as camera moves

I am implementing a specular highlight in OpenGL as part of the phong model. Currently, the highlight moves when my camera moves rather that getting brighter or dimmer which obviously isn't the expected result. I have followed the tutorial on…
0
votes
1 answer

How to pick light source for Phong shading implementation?

I am trying to implement the Phong shading model and I am unsure of how to pick a light source. More specifically, I do not understand what the light source should look like. Should it be a vec3? Or maybe a matrix, which I have defined in my Java…
ffblord
  • 403
  • 3
  • 7
  • 14
0
votes
0 answers

OpenGL Phong Shading

I'd like to render object to see the inside of the box. I used Phong Shading. When I draw object with glPolygonMode(GL_FRONT_AND_BACK, GL_LINE), an image looks like this: But When I used glPolygonMode(GL_FRONT_AND_BACK, GL_FILL), the image looks…
alryosha
  • 641
  • 1
  • 8
  • 15
0
votes
1 answer

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 material coefficient to have some effect. My doubt…
Daniel Marques
  • 506
  • 5
  • 20