Skip to main content
12 votes

How do I implement flat shading in GLSL?

As @rutter says, your #1 option is the correct thing to do in the overwhelming majority of all cases. However, if you're really adamant that you want everything to be hard-edged, then you can do this ...
Trevor Powell's user avatar
8 votes
Accepted

How do I implement flat shading in GLSL?

You may have heard 3D modelers talk about "hard edges" or "sharp edges", which are roughly equivalent to what you're looking for here. When modelers create a hard edge, their software will internally ...
rutter's user avatar
  • 746
4 votes
Accepted

Physically based shading - ambient/indirect lighting

Disclaimer: the following answer was published in its entirity by Nathan Reed an a similar question the asker posted on the Computer Graphics Stack Exchange. Real-time graphics deploys a variety of ...
3 votes
Accepted

Why specular reflection portion changes when we move in different direction?

The specular highlight (labelled "specular" on the pictures you provided) is an specular reflection of the light source. It happens where the rays from the light source are reflected ...
Theraot's user avatar
  • 27.2k
3 votes

How do I implement flat shading in GLSL?

The third option is to use flat interpolation specifier when passing attributes from the vertex shader to the fragment shader. This will make the gpu take the ...
ratchet freak's user avatar
3 votes
Accepted

How should I apply Ambient Occlusion from greyscale AO maps?

Correct approach is to multiply ambient component with AO: vec3 lighting = ambient * ao + diffuse + specular; ** it is not a coincidence, that both items have ...
Kromster's user avatar
  • 10.7k
3 votes

Real time lighting in a 2D game with angled camera perspective

No, camera methods cannot be easily combined, but it is possible. One would have to make a 3d mapping of the area then make a birds view map from the 3d map, then make all of the blocked objects in ...
FreezePhoenix's user avatar
3 votes

Identify shading language in Trove

I can't comment since I don't have enough rep yet. As UnholySheep said in the comments to your question, looking at the .common files you can find out that this is indeed a custom shader language. ...
RelicBloodvayne's user avatar
2 votes

What is the best way to draw outline of object using OpenGL

One way would be to draw the object or character you wish to outline by itself into a depth-only buffer. Then you could run an edge detector on the depth buffer to find the edges of the object. ...
user1118321's user avatar
  • 2,632
2 votes

Difference in Shading Using Eye Space or Model Space Coordinates

First, you are misunderstanding the point of the article; these are not two different kinds of fragment shading. This is just an illustration two different coordinate systems. Which one you use will ...
Trevor Powell's user avatar
2 votes

Radiance arriving at or leaving a surface

I think that both ways of looking at radiance are valid; it just depends on what you are trying to determine. Their diagram shows the radiance arriving at a point from a particular direction. If you ...
Incredulous Monk's user avatar
2 votes
Accepted

How to achieve good looking surface net normals?

A common way of generating vertex normals for a mesh is to sum the normals of the faces that touch each vertex, then normalize those sums. You're part-way there with taking cross-products from the ...
Victor T.'s user avatar
  • 1,381
2 votes

How to make this generated terrain flat-shaded?

This can be achieved in 2 ways. The first is very simple, and is how ThinMatrix did it in his game. When you pass the normal from the vertex shader to the fragment shader, apply the ...
Bálint's user avatar
  • 14.9k
2 votes
Accepted

Implementing spot lights in Vulkan and some pixels are black

So, it appears that I have found the issue. Kind of. I know what I want to blame it on at least - floating point rounding errors. As I wrote in my edit, the problem seems to stem from lightViewAngle ...
Daybreak's user avatar
2 votes

Why should every light source have its own ambient light?

But in the tutorial, at least for the basic lightning part, the ambient is actually part of the light "object" itself. Essentially every light source has its own ambient light If you ...
Filip Milovanović's user avatar
2 votes
Accepted

Object made of cubes looks different based on the distance in Unity3D?

Finally I managed to fix it, with the help of the official Unity Forums. (20 minutes after posting, there was already an answer) I just had to increase the (Shadow) Bias of my light source. (...
Tudvari's user avatar
  • 761
2 votes
Accepted

What specific lighting property creates "the unity look"

Personally I wouldn't say that there is a universal "Unity look"; see games like Cities: Skylines, Battletech, Dave the Diver, and Mechanicus for examples of different visual styles in 3D ...
Kevin's user avatar
  • 6,234
2 votes
Accepted

Is diffuse reflection definition failed when we see both reflection(diffuse,specular) is happening on one single object?

First of all, the angle of the incident light is the same for every point The angle between the incident light and the normal is different. Even if the incident light comes form the same direction※, ...
Theraot's user avatar
  • 27.2k
1 vote

Flat and crispy shading

In the Mesh Renderer component you can select if that object will cast and receive shadows. So if there are some 3D objects that you don't want to have a shadow, just disable Shadow Casting and Shadow ...
OKprogrammer's user avatar
1 vote

Improving shading of procedurally generated pixel art sprites

For those of you following or facing a similar problem, I believe I found a relatively easy solution. Considering that I'm travelling around 360 degrees to make a shape, I can use the angle to ...
benneyHacker's user avatar
1 vote

Improving shading of procedurally generated pixel art sprites

Shading is about indicating the 3D shape of the object, so to shade an object well you have to generate its 3D shape. On your first pass, instead of making a flat colored shape, you could make a ...
Foxwarrior's user avatar
1 vote
Accepted

Monogame problem with flat shading low poly terrain

Some of my vertices were ordered clockwise instead of counter-clockwise and so they were being drawn upside down. I swapped all the vertices to be ordered in counter-clockwise and that fixed the issue....
Zivodor's user avatar
  • 11
1 vote
Accepted

The difference between shading and data interpolation

Consider the fundamental difference between the two: Phong shading makes a mesh look smoother, but doesn't change the mesh itself whereas interpolating the surface with additional vertices does. Thus,...
Pikalek's user avatar
  • 12.4k
1 vote

Difference in Shading Using Eye Space or Model Space Coordinates

The use of 'shading' here is a bit off from the typical renderer meaning. The author appears to talk about how texture coordinates are computed. In the first case, texture coordinates are assigned ...
Lars Viklund's user avatar
  • 4,104

Only top scored, non community-wiki answers of a minimum length are eligible