Day 31 – [SinC] – Cube and Light
Mirrored from my blog (en, pt-br).
Today I kept doing the cube. After losing almost 2.5 days doing this cube I could reach a satisfactory result and learned a a bit of photoshop. So worth it.
Yesterday I had already finished the texture and just did not like the lighting, I was using the shader self-illumin and by far ended up being bad to see.
I started doing some tests using point light. I really liked the result, but ended consuming a lot of processing. Each cube ended up with 18 point lights (one for each point where has light in the texture), I did a test with 4 cubes (72 point light) and when the camera focused on the 4 the result was:
- 4 FPS Without GPU (i7 2670QM).
- 16 FPS With GPU (GeForce GT 540M).
Although I liked I had to find another solution.
PS: As the radius of the points lights was intersecting they was annulling eachother, I believe it is some algorithm of Unity for performance. To solve this I had to set the render mode to important.
I ended up going back to self-illumin and doing several tests with texture and light map. After a while I got a result that I liked.
As I did the middle light of the cube specifically to inform if the cube is with gravity, without gravity or with gravity inverted, I modified the script that manages gravity to change the material based on the status of the cube.
In the video below you can see how the middle light changes relative of the gravity of the cube.
PS: Sorry for the bad english.