lunedì 16 maggio 2016

Day 126: Submodels and specular buffer

Today I did a lot of step towards the final manager of models.

First thing, I modified the engine to handle multiple models for each gameobject. Now a model is basically a list of submodels. This was not difficult in theory, but in practice it required me to modify tons of classes.

Then I started working on the new shader, but I noticed that there was a much bigger problem, that I failed to see until now: the renderer requires extra buffers to store info about the colors of the model!

Right now I was just using a single color buffer, and today I modified the renderer class to have an additional buffer, for the specular color. I will not support ambient color, because it is seldom used, but If required It should be simple to add in the future.

In the picture you can see a light with a white specular component reflecting on a material with a blue specular component. The result is blue.

The diffuse component of the light is purple, but the result is red because the material reflect only diffuse red lighting. The resulting color is still purple because it is on top of the blue specular color.


Nessun commento:

Posta un commento