openframeworks / openframeworks/openFrameworks

An Example Bug - Geometry Sahder

Open
#2,062 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug example section-3D
Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

So when i use the example geometryshader in the examples/gl folder i see a number of quads created from lines.

This Creation and the corresponding lighting is calculated in a geometry shader. However when i rotate the scene i can clearly see that the lighting doesnt really adapt - it seems to be wrong somehow - rotating in a random direction since it doesnt adapt to the normals of the created shape and their relation to the lighting vector

To test this - try to change the lighting normal uniform in testapp.cpp to (0,0,1) and rotate the scene. you will see that shape, motion and light dont correlate.

This is were the normal is calculated in the geometry shader:

vec3 norm = cross(right, dir);

for me problem was solved if i multiplied it with the normal matrix;

vec3 norm = cross(right, dir);
norm= norm*gl_NormalMatrix;

this way the light looks and feels correct but i came across this solution by tryind and trying. not knowing...So i would be really thankful if someone could verify that this is the correct solution. and makes sense...Thank you very much

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with examples/gl/testapp.cpp and locate the geometry shader code containing vec3 norm = cross(right, dir). Reproduce the issue by setting the lighting normal uniform to (0,0,1) and rotating the scene, then verify whether the normal transformation produces consistent lighting. Done means the example's generated quads and lighting correlate during rotation, with any necessary example or shader change documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.