openframeworks / openframeworks/openFrameworks
An Example Bug - Geometry Sahder
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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