dilevin / computer-graphics-shader-pipeline

Computer Graphics Assignment about the Shader Pipeline
2 stars 5 forks source link

Is bump.fs and planet.fs supposed to alter the object's geometry? #38

Open Navash914 opened 4 years ago

Navash914 commented 4 years ago

I have my normal manipulation working for the bump mapping, however my objects are still spheres on the vertex level. So although my planet looks like it has bumps, it still appears very flat (especially when zoomed in) and the wireframe shows it's a sphere. Is this supposed to be the case, or are we supposed to manipulate the geometry of the object? I assume not, since the fragment shader doesn't manipulate the object itself? Then again, it's referred to as "bump mapping", which is supposed to change the object geometry, as opposed to "normal mapping" which is what my code is currently doing, which is why I'm confused.

For reference, I am only passing an altered normal to my blinn-phong shader, so the v and l vectors are still the same. Am I supposed to change them? and if so how?

Attached an image of my planet and its wireframe for reference.

2020-02-27-004517_1920x1080_scrot

2020-02-27-004538_1920x1080_scrot

abhimadan commented 4 years ago

Bump mapping only perturbs the normal, which gives the appearance of a bumpy surface when rendered. Of course, as you've noticed, the geometry is still flat, so things like shadows will still be based on the underlying surface. Manipulating the geometry directly is called displacement mapping.