I am having some problems with my first pass. Here is what I am trying to do:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 | v2 PixInStage = CameraPInStageSpace + PixelP;
v2 PixUV = {PixInStage.x/StageSize.x, PixInStage.y/StageSize.y};
loaded_bitmap *Map = &TopMap->LOD[0];
v2 MapPixelP = {Map->Width * PixUV.x, Map->Height * PixUV.y};
bilinear_sample MapSample = BilinearSample(Map, MapPixelP.x, MapPixelP.y);
v3 MapTexel = SRGBBilinearBlend(MapSample, fX, fY).xyz;
v3 LightColor = {0, 0, 0}; // TODO(barret): How do we sample from the middle map???
real32 tFarMap = 0.9f; // TODO(barret): what will this be for me???
LightColor = Lerp(LightColor, tFarMap, MapTexel);
Texel.rgb = Texel.rgb + Texel.a*LightColor;
|
I am just focusing on basic shading on the characters for now. In scene lights like projectiles can be done later. What I am trying to do is find the pixel I want to render in stage space(using the stage's coordinate system, not the cameras). Then I find the UV of the Pixel. After I get the environment map I want to use, I use the UV I just got to find the pixel in pixel in the environment map I want to use. Then I get the bilinear sample of the pixel and blend them together. Then I blend it with the light color which I will get from the middle map later. The tFarMap I just decided to make 0.9f for now while I debug. Finally, I add that to the Texel.
I am using this model because I thought it might be easier for me to understand but it did not work out that great. This is what the result ended up looking like:
Google Drive
*Sorry don't know how to upload an image that I can display here.
I am not sure why it ended up looking like this. If anyone is willing help any help is appreciated.
Also, if you just want to download to project to look at it. You can get it here:
Github