dilevin / computer-graphics-shader-pipeline

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

rotate_about_y in lit.fs #36

Closed ginkxo closed 4 years ago

ginkxo commented 4 years ago

where can we link the .glsl file to allow the use of this function in lit.fs? A previous issue here a year ago mentioned "fragment" but I can't seem to find this.

abhimadan commented 4 years ago

Shaders are sent to the GPU as a string, and we concatenate the appropriate function files at runtime before sending them to the GPU. You can look at this file to see which files you have access to in the vertex, tessellation, and fragment shaders for test-05. This shows that you don't have access to rotate_about_y, and since you don't submit these data files, you aren't allowed to change them.

ginkxo commented 4 years ago

Thanks. would it be okay to re-define rotate_about_y in the fragment shader file itself, then?

abhimadan commented 4 years ago

From the readme:

Unless otherwise noted, do not declare new functions.

You can create a rotation matrix inline if you really feel it's necessary, but if your normals and vertex positions are in the appropriate coordinate spaces, you shouldn't need to do that in the fragment shader. Please take a look at the output specification comments carefully in all the files, since it's easy to miss.

yunhaom94 commented 4 years ago

From the readme:

Unless otherwise noted, do not declare new functions.

You can create a rotation matrix inline if you really feel it's necessary, but if your normals and vertex positions are in the appropriate coordinate spaces, you shouldn't need to do that in the fragment shader. Please take a look at the output specification comments carefully in all the files, since it's easy to miss.

How should us rotate the light source without using an rotation matrix?

abhimadan commented 4 years ago

You can directly model the light position as a function of time.