You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm confused about how to apply different colors to different spheres. I tried modifying the values passed into the given code here: write_matrix_to_png(C,C,C,A,filename); by doing something like: write_matrix_to_png((C/2),C,(C/3),A,filename);, etc. to give different RGB values, but it changes all sphere colors and the background as well.
I can't find anything in the slides about how to modify the color of individual spheres, so any help would be appreciated!
The text was updated successfully, but these errors were encountered:
write_matrix_to_png(R, G, B, A, filename) is indeed where you need to modify to get the different color. However, this function only simply writing R, G, B and Alpha matrices to a png file.
When it comes to different colors for each sphere. You need to specify it when constructing matrices R, G, B. Different colors come from different materials i.e. those coefficients in the shading model, which would be different for each color channel (reflecting more red light gives you a red object). The easiest way to get it done is to let different objects' shading contributes to a different color channel.
I'm confused about how to apply different colors to different spheres. I tried modifying the values passed into the given code here:
write_matrix_to_png(C,C,C,A,filename);
by doing something like:write_matrix_to_png((C/2),C,(C/3),A,filename);
, etc. to give different RGB values, but it changes all sphere colors and the background as well.I can't find anything in the slides about how to modify the color of individual spheres, so any help would be appreciated!
The text was updated successfully, but these errors were encountered: